From: Thiago Jung Bauermann <bauerman@br.ibm.com>
To: tromey@redhat.com
Cc: gdb ml <gdb@sourceware.org>
Subject: Re: repo to work on python scripting support
Date: Mon, 24 Mar 2008 17:16:00 -0000 [thread overview]
Message-ID: <1206369478.29533.15.camel@localhost.localdomain> (raw)
In-Reply-To: <m3tzj7y2cz.fsf@fleche.redhat.com>
Hi everybody,
My turn at the status update. :-)
I did the OO rewrite for the frames support, it has a few useful methods
already (equals, is_inner_than, get_name, get_pc, get_prev, get_next,
find_sal). You can also call gdb.frames(), which will return a tuple
containing all frames in the stack (or throw an exception if there's a
problem with the unwinding).
I also exposed a little bit of struct symtab and struct symtab_and_line
(which is returned by Frame.find_sal), just enough to be able to
implement a mostly complete backtrace command in Python (it's only
missing ability to print function arguments, which I plan to work on
later).
Regarding the values work that Tromey mentioned, I didn't add
functionality to the code that Volodya implemented, just converted it to
OO form and worked on lifetime of struct value vs lifetime of Python
Value object (I believe I is correct now).
Here's the Python implementation of an "rbt" command which prints the
backtrace in reverse (or right :-P) order:
python
import sys
def gdb_rbacktrace ():
frames = gdb.frames ()
for i in reversed (range (len (frames))):
sal = frames[i].find_sal ()
pc = frames[i].get_pc ()
sys.stdout.write ("#%-2d" % i)
if pc != sal.get_pc () or not sal.symtab:
sys.stdout.write (" 0x%08x in" % pc)
sys.stdout.write (" " + frames[i].get_name ())
if sal.symtab and sal.symtab.get_filename ():
sys.stdout.write (" at " + sal.symtab.get_filename ())
sys.stdout.write (":" + str (sal.get_line ()))
if not frames[i].get_name () or (not sal.symtab or not
sal.symtab.get_filename ()):
lib = gdb.solib_address (pc)
if lib:
sys.stdout.write (" from " + lib)
sys.stdout.write ("\n")
end
define rbt
dont-repeat
python gdb_rbacktrace ()
end
Here's sample output:
(gdb) rbt
#2 0x080483bb in main at ../../src/examples/funcs.c:15
#1 0x08048391 in f1 at ../../src/examples/funcs.c:10
#0 f2 at ../../src/examples/funcs.c:5
(gdb)
--
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center
next prev parent reply other threads:[~2008-03-24 14:38 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-16 0:42 Thiago Jung Bauermann
2008-03-16 2:55 ` Tom Tromey
2008-03-24 17:16 ` Thiago Jung Bauermann [this message]
2008-03-25 11:45 ` Tom Tromey
2008-03-25 13:53 ` Daniel Jacobowitz
2008-03-25 18:37 ` Jim Blandy
2008-03-25 18:52 ` Daniel Jacobowitz
2008-03-25 18:53 ` Jim Blandy
2008-03-25 19:18 ` Tom Tromey
2008-03-27 6:41 ` Jim Blandy
2008-03-27 17:57 ` Paul Koning
2008-03-25 19:31 ` Paul Koning
2008-03-25 20:18 ` Tom Tromey
2008-03-25 20:31 ` Paul Koning
2008-03-26 3:23 ` Tom Tromey
2008-03-26 12:55 ` Jim Blandy
2008-03-26 17:29 ` Paul Koning
2008-03-26 17:58 ` Daniel Jacobowitz
2008-03-26 18:41 ` Tom Tromey
2008-03-26 20:04 ` Paul Koning
2008-03-26 22:45 ` Jim Blandy
2008-03-26 18:05 ` Doug Evans
2008-03-26 18:13 ` Daniel Jacobowitz
2008-03-26 18:25 ` Tom Tromey
2008-03-26 18:41 ` Daniel Jacobowitz
2008-03-26 18:55 ` Tom Tromey
2008-03-26 20:57 ` Daniel Jacobowitz
2008-03-26 21:01 ` Thiago Jung Bauermann
2008-03-27 14:11 ` Jim Blandy
2008-03-27 16:49 ` Paul Koning
2008-03-26 18:23 ` Tom Tromey
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1206369478.29533.15.camel@localhost.localdomain \
--to=bauerman@br.ibm.com \
--cc=gdb@sourceware.org \
--cc=tromey@redhat.com \
/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