This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

tui/1507: incorrect output for disassemble command using disassembly-flavour intel


>Number:         1507
>Category:       tui
>Synopsis:       incorrect output for disassemble command using disassembly-flavour intel
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          mistaken
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 13 04:58:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     sick_soul@users.sourceforge.net
>Release:        gdb 5.3
>Organization:
>Environment:
GNU/Linux 2.4 i386
gdb 5.3 configured as i386-slackware-linux
gcc 3.3.2
>Description:
disassemble command shows wrong output with some instructions when setting disassembly flavour intel.

example: the correct disassembly of machine instruction
         8b 1c 8b

should be
mov ebx, DWORD PTR [ebx + ecx * 4]

while gdb gets it wrong:
mov ebx, DWORD PTR [ebx + ecx]

gdb output follows:

GNU gdb 5.3
This GDB was configured as "i386-slackware-linux"...
(gdb) disassemble _start
Dump of assembler code for function _start:
0x8048080 <_start>:     mov    (%ebx,%ecx,4),%ebx
End of assembler dump.
(gdb) set disassembly-flavor intel
(gdb) disassemble _start
Dump of assembler code for function _start:
0x8048080 <_start>:     mov    ebx,DWORD PTR [ebx+ecx]
End of assembler dump.

All instructions in the form
mov register, [register + register * 4]
seem to show this same problem.

Claudio
>How-To-Repeat:
create an assembly source 
containing such an instruction and assemble/link to make an executable, or alternatively use the attached elf executable created with nasm 0.98 which contains symbol _start to disassemble.
Run gdb on the executable.

Disassemble the instruction using AT&T syntax first, then
use Intel syntax to see the problem:
$ gdb ./a.out
(gdb) set disassembly-flavor att
(gdb) disassemble _start
Dump of assembler code for function _start:
0x8048080 <_start>:     mov    (%ebx,%ecx,4),%ebx
End of assembler dump.
(gdb) set disassembly-flavor intel
(gdb) disassemble _start
Dump of assembler code for function _start:
0x8048080 <_start>:     mov    ebx,DWORD PTR [ebx+ecx]
End of assembler dump.
>Fix:
add a "*4" string for the disassemble output like this:

mov    ebx,DWORD PTR [ebx+ecx*4]
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="a.out"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="a.out"

f0VMRgEBAQAAAAAAAAAAAAIAAwABAAAAgIAECDQAAADUAAAAAAAAADQAIAABACgABwAEAAEAAAAA
AAAAAIAECACABAiDAAAAgwAAAAUAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACLHIsAVGhlIE5ldHdpZGUgQXNzZW1ibGVyIDAuOTguMzgAAC5zeW10YWIA
LnN0cnRhYgAuc2hzdHJ0YWIALnRleHQALmJzcwAuY29tbWVudAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGwAAAAEAAAAGAAAAgIAECIAAAAADAAAAAAAAAAAAAAAQ
AAAAAAAAACEAAAABAAAAAQAAAISQBAiDAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAmAAAAAQAAAAAA
AAAAAAAAgwAAAB8AAAAAAAAAAAAAAAEAAAAAAAAAEQAAAAMAAAAAAAAAAAAAAKIAAAAvAAAAAAAA
AAAAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAADsAQAA0AAAAAYAAAAJAAAABAAAABAAAAAJAAAA
AwAAAAAAAAAAAAAAvAIAADMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACA
gAQIAAAAAAMAAQAAAAAAhJAECAAAAAADAAIAAAAAAAAAAAAAAAAAAwADAAAAAAAAAAAAAAAAAAMA
BAAAAAAAAAAAAAAAAAADAAUAAAAAAAAAAAAAAAAAAwAGAAEAAAAAAAAAAAAAAAQA8f8LAAAAAwAA
AAAAAAAAAPH/FAAAAICABAgAAAAAEAABABsAAACEkAQIAAAAABAA8f8nAAAAhJAECAAAAAAQAPH/
LgAAAISQBAgAAAAAEADx/wBwcm92YS5hc20AZmlsZXNpemUAX3N0YXJ0AF9fYnNzX3N0YXJ0AF9l
ZGF0YQBfZW5kAA==


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]