unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* trace-calls-to-procedure
@ 2020-12-25  4:51 Tim Meehan
  2020-12-25  5:58 ` trace-calls-to-procedure Zelphir Kaltstahl
  2020-12-25 12:37 ` trace-calls-to-procedure Tim Van den Langenbergh
  0 siblings, 2 replies; 6+ messages in thread
From: Tim Meehan @ 2020-12-25  4:51 UTC (permalink / raw)
  To: guile-user

I have used ",trace" before and get what it is supposed to do, but I am not
sure what "trace-calls-to-procedure" is supposed to do ...

;; Using Guile 3.0.4
(use-modules (system vm trace))

(define (sqr x)
    (* x x))

(trace-calls-to-procedure sqr)

(sqr 3)

;; ... and nothing happens ... is something supposed to happen?


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

* Re: trace-calls-to-procedure
  2020-12-25  4:51 trace-calls-to-procedure Tim Meehan
@ 2020-12-25  5:58 ` Zelphir Kaltstahl
  2020-12-25  8:42   ` trace-calls-to-procedure tomas
  2020-12-26  1:23   ` trace-calls-to-procedure Tim Meehan
  2020-12-25 12:37 ` trace-calls-to-procedure Tim Van den Langenbergh
  1 sibling, 2 replies; 6+ messages in thread
From: Zelphir Kaltstahl @ 2020-12-25  5:58 UTC (permalink / raw)
  To: btmeehan; +Cc: guile-user

Hi Tim!

I do not know the answer to your question, but I noticed something else:
trace-calls-to-procedure returns a procedure. That procedure and its
return value can be applied infinitely, it seems:

~~~~
scheme@(guile-user)> (import (system vm trace))
scheme@(guile-user)> (define (sqr x)
    (* x x))
scheme@(guile-user)> (trace-calls-to-procedure sqr)
$1 = #<procedure 7f25860f4e80 at system/vm/traps.scm:599:6 (#:optional frame)>
scheme@(guile-user)> ((trace-calls-to-procedure sqr) 9)
$2 = #<procedure 7f25861ac1c0 at system/vm/traps.scm:596:8 (#:optional frame)>
scheme@(guile-user)> (((trace-calls-to-procedure sqr) 9))
$3 = #<procedure 7f2586624660 at system/vm/traps.scm:599:6 (#:optional frame)>
scheme@(guile-user)> ((((trace-calls-to-procedure sqr) 9)))
$4 = #<procedure 7f25861e9280 at system/vm/traps.scm:596:8 (#:optional frame)>
scheme@(guile-user)> 
~~~~

Not sure if that helps :D

Regards,
Zelphir

On 12/25/20 5:51 AM, Tim Meehan wrote:
> I have used ",trace" before and get what it is supposed to do, but I am not
> sure what "trace-calls-to-procedure" is supposed to do ...
>
> ;; Using Guile 3.0.4
> (use-modules (system vm trace))
>
> (define (sqr x)
>     (* x x))
>
> (trace-calls-to-procedure sqr)
>
> (sqr 3)
>
> ;; ... and nothing happens ... is something supposed to happen?

-- 
repositories: https://notabug.org/ZelphirKaltstahl



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

* Re: trace-calls-to-procedure
  2020-12-25  5:58 ` trace-calls-to-procedure Zelphir Kaltstahl
@ 2020-12-25  8:42   ` tomas
  2020-12-26  1:23   ` trace-calls-to-procedure Tim Meehan
  1 sibling, 0 replies; 6+ messages in thread
From: tomas @ 2020-12-25  8:42 UTC (permalink / raw)
  To: guile-user

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

On Fri, Dec 25, 2020 at 06:58:00AM +0100, Zelphir Kaltstahl wrote:
> Hi Tim!
> 
> I do not know the answer to your question, but I noticed something else:
> trace-calls-to-procedure returns a procedure. That procedure and its
> return value can be applied infinitely, it seems:

[...]

> Not sure if that helps :D

Not the OP here, but look at what you've done: now I feel dizzy %-)

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: trace-calls-to-procedure
  2020-12-25  4:51 trace-calls-to-procedure Tim Meehan
  2020-12-25  5:58 ` trace-calls-to-procedure Zelphir Kaltstahl
@ 2020-12-25 12:37 ` Tim Van den Langenbergh
  2020-12-25 14:56   ` trace-calls-to-procedure Tim Van den Langenbergh
  1 sibling, 1 reply; 6+ messages in thread
From: Tim Van den Langenbergh @ 2020-12-25 12:37 UTC (permalink / raw)
  To: guile-user


[-- Attachment #1.1.1: Type: text/plain, Size: 862 bytes --]

On 25/12/2020 05:51, Tim Meehan wrote:
> I have used ",trace" before and get what it is supposed to do, but I am not
> sure what "trace-calls-to-procedure" is supposed to do ...
> 
> ;; Using Guile 3.0.4
> (use-modules (system vm trace))
> 
> (define (sqr x)
>      (* x x))
> 
> (trace-calls-to-procedure sqr)
> 
> (sqr 3)
> 
> ;; ... and nothing happens ... is something supposed to happen?
> 

trace-calls-to-procedure is a low-level trace procedure that returns a 
trap that you have to install in the trap state. You can either use the 
add-trap! procedure from (use-modules system vm trap-state), or use the 
add-trace-at-procedure-call! procedure from the same module.

That said, there seems to be a bug in add-trace-at-procedure-call! which 
I'm having a hard time figuring out... c'est la vie.

Vale
-Tim Van den Langenbergh

[-- Attachment #1.1.2: OpenPGP_0xF50AF328D9D1E635.asc --]
[-- Type: application/pgp-keys, Size: 3963 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: trace-calls-to-procedure
  2020-12-25 12:37 ` trace-calls-to-procedure Tim Van den Langenbergh
@ 2020-12-25 14:56   ` Tim Van den Langenbergh
  0 siblings, 0 replies; 6+ messages in thread
From: Tim Van den Langenbergh @ 2020-12-25 14:56 UTC (permalink / raw)
  To: guile-user


[-- Attachment #1.1.1: Type: text/plain, Size: 725 bytes --]

On 25/12/2020 13:37, Tim Van den Langenbergh wrote:
> trace-calls-to-procedure is a low-level trace procedure that returns a 
> trap that you have to install in the trap state. You can either use the 
> add-trap! procedure from (use-modules system vm trap-state), or use the 
> add-trace-at-procedure-call! procedure from the same module.
> 
> That said, there seems to be a bug in add-trace-at-procedure-call! which 
> I'm having a hard time figuring out... c'est la vie.
> 
> Vale
> -Tim Van den Langenbergh

Update: the bug has already been addressed and a patch is awaiting merge:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=43102

I imagine this'll get in for 3.0.5.

Vale,
-Tim Van den Langenbergh

[-- Attachment #1.1.2: OpenPGP_0xF50AF328D9D1E635.asc --]
[-- Type: application/pgp-keys, Size: 3963 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: trace-calls-to-procedure
  2020-12-25  5:58 ` trace-calls-to-procedure Zelphir Kaltstahl
  2020-12-25  8:42   ` trace-calls-to-procedure tomas
@ 2020-12-26  1:23   ` Tim Meehan
  1 sibling, 0 replies; 6+ messages in thread
From: Tim Meehan @ 2020-12-26  1:23 UTC (permalink / raw)
  To: Zelphir Kaltstahl; +Cc: guile-user

Neat! I didn't notice that (even though I am sure that I saw it come up on
the REPL).
It is indeed weird ...
Looks like a time to read some of the source for "(system vm trace)" ...

On Thu, Dec 24, 2020 at 11:58 PM Zelphir Kaltstahl <
zelphirkaltstahl@posteo.de> wrote:

> Hi Tim!
>
> I do not know the answer to your question, but I noticed something else:
> trace-calls-to-procedure returns a procedure. That procedure and its return
> value can be applied infinitely, it seems:
>
> ~~~~
> scheme@(guile-user)> (import (system vm trace))
> scheme@(guile-user)> (define (sqr x)
>     (* x x))
> scheme@(guile-user)> (trace-calls-to-procedure sqr)
> $1 = #<procedure 7f25860f4e80 at system/vm/traps.scm:599:6 (#:optional frame)>
> scheme@(guile-user)> ((trace-calls-to-procedure sqr) 9)
> $2 = #<procedure 7f25861ac1c0 at system/vm/traps.scm:596:8 (#:optional frame)>
> scheme@(guile-user)> (((trace-calls-to-procedure sqr) 9))
> $3 = #<procedure 7f2586624660 at system/vm/traps.scm:599:6 (#:optional frame)>
> scheme@(guile-user)> ((((trace-calls-to-procedure sqr) 9)))
> $4 = #<procedure 7f25861e9280 at system/vm/traps.scm:596:8 (#:optional frame)>
> scheme@(guile-user)>
> ~~~~
>
> Not sure if that helps :D
>
> Regards,
> Zelphir
> On 12/25/20 5:51 AM, Tim Meehan wrote:
>
> I have used ",trace" before and get what it is supposed to do, but I am not
> sure what "trace-calls-to-procedure" is supposed to do ...
>
> ;; Using Guile 3.0.4
> (use-modules (system vm trace))
>
> (define (sqr x)
>     (* x x))
>
> (trace-calls-to-procedure sqr)
>
> (sqr 3)
>
> ;; ... and nothing happens ... is something supposed to happen?
>
> --
> repositories: https://notabug.org/ZelphirKaltstahl
>
>


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

end of thread, other threads:[~2020-12-26  1:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-25  4:51 trace-calls-to-procedure Tim Meehan
2020-12-25  5:58 ` trace-calls-to-procedure Zelphir Kaltstahl
2020-12-25  8:42   ` trace-calls-to-procedure tomas
2020-12-26  1:23   ` trace-calls-to-procedure Tim Meehan
2020-12-25 12:37 ` trace-calls-to-procedure Tim Van den Langenbergh
2020-12-25 14:56   ` trace-calls-to-procedure Tim Van den Langenbergh

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