unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* resolving anonymous procedures in statprof
@ 2020-02-28 14:24 Christopher Howard
  2020-03-02  1:41 ` Christopher Howard
  2020-03-05 21:32 ` Ludovic Courtès
  0 siblings, 2 replies; 3+ messages in thread
From: Christopher Howard @ 2020-02-28 14:24 UTC (permalink / raw)
  To: guile-user

Hi, Guile's statprof utility is very helpful, but a lot of my output
lines point to anonymous procedures like "anon #x1db7d38". Is there a
way to figure out which specific lambdas those are referring to? In
principle it seems like I should be able to figure that out by running
the dissembler (,x) on the code I am profiling with statprof, but the
addresses given by the dissassembler do not match the ones given by
statprof.

-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social: https://gnusocial.club/librehacker
gpg: ADDEAADE5D607C8D (keys.gnupg.net)




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

* Re: resolving anonymous procedures in statprof
  2020-02-28 14:24 resolving anonymous procedures in statprof Christopher Howard
@ 2020-03-02  1:41 ` Christopher Howard
  2020-03-05 21:32 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Christopher Howard @ 2020-03-02  1:41 UTC (permalink / raw)
  To: guile-user

What, none of the Great Ones know the answer to this? Surely I can't be
the first to have anonymous functions in statprof'd code.

-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social: https://gnusocial.club/librehacker
gpg: ADDEAADE5D607C8D (keys.gnupg.net)

On Fri, 2020-02-28 at 05:24 -0900, Christopher Howard wrote:
> Hi, Guile's statprof utility is very helpful, but a lot of my output
> lines point to anonymous procedures like "anon #x1db7d38". Is there a
> way to figure out which specific lambdas those are referring to? In
> principle it seems like I should be able to figure that out by
> running
> the dissembler (,x) on the code I am profiling with statprof, but the
> addresses given by the dissassembler do not match the ones given by
> statprof.
> 




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

* Re: resolving anonymous procedures in statprof
  2020-02-28 14:24 resolving anonymous procedures in statprof Christopher Howard
  2020-03-02  1:41 ` Christopher Howard
@ 2020-03-05 21:32 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2020-03-05 21:32 UTC (permalink / raw)
  To: Christopher Howard; +Cc: Andy Wingo, Guile User

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

Hi Christopher,

Christopher Howard <christopher@librehacker.com> skribis:

> Hi, Guile's statprof utility is very helpful, but a lot of my output
> lines point to anonymous procedures like "anon #x1db7d38". Is there a
> way to figure out which specific lambdas those are referring to? In
> principle it seems like I should be able to figure that out by running
> the dissembler (,x) on the code I am profiling with statprof, but the
> addresses given by the dissassembler do not match the ones given by
> statprof.

I had the very same question not long ago actually.  :-)

I fiddled a bit to see how it could be that Guile couldn’t figure out
debugging info for a code snippet, to no avail (on Guile 3).  For
instance, the attached snippet didn’t seem to have any effect.

Any ideas, Andy?

Thanks,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 794 bytes --]

diff --git a/module/statprof.scm b/module/statprof.scm
index 33eac4468..dc057eb20 100644
--- a/module/statprof.scm
+++ b/module/statprof.scm
@@ -388,8 +388,13 @@ always collects full stacks.)"
       data))))
 
 (define (addr->printable addr pdi)
-  (or (and=> (and=> pdi program-debug-info-name) symbol->string)
-      (string-append "anon #x" (number->string addr 16))))
+  (or (and=> pdi program-debug-info-name)
+      (let ((base (string-append "anon #x"
+                                 (number->string addr 16)))
+            (loc  (find-source-for-addr addr)))
+        (if loc
+            (string-append base ":" (source->string loc))
+            base))))
 
 (define (inc-call-data-cum-sample-count! cd)
   (set-call-data-cum-sample-count! cd (1+ (call-data-cum-sample-count cd))))

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

end of thread, other threads:[~2020-03-05 21:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-28 14:24 resolving anonymous procedures in statprof Christopher Howard
2020-03-02  1:41 ` Christopher Howard
2020-03-05 21:32 ` Ludovic Courtès

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).