From: Hui Zhu <teawater@gmail.com>
To: gdb@sourceware.org
Subject: [RFC] make gdb handle weak function better
Date: Thu, 05 Aug 2010 09:04:00 -0000 [thread overview]
Message-ID: <AANLkTikvyKzEvq1TAHn1LGb4ko2DJ33_9EMicfgKe2Ua@mail.gmail.com> (raw)
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
next reply other threads:[~2010-08-05 9:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 9:04 Hui Zhu [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTikvyKzEvq1TAHn1LGb4ko2DJ33_9EMicfgKe2Ua@mail.gmail.com \
--to=teawater@gmail.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox