unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* null source-properties for procedure-source retrieved from frame
@ 2007-01-24 19:21 Julian Graham
  2007-01-25 12:22 ` Andy Wingo
  0 siblings, 1 reply; 4+ messages in thread
From: Julian Graham @ 2007-01-24 19:21 UTC (permalink / raw)
  To: guile-user

Hi Guilers,
  I've noticed that I can't seem to get anything but null when I call
(source-properties (procedure-source (frame-procedure frame))), where
frame is some stack frame I'm working with using the debugging
interface.  I get plenty of info with (source-properties (frame-source
frame)).  What gives?  I'm guessing that the value of the
procedure-source call is somehow not eq? to the original expression
for which the source properties were recorded.  Is that by design?  Is
there some other way I can, for example, find out the line number on
which a procedure was defined?


Thanks,
Julian


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: null source-properties for procedure-source retrieved from frame
  2007-01-24 19:21 null source-properties for procedure-source retrieved from frame Julian Graham
@ 2007-01-25 12:22 ` Andy Wingo
  2007-01-25 15:28   ` Julian Graham
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Wingo @ 2007-01-25 12:22 UTC (permalink / raw)
  To: guile-user

Hi Julian,

On Wed, 2007-01-24 at 14:21 -0500, Julian Graham wrote:
> Is
> there some other way I can, for example, find out the line number on
> which a procedure was defined?

I was wondering this myself about a week ago! A couple of hours of
poking through eval.c and debug.c didn't get me anywhere though.

Procedure-source returns the source via unmemoizing guile's memoized
representation, which is always a new tree. So the new tree is not
associated with the original source properties. Furthermore the first
two elements (lambda and the formals list) are reconstructed, they are
not kept from the original source. The best you could do with
source-properties would be the line of the first expression in the body.

I would really like this as well. It would allow automatically-generated
module docs to define procedures in the order that they appear in a
module. Probably needs to be added to procedure-properties rather than
source-properties, though.

Here's hoping someone has a clever patch stashed somewhere :)

Andy.
-- 
http://wingolog.org/



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: null source-properties for procedure-source retrieved from frame
  2007-01-25 12:22 ` Andy Wingo
@ 2007-01-25 15:28   ` Julian Graham
  2007-01-25 17:03     ` Andy Wingo
  0 siblings, 1 reply; 4+ messages in thread
From: Julian Graham @ 2007-01-25 15:28 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-user

Hi Andy,
  Well, sure, I'd settle for the beginning of the procedure body, if
that were possible.

  After all, the reason I was interested in the first place was that
I'm trying to implement call graph analysis for statprof -- with
output in callgrind format, which happens to require position
information.  For native code, callgrind outputs the destinations of
function calls as being the first line of the function body, so that'd
be fine.

  In terms of a patch, I feel like this wouldn't be so hard if we
could clear the memoization hurdle -- my (naive) understanding of
source-properties is that it's just a hashq-ref, so we could work
around the lambda decl problem by making it a hashx-ref that ignores
that stuff during the hash.


On 1/25/07, Andy Wingo <wingo@pobox.com> wrote:
> Hi Julian,
>
> On Wed, 2007-01-24 at 14:21 -0500, Julian Graham wrote:
> > Is
> > there some other way I can, for example, find out the line number on
> > which a procedure was defined?
>
> I was wondering this myself about a week ago! A couple of hours of
> poking through eval.c and debug.c didn't get me anywhere though.
>
> Procedure-source returns the source via unmemoizing guile's memoized
> representation, which is always a new tree. So the new tree is not
> associated with the original source properties. Furthermore the first
> two elements (lambda and the formals list) are reconstructed, they are
> not kept from the original source. The best you could do with
> source-properties would be the line of the first expression in the body.
>
> I would really like this as well. It would allow automatically-generated
> module docs to define procedures in the order that they appear in a
> module. Probably needs to be added to procedure-properties rather than
> source-properties, though.
>
> Here's hoping someone has a clever patch stashed somewhere :)


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: null source-properties for procedure-source retrieved from frame
  2007-01-25 15:28   ` Julian Graham
@ 2007-01-25 17:03     ` Andy Wingo
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Wingo @ 2007-01-25 17:03 UTC (permalink / raw)
  To: guile-user

Hi Julian,

On Thu, 2007-01-25 at 10:28 -0500, Julian Graham wrote:
>   After all, the reason I was interested in the first place was that
> I'm trying to implement call graph analysis for statprof -- with
> output in callgrind format, which happens to require position
> information.

In this case your task is easy, statprof already has access to the
frames and can collect the source-properties directly from
`frame-source'.

Cheers,

Andy
-- 
http://wingolog.org/



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

end of thread, other threads:[~2007-01-25 17:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-24 19:21 null source-properties for procedure-source retrieved from frame Julian Graham
2007-01-25 12:22 ` Andy Wingo
2007-01-25 15:28   ` Julian Graham
2007-01-25 17:03     ` Andy Wingo

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