Hi jim ,
forgot to mention , I am accessing variable a as extern in file2.c
I am going through the solutions pointed by you but not able to
figure out one .
Thanks ,
Sumanth G
Jim Wilson wrote:
On Tue, 2009-08-04 at 00:06 +0530, sumanth wrote:
> mycompiler-gcc -g file1.c file2.c
> mycompiler-gdb a.out
>> when i print "a" in file1.c , i am able to see value 10;
>> when i print "a" int file2.c, it prints , no symbol defined.
Instead I can access it with " print _a"
This sounds odd, as there is no variable a or _a in file2.c, and if you
can see a variable in one file you should be able to see if with the
same name in another file.
Anyways, I think I already answered this with my first message when I
pointed you at ASM_OUTPUT_* and ASM_GENERATE_INTERNAL_LABEL etc. If you
compile with -g -S, and look at the assembly language, you will see that
"_a" is being used in the debug info someplace for the variable name
where "a" should be used instead. "_a" is correct for the variable
address, but not the variable name. So you will have to step through
your gcc port to figure out why the "_a" is incorrectly printed, and
most likely it is a bug in one of the macros I have mentioned. Take a
look at a port that handles this correctly to see what they do
differently to make this work.
Jim