python: get filename for selected frame?

Tom Tromey
Wed Jul 7 22:44:00 GMT 2010

>>>>> "Joseph" == Joseph Garvin <> 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.


More information about the Gdb mailing list