From: Jim Blandy <jimb@codesourcery.com>
To: Hadron <rileyrg@googlemail.com>
Cc: Nick Roberts <nickrob@snap.net.nz>,
Hadron <hadronquark@googlemail.com>,
gdb@sourceware.org
Subject: Re: argc - cant access memory
Date: Wed, 11 Jul 2007 17:41:00 -0000 [thread overview]
Message-ID: <m3myy225yn.fsf@codesourcery.com> (raw)
In-Reply-To: <87hcoc5uef.fsf@gmail.com> (Hadron's message of "Tue, 10 Jul 2007 14:13:12 +0200")
Hadron <rileyrg@googlemail.com> writes:
> I get the message after stepping over the first line in main and then
> when I get to line 3 (in main) then I get
>
> #0 main (argc=191860, argv=0xb7f49850) at hello.c:94
>
> (94 is the line "glutInitWindowSize (250, 250);" in main)
>
> If you say this is normal behaviour then fine, but I haven't experienced
> it before. I would be interested to hear if you get the same.
This really looks like what happens when you debug optimized code.
The compiler emits debugging information that doesn't accurately
relate the machine code it generated to the original source. If this
is the case, there isn't much a debugger can do about it. You might
try re-compiling without optimization.
But the make fragment you posted didn't look like it was compiled with
optimization. Without optimization, the compiler is supposed to
generate code which behaves as expected under the debugger; from the
GCC manual:
Without any optimization option, the compiler's goal is to reduce
the cost of compilation and to make debugging produce the expected
results. Statements are independent: if you stop the program with
a breakpoint between statements, you can then assign a new value
to any variable or change the program counter to any other
statement in the function and get exactly the results you would
expect from the source code.
prev parent reply other threads:[~2007-07-11 17:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-09 13:26 Hadron
2007-07-09 21:04 ` Jim Blandy
2007-07-09 22:34 ` Nick Roberts
2007-07-10 12:13 ` Hadron
2007-07-10 19:41 ` Dave Korn
2007-07-10 19:46 ` Daniel Jacobowitz
2007-07-10 19:50 ` Dave Korn
2007-07-11 21:13 ` Jim Blandy
2007-07-11 17:41 ` Jim Blandy [this message]
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=m3myy225yn.fsf@codesourcery.com \
--to=jimb@codesourcery.com \
--cc=gdb@sourceware.org \
--cc=hadronquark@googlemail.com \
--cc=nickrob@snap.net.nz \
--cc=rileyrg@googlemail.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