This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

using GDB with openOCD - make gdb "forget"

I set up a combination of gdb and openOCD under macOS (Catalina).

I'm starting openOCD in one Terminal window and gdb in another one, connecting to a STM32F407G-DISC1 board (Discovery) with the following in ~/.gdbinit:

file firmware.elf
target remote localhost:4242
load firmware.elf

I have two questions about gdb:

1. Does gdb stop at the beginning after loading the binary (firmware.elf) or does it start through?
    Looks to me that it stops.

2. When I start gdb (continue)  for the first time, I get this picture:

GNU gdb (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.50.20181213-git
Copyright (C) 2018 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-apple-darwin10 --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".
0x00000000 in ?? ()
Loading section .text, size 0x3bc8 lma 0x0
Start address 0x0, load size 15304
Transfer rate: 122432 bits in <1 sec, 15304 bytes/write.
(gdb) 

GNU gdb (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.50.20181213-git
Copyright (C) 2018 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-apple-darwin10 --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".
0x00000000 in ?? ()
Loading section .text, size 0x3bc8 lma 0x0
Start address 0x0, load size 15304
Transfer rate: 122432 bits in <1 sec, 15304 bytes/write.
(gdb) 

GNU gdb (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.50.20181213-git
Copyright (C) 2018 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-apple-darwin10 --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".
0x00000000 in ?? ()
Loading section .text, size 0x3bc8 lma 0x0
Start address 0x0, load size 15304
Transfer rate: 122432 bits in <1 sec, 15304 bytes/write.
(gdb) c
Continuing.

When I then type ^C, the program is interrupted and gdb prompts:

Next I type "c"

Program runs. I Press the Reset button. Nothing happens (should gdb react somehow?)

I then hit ^C again. Now gdb prompts in another area of the code space.

I type "quit". gdb quits.

I start gdb again. Now it says:

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".
0x00001592 in serial_qemit ()
Loading section .text, size 0x3bc8 lma 0x0
Start address 0x0, load size 15304
Transfer rate: 122432 bits in <1 sec, 15304 bytes/write.

What does the line 0x00001592 in serial_qemit() mean? That was the last interruption. When I now type

continue, where does gdb commence? I type again ^C. Now it stops near 0x00001592, namely in 0x00001590

The program seem to loop there.

gdb doesn't seem to "forget" where it last was interrupted and starts again there. How can I make gdb "forget"?