This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: fix PR python/13599


On 01/31/2012 11:22 PM, Doug Evans wrote:
On Tue, Jan 31, 2012 at 2:01 PM, Tom Tromey<tromey@redhat.com> wrote:
This fixes PR python/13599.

The bug is that there is no way to get the line number in the source at
which a symbol was defined, even though gdb tracks this information.

This patch changes gdb.Symbol to add a new 'line' attribute.

This requires a doc review.

Built and regtested on x86-64 Fedora 15.

Tom

2012-01-31 Tom Tromey<tromey@redhat.com>

        PR python/13599:
        * python/py-symbol.c (sympy_line): New function.
        (symbol_object_getset): Add "line".
'tis ok with me.

One comment though.
The first thing that come to mind, as a user, is "Well, if I can get
the line number from the symbol, why do I have to look elsewhere to
get the file name?"
The reason is an internal gdb implementation detail that we expose in
python. IWBN if symbol tables were more nebulous entities - we might
want the freedom to change them a bit.  [Not that we necessarily can
change things now, but I think it's something we should keep in mind.]

There is no reason why we cannot export the filename as an API in the py-symbol. The 1:1 mapping of API to GDB modulefunctionality is not even a weak rule imo. If it makes sense from an API point of view, no reason why we should not export it in py-symbol regardless of where the information comes from in GDB.


Cheers,

Phil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]