From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: "'Mathieu Lacage'" <mathieu.lacage@gmail.com>, <gdb@sourceware.org>
Subject: RE: baffling assembly-level weirdness
Date: Mon, 26 Jan 2009 15:38:00 -0000 [thread overview]
Message-ID: <005d01c97fcc$2353f310$69fbd930$@u-strasbg.fr> (raw)
In-Reply-To: <74fef6df0901260724p188c5507x2cfa3a4283f6fd41@mail.gmail.com>
Hi,
maybe you are more used to intel disassembler
this is att disassembler
mov 0x805e3c0,%edx
means put the content of address 0x805e3c0 into register edx
putting the constant 0x805e3c0 into edx
would be written as
mov $0x805e3c0,%edx
if I am not mistaken.
If you are more used to intel assembly
you can use
'set disassembly-flavor intel'
In your case, this means that the generated code is faulty...
Pierre Muller
Pascal language support maintainer for GDB
> -----Message d'origine-----
> De : gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org] De la
> part de Mathieu Lacage
> Envoyé : Monday, January 26, 2009 4:25 PM
> À : gdb@sourceware.org
> Objet : baffling assembly-level weirdness
>
> 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
> 0x0804ad68 <indent+56>: mov 0x14(%edx),%eax
> 0x0804ad6b <indent+59>: cmp 0x18(%edx),%eax
> End of assembler dump.
> (gdb) p $pc
> $3 = (void (*)()) 0x804ad62 <indent+50>
> (gdb) p $edx
> $4 = 1
> (gdb) ni
> 0x0804ad68 108 return _IO_putc_unlocked (__c, stdout);
> (gdb) p $edx
> $5 = 0
> (gdb) disas $pc $pc+10
> Dump of assembler code from 0x804ad68 to 0x804ad72:
> 0x0804ad68 <indent+56>: mov 0x14(%edx),%eax
> 0x0804ad6b <indent+59>: cmp 0x18(%edx),%eax
> 0x0804ad6e <indent+62>: jae 0x804adbe <indent+142>
> 0x0804ad70 <indent+64>: movb $0x20,(%eax)
> End of assembler dump.
> (gdb) x/20bx 0x0804ad62
> 0x804ad62 <indent+50>: 0x8b 0x15 0xc0 0xe3 0x05 0x08 0x8b 0x42
> 0x804ad6a <indent+58>: 0x14 0x3b 0x42 0x18 0x73 0x4e 0xc6 0x00
> 0x804ad72 <indent+66>: 0x20 0x83 0xc0 0x01
>
> Anyone would have even a remote idea of what could have gone wrong here
> ?
>
> Mathieu
> --
> Mathieu Lacage <mathieu.lacage@gmail.com>
next prev parent reply other threads:[~2009-01-26 15:38 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 [this message]
2009-01-26 17:35 ` Mathieu Lacage
2009-01-26 15:41 ` Daniel Jacobowitz
2009-01-26 16:51 ` Paul Pluzhnikov
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='005d01c97fcc$2353f310$69fbd930$@u-strasbg.fr' \
--to=muller@ics.u-strasbg.fr \
--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