This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] choose symbol from given block's objfile first.
- From: Pedro Alves <palves at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 10 May 2012 15:13:24 +0100
- Subject: Re: [RFC] choose symbol from given block's objfile first.
- References: <1336430581-11262-1-git-send-email-brobecker@adacore.com>
On 05/07/2012 11:43 PM, Joel Brobecker wrote:
> Hello,
>
> This patch is a prototype for an issue very briefly discussed on IRC.
> Quick description of the problem:
>
> We have a program which is linked against two shared libraries.
> Both libraries define a global symbol with the same name. In my
> example, I used an int called this_library_version. When trying
> to print the value of this global, GDB just randomly selects
> the first one it finds, and I couldn't find a way (that worked)
> which allowed me to print the value of the other global.
>
> The idea behind this patch is to reduce a little bit the randomness.
> If one is debugging code inside one of the shared libraries, then
> the variable that the user probably wants is the one that is defined
> inside that shared library.
+1.
>
> It's a bit of a poor man's answer to this issue. On the one hand,
> you do not always get the same symbol every single time. But on
> the other hand, the selection process is implicit and not always
> work-able for the user. Eventually, what we thought we needed was
> extend the expression parser to allow the user to qualify his
> variable name with the name of the objfile, such as for instance:
>
> (gdb) print libsomething.so::this_library_version
>
> This is something that can be done in parallel to this effort.
Yeah... It's one of those features that I think if we added together
all the time people have spent saying IWBN to have it, it'd sum up
to enough to implement it. :-)
<pedantic mode>
Still, this wouldn't solve the case of loading the same
library twice... Which symbol would you print?
</pedantic mode>
--
Pedro Alves