bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

no address info for some global symbols available ?


From: mibcat
Subject: no address info for some global symbols available ?
Date: Thu, 7 Jun 2012 12:36:45 -0700 (PDT)

Hi all!

I'm working for a tool which has to extract some information (for example
the address) of variables from a PIC32 elf file. For this I use gdb to read
in the elf file and get the address information with the "print & varname"
command.

This works for almost all symbols but not for all. And I don't know why. 
I've done many tests to bring the focus on the error but currently I'm going
mad !!%-|

I could figured out the following strange behavior:

The variables of interest are defined in the same module at the same
location as global.
One set is defined as const in the rom area (RP) the other two sets in the
ram area (WP and MT)

...
#define SIGBEGRP  0xC3C3C3C3
#define SIGENDRP  0x3C3C3C3C
const uint32 sigBegRP __attribute__((section(".MKMESSRPBEG"), space(prog)))
= SIGBEGRP;
const uint32 sigEndRP __attribute__((section(".MKMESSRPEND"), space(prog)))
= SIGENDRP;

#define SIGBEGWP  0xA5A5A5A5
#define SIGENDWP  0x5A5A5A5A
uint32 sigBegWP __attribute__((section(".MKMESSWPBEG"), space(data))) =
SIGBEGWP;
uint32 sigEndWP __attribute__((section(".MKMESSWPEND"), space(data))) =
SIGBEGWP;

#define SIGBEGMT  0xF7F7F7F7
#define SIGENDMT  0x7F7F7F7F
uint32 sigBegMT __attribute__((section(".MKMESSMTBEG"), space(data))) =
SIGBEGMT;
uint32 sigEndMT __attribute__((section(".MKMESSMTEND"), space(data))) =
SIGBEGMT;
...

gdb gives me a list of the available variables:

(gdb) info variables sig:
uint32 sigBegMT;
const uint32 sigBegRP;
uint32 sigBegWP;
uint32 sigEndMT;
const uint32 sigEndRP;
uint32 sigEndWP;

If i try to get the address of each variable only sigBegRP works:
(gdb) p &sigBegRP
$2 = (const uint32 *) 0x9d078000
(gdb) p &sigBegWP
No global symbol "sigBegWP"
(gdb) p &sigBegMT
No global symbol "sigBegWP"


During my tests I've deleted any access to the symbol sigBegMT (and
sigEndMT). 
In this case gdb gives me the address:

(gdb) p &sigBegRP
$2 = (const uint32 *) 0x9d078000
(gdb) p &sigBegWP
No global symbol "sigBegWP"
(gdb) p &sigBegMT
$3 = (uint32 *) 0xa001003c

Can anybody explain this behaviour ? It seems that the symbols are not
always treated as global.
Maybe the root cause could also be found in the generated elf file
(Microchip toolchain MPLABX). So I don't know if this topic is really
related to gdb ... :confused:

Any help is appreciated. 
Thanks in advance, Michael.
-- 
View this message in context: 
http://old.nabble.com/no-address-info-for-some-global-symbols-available---tp33977784p33977784.html
Sent from the Gnu - gdb - Bugs mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]