From: Jim Wilson <wilson@codesourcery.com>
To: sumanth <sumanth.gundapneni@redpinesignals.com>
Cc: gcc@gcc.gnu.org
Subject: Re: extern variable
Date: Mon, 03 Aug 2009 20:10:00 -0000 [thread overview]
Message-ID: <1249330097.2561.4.camel@localhost> (raw)
In-Reply-To: <4A772E41.6090302@redpinesignals.com>
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
next prev parent reply other threads:[~2009-08-03 20:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-30 14:53 sumanth
2009-08-02 2:22 ` Michael Eager
2009-08-02 19:34 ` Jim Wilson
2009-08-03 4:32 ` sumanth
2009-08-03 16:02 ` Jim Wilson
2009-08-03 18:54 ` sumanth
2009-08-03 20:10 ` Jim Wilson [this message]
2009-08-04 15:35 ` sumanth
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=1249330097.2561.4.camel@localhost \
--to=wilson@codesourcery.com \
--cc=gcc@gcc.gnu.org \
--cc=sumanth.gundapneni@redpinesignals.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).