Re: extern variable

2009-08-04 Thread sumanth
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

Re: extern variable

2009-08-03 Thread Jim Wilson
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 so

Re: extern variable

2009-08-03 Thread sumanth
Hi Jim, that seems to be a promising solution. If I keep the prefix "_" for a global variable , there is a problem in accessing it in gdb...let me explain you with an example Eg: file1.c int a = 10; int main() { int b =10; int c; c = add( a , b); return 0; } file2.c int add( int x, int y) { r

Re: extern variable

2009-08-03 Thread Jim Wilson
On Mon, 2009-08-03 at 09:44 +0530, sumanth wrote: >How can i make sure my tool chain knows the difference between > global variable r0 and register r0. The simple solution is to either add a prefix to variable names, or to add a prefix to register names. In ELF, the convention is to not

Re: extern variable

2009-08-02 Thread sumanth
Jim, If I define USER_LABEL_PREFIX "" and declare a global variable using names r0/r1...r15 ( my register names ) , my assembler is generating an error message saying " r0 is already defined , cannot use register in expression " How can i make sure my tool chain knows the

Re: extern variable

2009-08-02 Thread Jim Wilson
On 07/30/2009 07:38 AM, sumanth wrote: How can I make sure the debugging information printed by my compiler for extern variables is correct. I am able to print them in gdb in with an _ (underscore). I am using Gcc-4.3.4 and gdb 5.3 ELF targets usually don't prepend an underscore to symbol names

Re: extern variable

2009-08-01 Thread Michael Eager
sumanth wrote: Hi, How can I make sure the debugging information printed by my compiler for extern variables is correct. Make sure you compile with -g. If you don't generate debug info for the variable, gdb will default to printing it as an unknown symbol. -- Michael Eagerea...@eage