This is the mail archive of the
mailing list for the GDB project.
Re: python: get filename for selected frame?
- From: Tom Tromey <tromey at redhat dot com>
- To: Joseph Garvin <joseph dot h dot garvin at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Wed, 07 Jul 2010 16:44:05 -0600
- Subject: Re: python: get filename for selected frame?
- References: <AANLkTil4y1svyCAtXIVfqIh-iMs-275ViKAMoYrpXBGi@mail.gmail.com>
>>>>> "Joseph" == Joseph Garvin <firstname.lastname@example.org> writes:
Joseph> Is there anyway to get at the filename for the source file associated
Joseph> with the currently selected frame from python?
Yes, it is just a bit obscure:
(top-gdb) python f = gdb.selected_frame()
(top-gdb) python print f.find_sal().symtab.filename
Joseph> It'd assist with pretty printing boost backtraces a lot.
I am curious to know more about what you are trying to do.
On the archer branch we still have a reimplementation of "backtrace"
that lets 3rd parties plug in filters. This is not fully baked yet (we
know of some design flaws pointed out by users), so we haven't tried
upstreaming it yet. Still, it is useful and I'm interested in
collecting requirements for when we get back to polishing it.