public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* [RFC] make gdb handle weak function better
@ 2010-08-05  9:04 Hui Zhu
  2010-08-11  3:21 ` Hui Zhu
  0 siblings, 1 reply; 7+ messages in thread
From: Hui Zhu @ 2010-08-05  9:04 UTC (permalink / raw)
  To: gdb

Hi,

I meet following trouble:
cat 1.c
int
main ()
{
	calloc (3, 1);
}
gcc -g 1.c
gdb ./a.out
(gdb) start
Temporary breakpoint 1 at 0x8048385: file 1.c, line 4.
Starting program: /home/teawater/gdb/bgdbno/gdb/a.out

Temporary breakpoint 1, main () at 1.c:4
4		calloc (3, 1);
(gdb) b calloc
During symbol reading, incomplete CFI data; unspecified registers
(e.g., eax) at 0x8048382.
Breakpoint 2 at 0xb7ff82a6
(gdb) info sharedlibrary
From        To          Syms Read   Shared Object Library
0xb7fe47f0  0xb7ff97df  Yes (*)     /lib/ld-linux.so.2
0xb7e80230  0xb7f80ea4  Yes (*)     /lib/tls/i686/cmov/libc.so.6
(*): Shared library is missing debugging information.
(gdb) c
Continuing.

Program exited with code 010.

The inferior is not break because gdb set breakpoint in the weak
function calloc in lib/ld-linux.so.2.
But the inferior call the calloc in /lib/tls/i686/cmov/libc.so.6.

And I check the lookup_symbol and lookup_minimal_symbol, both of them
are return the first symbol that they found.
What about do some work on it?

What I think is:
In lookup_symbol and lookup_minimal_symbol, when it get a weak symbol,
just record it but keep search.  When the search complete, if GDB get
a simple symbol then return it.  If GDB doesn't get a simple symbol.
Then return the weak symbol.

BTW, looks minimal_symbol and symbol don't have interface access to
asymbol.  So I suggest we can extend "struct general_symbol_info" and
elf_symtab_read to make minimal_symbol and symbol have the weak
message.

Thanks,
Hui

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

end of thread, other threads:[~2011-08-09  9:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05  9:04 [RFC] make gdb handle weak function better Hui Zhu
2010-08-11  3:21 ` Hui Zhu
2010-08-11  8:05   ` Chris January
2010-08-11 20:31     ` Daniel Jacobowitz
2010-08-12  3:17       ` Hui Zhu
2010-08-18  8:17       ` Chris January
2011-08-09  9:11         ` Hui Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).