GNU Debugger
1. Links
Über Debugger auf den Seiten der Universität Bayreuth (gdb, GVD, DDD, Watcom)
http://herbert.the-little-red-haired-girl.org/c-tips/gcc/index.html#gdb
http://galileocomputing.de/openbook/linux/linux_kap21_003.htm#mj2c3920392b80b1b880c509056e00f1b0
2. Verwendung
3. Kommandos
Kommandos für den gdb
run
backtrace
list
print <value>
quit
4. Installation von gdb-multiarch
Install GnuDebugger for other archtectures if not at ARM anyway e.g. Raspberry Pi
sudo apt install gdb-multiarch
Execute with example from STM32L412
gdb-multiarch asm.o
Type "apropos word" to search for commands related to "word"... Reading symbols from asm.o... (gdb) disassemble led_setup Dump of assembler code for function led_setup: 0x0000007e <+0>: push {r0, r1, lr} 0x00000080 <+2>: ldr.w r1, [pc, #-4] ; 0x80 <led_setup+2> 0x00000084 <+6>: ldr r0, [r1, #0] 0x00000086 <+8>: orr.w r0, r0, #2 0x0000008a <+12>: str r0, [r1, #0] 0x0000008c <+14>: ldr.w r1, [pc, #-4] ; 0x8c <led_setup+14> 0x00000090 <+18>: ldr.w r0, [pc, #-4] ; 0x90 <led_setup+18> 0x00000094 <+22>: str r0, [r1, #0] 0x00000096 <+24>: bl 0x9c <led_on> 0x0000009a <+28>: pop {r0, r1, pc}
Disassemble and show binary code
(gdb) disassemble /r led_setup
(gdb) disassemble /r main Dump of assembler code for function main: 0x00000000 <+0>: 00 f0 30 f8 bl 0x64 <systick_setup> 0x00000004 <+4>: 00 f0 3b f8 bl 0x7e <led_setup> 0x00000008 <+8>: 4f f0 00 00 mov.w r0, #0 0x0000000c <+12>: 4f f0 05 01 mov.w r1, #5 0x00000010 <+16>: 4f f0 01 02 mov.w r2, #1 0x00000014 <+20>: 4f f0 00 03 mov.w r3, #0 0x00000018 <+24>: af f2 04 04 subw r4, pc, #4 0x0000001c <+28>: 25 68 ldr r5, [r4, #0] 0x0000001e <+30>: 5f f8 04 60 ldr.w r6, [pc, #-4] ; 0x1c <main+28> 0x00000022 <+34>: 5f f8 04 70 ldr.w r7, [pc, #-4] ; 0x20 <main+32> 0x00000026 <+38>: 5f f8 04 a0 ldr.w r10, [pc, #-4] ; 0x24 <main+36>
(gdb) dump binary memory asm_memory.bin 0x0 0xbc
Siehe auch • • • •