From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: Mathieu Lacage <mathieu.lacage@gmail.com>, gdb@sourceware.org
Subject: Re: baffling assembly-level weirdness
Date: Mon, 26 Jan 2009 16:51:00 -0000 [thread overview]
Message-ID: <8ac60eac0901260851o2a93a13di8a6b8c9cd4f8c15f@mail.gmail.com> (raw)
In-Reply-To: <20090126154138.GA14406@caradoc.them.org>
On Mon, Jan 26, 2009 at 7:41 AM, Daniel Jacobowitz <drow@false.org> wrote:
> On Mon, Jan 26, 2009 at 04:24:40PM +0100, Mathieu Lacage wrote:
>> hi,
>>
>> The following gdb session baffles me completely: %edx is reset to zero
>> by the mov at address 0x0804ad62 instead of being set to the constant
>> 0x804ad62. Of course, this code segfaults at $pc = 0x804ad68 when zero
>> is dereferenced...
>>
>> Version: GNU gdb 6.8
>>
>> (gdb) disas $pc $pc+10
>> Dump of assembler code from 0x804ad62 to 0x804ad6c:
>> 0x0804ad62 <indent+50>: mov 0x805e3c0,%edx
>
> This is a load from memory at address 0x805e3c0, in x86 syntax.
Additional clues:
(gdb) p/a 0x805e3c0
will likely print "stdout". If you break in main, and do
(gbd) x/a 0x805e3c0
it will likely print something like:
0x8053ac0 <stdout>: 0x4dcdb5e0 <_IO_2_1_stdout_>
It sounds like your program is corrupting stdout somewhere.
The fastest way to find out where that happens:
(gdb) watch *(int **)0x8053ac0
Cheers,
--
Paul Pluzhnikov
next prev parent reply other threads:[~2009-01-26 16:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-26 15:24 Mathieu Lacage
2009-01-26 15:38 ` Pierre Muller
2009-01-26 17:35 ` Mathieu Lacage
2009-01-26 15:41 ` Daniel Jacobowitz
2009-01-26 16:51 ` Paul Pluzhnikov [this message]
2009-01-27 13:09 ` Mathieu Lacage
2009-01-27 17:53 ` Paul Pluzhnikov
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=8ac60eac0901260851o2a93a13di8a6b8c9cd4f8c15f@mail.gmail.com \
--to=ppluzhnikov@google.com \
--cc=gdb@sourceware.org \
--cc=mathieu.lacage@gmail.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