unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Enabling tracing on a phase to debug?
@ 2022-07-15 19:53 Maxim Cournoyer
  2022-08-17 10:17 ` zimoun
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Cournoyer @ 2022-07-15 19:53 UTC (permalink / raw)
  To: guix-devel

Hello Guix,

I was toying with the idea to programatically enable tracing the
execution of a single build phase to aid with debugging, and came up
with this with the help of robin on #guix (thanks!)

--8<---------------cut here---------------start------------->8---
@@ -4349,7 +4349,19 @@ (define-public vala
              (substitute* "valadoc/tests/libvaladoc\
 /tests-extra-environment.sh"
                (("export PKG_CONFIG_PATH=" m)
-                (string-append m "$PKG_CONFIG_PATH:"))))))))
+                (string-append m "$PKG_CONFIG_PATH:")))))
+
+         (replace 'glib-or-gtk-wrap
+           (lambda args
+             (use-modules (system vm trace)
+                          (system vm vm))
+             (call-with-vm
+              (lambda ()
+                (set-vm-engine! 'debug)
+                (call-with-trace
+                  (lambda _
+                    (apply (assoc-ref %standard-phases 'glib-or-gtk-wrap)
+                           args))))))))))
     (native-inputs
      `(("bison" ,bison)
        ("dbus" ,dbus)                   ; for dbus tests
--8<---------------cut here---------------end--------------->8---

Unfortunately it doesn't cause any trace to be output.  Is there
something missing to the above incantation, perhaps?

Thanks,

Maxim


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Enabling tracing on a phase to debug?
  2022-07-15 19:53 Enabling tracing on a phase to debug? Maxim Cournoyer
@ 2022-08-17 10:17 ` zimoun
  0 siblings, 0 replies; 2+ messages in thread
From: zimoun @ 2022-08-17 10:17 UTC (permalink / raw)
  To: Maxim Cournoyer, guix-devel

Hi Maxim,

On Fri, 15 Jul 2022 at 15:53, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

> I was toying with the idea to programatically enable tracing the
> execution of a single build phase to aid with debugging, and came up
> with this with the help of robin on #guix (thanks!)

Well, I am often annoyed when debugging a package and I usually use
“guix build -K” and then jump in /tmp/guix-<package>-XY.  The most
annoying is to re-run all the previous phases when they are somehow
already available under /tmp/.  And often, this re-run is just for
tweaking the recipe to have more context about the failure…

> --8<---------------cut here---------------start------------->8---
> @@ -4349,7 +4349,19 @@ (define-public vala
>               (substitute* "valadoc/tests/libvaladoc\
>  /tests-extra-environment.sh"
>                 (("export PKG_CONFIG_PATH=" m)
> -                (string-append m "$PKG_CONFIG_PATH:"))))))))
> +                (string-append m "$PKG_CONFIG_PATH:")))))
> +
> +         (replace 'glib-or-gtk-wrap
> +           (lambda args
> +             (use-modules (system vm trace)
> +                          (system vm vm))
> +             (call-with-vm
> +              (lambda ()
> +                (set-vm-engine! 'debug)
> +                (call-with-trace
> +                  (lambda _
> +                    (apply (assoc-ref %standard-phases 'glib-or-gtk-wrap)
> +                           args))))))))))
>      (native-inputs
>       `(("bison" ,bison)
>         ("dbus" ,dbus)                   ; for dbus tests
> --8<---------------cut here---------------end--------------->8---

…so maybe we could have something like that for a better tracing.

Maybe, we could imagine an option as “guix build --list-phases” and then
a kind of package transformation doing on-the-fly the “call-with-vm” –
available with an option as “guix build --trace=glib-or-gtk-wrap”.


> Unfortunately it doesn't cause any trace to be output.  Is there
> something missing to the above incantation, perhaps?

Sadly, I do not know.


Cheers,
simon


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-17 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-15 19:53 Enabling tracing on a phase to debug? Maxim Cournoyer
2022-08-17 10:17 ` zimoun

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).