This is the mail archive of the gdb@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]

Regression handling linkage vs source name


There were changes to dwarf2_physname() around July 1, 2011, which
cause it to return a different value.  Arguably, the changes make
the function work better, returning the linkage name for a symbol where
it previously returned the source name.  But since the source name
is overwritten by the linkage name in the symbol entry, gdb's
behavior is different, and, IMO, incorrect.

Here is the test case:

$ cat t.c
extern int foo(void) asm ("xfoo");

int foo(void) {}

int main (void)
{
  foo ();
}

$ gdb-before a.out
...
(gdb) b foo
Breakpoint 1 at ...

$ gdb-after a.out
...
(gdb) b foo
Make breakpoint pending on future shared library load? (y or [n])? n
(gdb) b xfoo
Breakpoint 1 at ...


The symbol "foo" is no longer present in gdb symbol table so trying to use the name specified in the source fails. Before the change, breakpoint, backtrace, and other commands display the symbol name as in the source (and in the DWARF DIE). After the change, the linkage name is displayed instead of the source name.

Before the change, dwarf2_physname() calls dwarf2_compute_name()
which returns the symbol name if the language is not C++, Java,
or Fortran, even if the DIE has a DW_AT_linkage_name attribute.
After the change, dwarf2_physname() returns the DW_AT_linkage_name.

Since gdb doesn't keep both the source name and the linkage
name in the symbol table (a design flaw, IMO) what is the
right way to get the previous behavior, where gdb recognizes
the symbol names from the source file?

--
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


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