record mode confuses disassembler
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro GDB |
Fix Released
|
Undecided
|
Muhammad Omair Javaid | ||
gdb |
New
|
Undecided
|
Muhammad Omair Javaid |
Bug Description
As of current GDB trunk (2013-03-18), using record mode can confuse the disassembler.
I attach test1.c and test1.thumb (compiled in the default thumb mode with gcc -g -o test1.thumb test1.c).
$ gdb test1.thumb
GNU gdb (GDB) 7.6.50.20130317-cvs
[...]
(gdb) b main
Breakpoint 1 at 0x8396: file test1.c, line 5.
(gdb) b test1.c:8
Breakpoint 2 at 0x83b0: file test1.c, line 8.
(gdb) r
Starting program: /home/lyon/
Breakpoint 1, main () at test1.c:5
5 int i=0;
(gdb) target record-full
(gdb) disassemble main
Dump of assembler code for function main:
0x00008390 <+0>: push {r7, lr}
0x00008392 <+2>: sub sp, #8
0x00008394 <+4>: add r7, sp, #0
=> 0x00008396 <+6>: mov.w r3, #0
0x0000839a <+10>: str r3, [r7, #4]
0x0000839c <+12>: movw r0, #33808 ; 0x8410
0x000083a0 <+16>: movt r0, #0
0x000083a4 <+20>: blx 0x82e4 <puts>
0x000083a8 <+24>: ldr r3, [r7, #4]
0x000083aa <+26>: add.w r3, r3, #1
0x000083ae <+30>: str r3, [r7, #4]
0x000083b0 <+32>: mov r0, r3
0x000083b2 <+34>: add.w r7, r7, #8
0x000083b6 <+38>: mov sp, r7
0x000083b8 <+40>: pop {r7, pc}
End of assembler dump.
(gdb) c
Continuing.
Process record doesnt support thumb32 instruction 0x300f04f at address 0x8396.
main () at test1.c:5
5 int i=0;
Process record: failed to record execution log.
(gdb) disassemble main
Dump of assembler code for function main:
0x00008390 <+0>: push {r7, lr}
0x00008392 <+2>: sub sp, #8
0x00008394 <+4>: add r7, sp, #0
=> 0x00008396 <+6>: mov.w r3, #0
0x0000839a <+10>: ; <UNDEFINED> instruction: 0xde01
0x0000839c <+12>: movw r0, #33808 ; 0x8410
0x000083a0 <+16>: movt r0, #0
0x000083a4 <+20>: blx 0x82e4 <puts>
0x000083a8 <+24>: ldr r3, [r7, #4]
0x000083aa <+26>: add.w r3, r3, #1
0x000083ae <+30>: str r3, [r7, #4]
0x000083b0 <+32>: mov r0, r3
0x000083b2 <+34>: add.w r7, r7, #8
0x000083b6 <+38>: mov sp, r7
0x000083b8 <+40>: pop {r7, pc}
End of assembler dump.
Notice how instruction at 0x8396 became UNDEFINED.
Changed in gdb-linaro: | |
assignee: | nobody → Muhammad Omair Javaid (omair-javaid) |
Changed in gdb: | |
assignee: | nobody → Muhammad Omair Javaid (omair-javaid) |
Changed in gdb-linaro: | |
status: | In Progress → Fix Released |
Christophe,
Target record is not functional for arm at this stage, however I am unable to reproduce this behavior with instructions provided.
I have used gdb 7.6 sources as well as latest gdb cvs repository for testing.
GNU gdb (GDB) 7.6 gnu.org/ licenses/ gpl.html> unknown- linux-gnueabihf ". www.gnu. org/software/ gdb/bugs/>... omair/bug_ triage/ test1.thumb. ..done. omair/bug_ triage/ test1.thumb
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "armv7l-
For bug reporting instructions, please see:
<http://
Reading symbols from /home/linaro/
(gdb) b main
Breakpoint 1 at 0x83c2: file test1.c, line 5.
(gdb) b test1.c:8
Breakpoint 2 at 0x83cc: file test1.c, line 8.
(gdb) r
Starting program: /home/linaro/
Breakpoint 1, main () at test1.c:5
5 int i=0;
(gdb) target record-full
(gdb) disassemble main
Dump of assembler code for function main:
0x000083bc <+0>: push {r7}
0x000083be <+2>: sub sp, #12
0x000083c0 <+4>: add r7, sp, #0
=> 0x000083c2 <+6>: movs r3, #0
0x000083c4 <+8>: str r3, [r7, #4]
0x000083c6 <+10>: ldr r3, [r7, #4]
0x000083c8 <+12>: adds r3, #1
0x000083ca <+14>: str r3, [r7, #4]
0x000083cc <+16>: mov r0, r3
0x000083ce <+18>: add.w r7, r7, #12
0x000083d2 <+22>: mov sp, r7
0x000083d4 <+24>: pop {r7}
0x000083d6 <+26>: bx lr
End of assembler dump.
(gdb) c
Continuing.
Breakpoint 2, main () at test1.c:8
8 }
(gdb) disassemble main
Dump of assembler code for function main:
0x000083bc <+0>: push {r7}
0x000083be <+2>: sub sp, #12
0x000083c0 <+4>: add r7, sp, #0
0x000083c2 <+6>: movs r3, #0
0x000083c4 <+8>: str r3, [r7, #4]
0x000083c6 <+10>: ldr r3, [r7, #4]
0x000083c8 <+12>: adds r3, #1
0x000083ca <+14>: str r3, [r7, #4]
=> 0x000083cc <+16>: mov r0, r3
0x000083ce <+18>: add.w r7, r7, #12
0x000083d2 <+22>: mov sp, r7
0x000083d4 <+24>: pop {r7}
0x000083d6 <+26>: bx lr
End of assembler dump.
(gdb)