Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Differentiating symbols in multiple copies of shared libraries
@ 2010-12-09 15:50 Avi Gozlan
  2010-12-09 21:53 ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Avi Gozlan @ 2010-12-09 15:50 UTC (permalink / raw)
  To: 'gdb@sourceware.org'; +Cc: Avi Gozlan

Hello,

In an implementation of a multi-threaded program we need to have multiple instances of the same text residing in different virtual addresses. For this purpose different copies of the object file are loaded using dlopen().

We did not find a way for GDB to refer to a symbol in a specific copy of the object file (other then referring to the specific address). I know that DBX supports this by qualifying `<shared object name>`<function name>. Is there similar feature in GDB?

Quoting Daniel J. from a message posted in May 2007 it seemed that this issue was already known:

"> My questions are:
> 1. How do I inspect all the symbols of the same name in the process
> space?  ( I tried loading the symbol from each library
> load-symbol-file.  It didn't help either. In case of ambiguity, dbx used
> to show all symbols qualified with the library name and let us choose
> the right one)
> 2. How do I qualify a symbol with the library name where it belongs to?
> ( for eg.  `libfoo.so`foo_bar )

Basically, you can't.  Yet.  We know we need to fix this."

Is this fixed?

Please note that we need to differentiate between symbols not only for defining breakpoints but for other needs such as disassembly, backtrace as well.

Your input regarding this issue will be appreciated.

Avi


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Differentiating symbols in multiple copies of shared libraries
  2010-12-09 15:50 Differentiating symbols in multiple copies of shared libraries Avi Gozlan
@ 2010-12-09 21:53 ` Tom Tromey
  2011-01-23 12:07   ` Avi Gozlan
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2010-12-09 21:53 UTC (permalink / raw)
  To: Avi Gozlan; +Cc: 'gdb@sourceware.org'

>>>>> "Avi" == Avi Gozlan <avi@checkpoint.com> writes:

Avi> We did not find a way for GDB to refer to a symbol in a specific
Avi> copy of the object file (other then referring to the specific
Avi> address).

There is currently no way to do this.

Avi> Please note that we need to differentiate between symbols not only
Avi> for defining breakpoints but for other needs such as disassembly,
Avi> backtrace as well.

Avi> Your input regarding this issue will be appreciated.

I think it would be a welcome addition to gdb.

The dbx syntax doesn't seem particular gdb-ish to me, but it would do.
HPD-like syntax along the lines of "#libfoo.so#function" has also been
suggested.

If you implement this in linespecs, which is the natural approach, then
it will automatically work for disassembly.

For "backtrace", I guess you mean that at least ambiguous symbols should
be printed in this syntax in a backtrace.  I'm sure that is doable as
well.

I am not sure whether anybody is working on this.  At the very least,
please file a bug.

Tom


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Differentiating symbols in multiple copies of shared libraries
  2010-12-09 21:53 ` Tom Tromey
@ 2011-01-23 12:07   ` Avi Gozlan
  2011-01-27 20:52     ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Avi Gozlan @ 2011-01-23 12:07 UTC (permalink / raw)
  To: 'Tom Tromey'
  Cc: 'gdb@sourceware.org', Avi Gozlan, Matan Ben Gur

A developer in our organization added some code to allow differentiation between symbols with the same name in different object files. This feature is enabled once a GDB variable called symlib is set.

Presumably this addition is not written according to GNU policy or GDB conventions, yet this feature is important as discussed below.

Could you recommend on a procedure for promoting this required feature (or anyway merge the source code to GDB)? Is there any contact for working with for forwarding the implementation (currently diff in 4 files: minsym.c, stack.c, symtab.h, symtab.c)?

BR,

Avi

-----Original Message-----
From: Tom Tromey [mailto:tromey@redhat.com] 
Sent: Thursday, December 09, 2010 11:53 PM
To: Avi Gozlan
Cc: 'gdb@sourceware.org'
Subject: Re: Differentiating symbols in multiple copies of shared libraries

>>>>> "Avi" == Avi Gozlan <avi@checkpoint.com> writes:

Avi> We did not find a way for GDB to refer to a symbol in a specific
Avi> copy of the object file (other then referring to the specific
Avi> address).

There is currently no way to do this.

Avi> Please note that we need to differentiate between symbols not only
Avi> for defining breakpoints but for other needs such as disassembly,
Avi> backtrace as well.

Avi> Your input regarding this issue will be appreciated.

I think it would be a welcome addition to gdb.

The dbx syntax doesn't seem particular gdb-ish to me, but it would do.
HPD-like syntax along the lines of "#libfoo.so#function" has also been
suggested.

If you implement this in linespecs, which is the natural approach, then
it will automatically work for disassembly.

For "backtrace", I guess you mean that at least ambiguous symbols should
be printed in this syntax in a backtrace.  I'm sure that is doable as
well.

I am not sure whether anybody is working on this.  At the very least,
please file a bug.

Tom


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Differentiating symbols in multiple copies of shared libraries
  2011-01-23 12:07   ` Avi Gozlan
@ 2011-01-27 20:52     ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2011-01-27 20:52 UTC (permalink / raw)
  To: Avi Gozlan; +Cc: 'gdb@sourceware.org', Matan Ben Gur

>>>>> "Avi" == Avi Gozlan <avi@checkpoint.com> writes:

Avi> A developer in our organization added some code to allow
Avi> differentiation between symbols with the same name in different
Avi> object files. This feature is enabled once a GDB variable called
Avi> symlib is set.

Avi> Presumably this addition is not written according to GNU policy or
Avi> GDB conventions, yet this feature is important as discussed below.

Avi> Could you recommend on a procedure for promoting this required
Avi> feature (or anyway merge the source code to GDB)? Is there any
Avi> contact for working with for forwarding the implementation
Avi> (currently diff in 4 files: minsym.c, stack.c, symtab.h, symtab.c)?

I think the best thing to do is to follow the usual patch submission
rules: do your best to make it conform to GNU style guidelines, write a
ChangeLog entry, etc, then send it to the gdb-patches list.

Since it sounds like a big(-ish) patch, I will get you started on the
copyright assignment paperwork.  I'll send a note off-list about this.


I would warn you to expect some push-back on the details of your
approach.  If you want to work out the user interface details before
submitting, that would be fine too -- just post your plan to this list.

Tom


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-27 20:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-09 15:50 Differentiating symbols in multiple copies of shared libraries Avi Gozlan
2010-12-09 21:53 ` Tom Tromey
2011-01-23 12:07   ` Avi Gozlan
2011-01-27 20:52     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox