unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Holger Blasum <holgerlists@blasum.net>
Subject: guile-debugging: how to access source properties from trap context
Date: Sun, 1 Jan 2006 22:33:51 +0100	[thread overview]
Message-ID: <20060101213351.GA5366@tosh> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2174 bytes --]

Hello guile-user,

in the "Guile Debugging Enhancements" tutorial 
(http://download.gna.org/guile-debugging/guile-debugging.html)
there is encouragement to play with the source trap context
parameters. 

What I want to look at are the source file names and 
line numbers like eg in any gdb stepping session of a C program
say for matrix multiplication like: 

gdb -f a.out
(gdb) br main
Breakpoint 1 at 0x8048417: file matrix.c, line 11.
(gdb) run
Starting program: /home/blasum/a/comp/sema/sample/c/samples/a.out 
/home/blasum/a/comp/sema/sample/c/samples/matrix.c:12
(gdb) step
/home/blasum/a/comp/sema/sample/c/samples/matrix.c:13
(gdb) step
/home/blasum/a/comp/sema/sample/c/samples/matrix.c:14
(gdb) step
...

How can one access file name and line number of the source
properties in guile-debugging?

My first shot was at 

$ guile
guile> (use-modules (ice-9 debugger) (ossau 
	ice-9-debugger-extensions) (ossau traps) (ossau trace))
guile> (load "matrix.scm")
guile> (define (report-exp trap-context)
    (display "Expression: ")
    (display (tc:expression trap-context))
    (newline))
guile> (install-trap (make <procedure-trap> #:procedure mkmatrix
#:behaviour (list report-exp)))
guile> (do-main 4)
Expression: #f
Expression: #f
guile>

However expression (#f might be ok, because we are dealing 
with vectors, and it *is* called twice) is the wrong 
attribute what I'm really looking for is not the evaluated 
expression (nor its uninterpreted source text) but its
source text's file name and line number ;) 

Any hints (even if they involve twiddling with traps.scm) very 
welcome ... (Credits for the matrix multiplication sample 
are to Peter Williams, matrix multiplication is not really 
what I am interested in but is perhaps a good example for 
testing a stepper.)

Happy 2006,

-- 
Holger Blasum +49-174-7313590 (gsm) GnuPG 1024D/ACDFC3B769DC1ED66B47
"It has turned out that the networking of many small computers, at many 
places, is more efficient than the one supercomputer - the success of 
the internet is based on this principle." - Angela Merkel, government
declaration, 30 Nov 2005

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 140 bytes --]

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

             reply	other threads:[~2006-01-01 21:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-01 21:33 Holger Blasum [this message]
2006-01-02  0:18 ` guile-debugging: how to access source properties from trap context Neil Jerram
2006-01-02 12:39   ` Neil Jerram
2006-01-02 22:33     ` Holger Blasum
2006-01-03 22:57       ` Neil Jerram
2006-01-07 16:54         ` Holger Blasum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060101213351.GA5366@tosh \
    --to=holgerlists@blasum.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).