This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Looking for weak symbols with symbol_lookup ()
- To: gdb-patches at sources dot redhat dot com
- Subject: Looking for weak symbols with symbol_lookup ()
- From: Orjan Friberg <orjan dot friberg at axis dot com>
- Date: Wed, 22 Nov 2000 17:58:19 +0100
- Organization: Axis Communications AB
As a way for gdb to find out about our target's current ABI, we are
going to add a magic symbol to files compiled after a certain compiler
version. gdbarch_init, or possibly some other function triggered by a
user-command, will later look for that symbol and from its existence or
non-existence decide on the new or old ABI. (Since we will use a.out
format for both API's as well as elf, we can't solve it with elf flags
like the mips target seems to do.)
When experimenting with this, it seems I cannot find a weak symbol in
the symbol table. I added
__asm__ (".weak .$testsym");
__asm__ (".set .$testsym,42");
to my test file, and then used lookup_symbol to go hunting for it. It
seems I am only able to find symbols which correspond to actual symbols
in the program, i.e. no weak symbols at all. Is this the case, and
should I opt for a magic symbol of another type?
My actual function call for looking for it looks something like
lookup_symbol ("testsym", 0, TYPES_NAMESPACE, 0, 0) (I've tried some
different variations). I used the -readnow argument to the file command
to have the whole symbol table read immediately.
--
Orjan Friberg E-mail: orjan.friberg@axis.com
Axis Communications AB Phone: +46 46 272 17 68