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]

Visibility of ELF symbols not taken into account by certain GDB commands?


Hi,

I have observed that certain commands, ("print" and "info symbol" at
least) pick only one symbol in case of multible definitions (e.g.
malloc is defined in ls.so and libc.so, but only one of them is
picked).

During that selection, visibility is not taken into account (e.g. the
ld.so malloc symbol is used although the globally visible one, from
the dynamic loaders point of view, is the one in libc.so)


Should this be considered a bug?


At the very least, it seems very counterintuitive to me. I would had
expected either using all occurrences of the symbol or picking the
visible one.

This issue is well covered by I question I made in Stackoverflow [1].
Here is an example of what I mean:

(gdb) info symbol malloc
malloc in section .text of /lib64/ld-linux-x86-64.so.2
(gdb) p malloc
$1 = {void *(size_t)} 0x7ffff7df0930 <malloc>
(gdb) info symbol 0x7ffff7df0930
malloc in section .text of /lib64/ld-linux-x86-64.so.2
(gdb) b malloc
Breakpoint 2 at 0x7ffff7df0930: malloc. (2 locations)
(gdb) info breakpoints
Num     Type           Disp Enb Address            What
2       breakpoint     keep y   <MULTIPLE>
2.1                         y     0x00007ffff7df0930 in malloc at
dl-minimal.c:95
2.2                         y     0x00007ffff7a9f9d0 in
__GI___libc_malloc at malloc.c:2910
(gdb)


Thanks,

Alfonso Acosta


PS: I am running  "GNU gdb (Ubuntu/Linaro 7.4-2012.02-0ubuntu2) 7.4-2012.02".

[1] http://stackoverflow.com/questions/14867024/duplicated-memory-management-symbols-in-libc-so-and-ld-linux-so/15008471#15008471


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