(solved) trying to debug, getting error

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

(solved) trying to debug, getting error

Postby mzimmers » Thu Dec 30, 2021 8:53 pm

"No connection could be made because the target machine actively refused it."

I'm trying to to get the command line debugger working (since I still can't get the VS Code version to work). I thought I followed the instructions; here's the complete output:

Code: Select all

C:\Users\mzimmers\esp_projects\blink>xtensa-esp32-elf-gdb -x gdbinit build/blink.elf
GNU gdb (crosstool-NG esp-2021r1) 8.1.0.20180627-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-host_w64-mingw32 --target=xtensa-esp32-elf".
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 build/blink.elf...done.
gdbinit:1: Error in sourced command file:
:3333: No connection could be made because the target machine actively refused it.
(gdb)
So I must have missed a step. Do I need to build my binary in a particular way for this to work?

Thanks...
Last edited by mzimmers on Mon Jan 03, 2022 9:48 pm, edited 1 time in total.

ESP_Sprite
Posts: 9052
Joined: Thu Nov 26, 2015 4:08 am

Re: trying to debug, getting error

Postby ESP_Sprite » Sun Jan 02, 2022 11:57 am

Do you have OpenOCD running while doing this?

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: trying to debug, getting error

Postby mzimmers » Sun Jan 02, 2022 11:22 pm

Hi Sprite -

Yeah, that was the problem, I think. I get this now:

Code: Select all

C:\Users\mzimmers\esp_projects\blink>xtensa-esp32-elf-gdb -x gdbinit build/blink.elf
GNU gdb (crosstool-NG esp-2021r1) 8.1.0.20180627-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-host_w64-mingw32 --target=xtensa-esp32-elf".
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 build/blink.elf...done.
0x400e804a in ?? ()
JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
esp32.cpu0: Core was reset.
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Debug controller was reset.
esp32.cpu1: Core was reset.
esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Hardware assisted breakpoint 1 at 0x400d5263: file ../main/blink.c, line 51.
esp32.cpu0: Target halted, PC=0x400D5263, debug_reason=00000001
Set GDB target to 'esp32.cpu0'
esp32.cpu1: Target halted, PC=0x400E804A, debug_reason=00000000

Temporary breakpoint 1, app_main () at ../main/blink.c:51
51          gpio_reset_pin(BLINK_GPIO);
(gdb)
Looks right, doesn't it? I'm curious, though -- how did the debugger decide to put a breakpoint on line 51?

Thanks...

ESP_Sprite
Posts: 9052
Joined: Thu Nov 26, 2015 4:08 am

Re: trying to debug, getting error

Postby ESP_Sprite » Sun Jan 02, 2022 11:50 pm

Probably because the gdb init script sets a breakpoint at app_main and then resets the ESP32, so when you get your prompt your app is ready to go.

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: (solved) trying to debug, getting error

Postby mzimmers » Mon Jan 03, 2022 9:48 pm

I see. Thanks again, Sprite.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 222 guests