Skip to content

Instantly share code, notes, and snippets.

@nickd4
Created July 14, 2017 06:48
Show Gist options
  • Save nickd4/ec8628c2ce90658c3efe44ead3d2116e to your computer and use it in GitHub Desktop.
Save nickd4/ec8628c2ce90658c3efe44ead3d2116e to your computer and use it in GitHub Desktop.
Problem with single stepping / backtrace on Black Magic Probe with an STM32F767ZG and latest official ARM gcc/gdb
GNU gdb (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 7.12.1.20170417-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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 "--host=x86_64-pc-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from Debug/FokliftController.elf...done.
Target voltage: 3.3V
Available Targets:
No. Att Driver
1 STM32F7xx
_Error_Handler (file=0x0, line=0) at ../Src/main.c:534
534 while(1)
7BB37DAD:05:85
(gdb) load
Loading section .isr_vector, size 0x1f8 lma 0x8000000
Loading section .text, size 0xa374 lma 0x8000200
Loading section .rodata, size 0x880 lma 0x800a574
Loading section .ARM, size 0x8 lma 0x800adf4
Loading section .init_array, size 0x4 lma 0x800adfc
Loading section .fini_array, size 0x4 lma 0x800ae00
Loading section .data, size 0x12c lma 0x800ae04
Start address 0x8000620, load size 44840
Transfer rate: 18 KB/sec, 862 bytes/write.
(gdb) break StartDefaultTask
Breakpoint 1 at 0x800220c: file ../Src/main.c, line 492.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/nick/burtek/FokliftController/Debug/FokliftController.elf
Note: automatically using hardware breakpoints for read-only addresses.
Breakpoint 1, StartDefaultTask (argument=0x0) at ../Src/main.c:492
492 InitGraphics(&hltdc);
(gdb) p/x &hltdc
$1 = 0x2002fa04
(gdb) step
InitGraphics (pNewLCD=0x0) at ../Src/Graphics/graphics.c:141
141 pLCD = pNewLCD;
(gdb) p/x pNewLCD
$2 = 0x0
(gdb) p/x &pNewLCD
$3 = 0x2002be84
(gdb) disas
Dump of assembler code for function InitGraphics:
0x08000698 <+0>: push {r7, lr}
0x0800069a <+2>: sub sp, #16
0x0800069c <+4>: add r7, sp, #0
0x0800069e <+6>: str r0, [r7, #4]
=> 0x080006a0 <+8>: ldr r2, [pc, #204] ; (0x8000770 <InitGraphics+216>)
0x080006a2 <+10>: ldr r3, [r7, #4]
0x080006a4 <+12>: str r3, [r2, #0]
0x080006a6 <+14>: movs r2, #0
0x080006a8 <+16>: movs r1, #1
0x080006aa <+18>: ldr r0, [pc, #200] ; (0x8000774 <InitGraphics+220>)
0x080006ac <+20>: bl 0x800648c <HAL_GPIO_WritePin>
0x080006b0 <+24>: movs r0, #1
0x080006b2 <+26>: bl 0x800305c <osDelay>
0x080006b6 <+30>: ldr r3, [pc, #184] ; (0x8000770 <InitGraphics+216>)
0x080006b8 <+32>: ldr r0, [r3, #0]
0x080006ba <+34>: movs r3, #0
0x080006bc <+36>: mov.w r2, #256 ; 0x100
0x080006c0 <+40>: ldr r1, [pc, #180] ; (0x8000778 <InitGraphics+224>)
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) info registers
r0 0x2002fa04 537065988
r1 0x0 0
r2 0x0 0
r3 0x0 0
r4 0x0 0
r5 0x0 0
r6 0x0 0
r7 0x2002be80 537050752
r8 0x0 0
r9 0x0 0
r10 0x0 0
r11 0x0 0
r12 0x0 0
sp 0x2002be80 0x2002be80 <ucHeap+472>
lr 0x8002213 0x8002213 <StartDefaultTask+14>
pc 0x80006a0 0x80006a0 <InitGraphics+8>
xpsr 0x1000000 16777216
fpscr 0x0 0
msp 0x2007ffe0 0x2007ffe0
psp 0x2002be80 0x2002be80 <ucHeap+472>
special 0x2000000 33554432
(gdb) quit
A debugging session is active.
Inferior 1 [Remote target] will be killed.
Quit anyway? (y or n) y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment