调试ESP8266,GDB无法连接,“qSupported”响应中无法识别项目“timeout”

问题描述 投票:0回答:1

我正在尝试使用 GDB 在 ESP8266 上调试我的代码,但无法连接。

ESP8266代码(gdb.ino):

#include <GDBStub.h>

void setup() {
  Serial.begin( 115200 );
  
  gdbstub_init();
  
  pinMode( LED_BUILTIN, OUTPUT );

}

unsigned long m_last;
unsigned long m_delay = 1000;
bool state = false;

void loop() {
  m_last = millis();

  digitalWrite( LED_BUILTIN, state );
  
  while ( millis() < ( m_last + m_delay ) )
    yield();

  state = !state;
}

我用来启动调试会话的命令:

~/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/xtensa-lx106-elf-gdb
GNU gdb (GDB) 8.2.50.20190202-git
Copyright (C) 2019 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-linux-gnu --target=xtensa-lx106-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".
(gdb) set remote hardware-breakpoint-limit 1
(gdb) set remote hardware-watchpoint-limit 1
(gdb) set remote interrupt-on-connect on
(gdb) set remote kill-packet off
(gdb) set remote symbol-lookup-packet off
(gdb) set remote verbose-resume-packet off
(gdb) mem 0x20000000 0x3fefffff ro cache
(gdb) mem 0x3ff00000 0x3fffffff rw
(gdb) mem 0x40000000 0x400fffff ro cache
(gdb) mem 0x40100000 0x4013ffff rw cache
(gdb) mem 0x40140000 0x5fffffff ro cache
(gdb) mem 0x60000000 0x60001fff rw
(gdb) set serial baud 115200
(gdb) file /tmp/arduino/sketches/D9ED6FC0207E66B7EA29DCF94067011B/gdb.ino.elf
Reading symbols from /tmp/arduino/sketches/D9ED6FC0207E66B7EA29DCF94067011B/gdb.ino.elf...
(gdb) target remote /dev/ttyUSB0
Remote debugging using /dev/ttyUSB0
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
Ignoring packet error, continuing...
Remote replied unexpectedly to 'vMustReplyEmpty': timeout
(gdb) 

操作系统是KDE neon,基于Ubuntu 24.04。

USB 端口看起来是正确的:

ls -l /dev/ttyUSB0
crw-rw----+ 1 root dialout 188, 0 Dec  1 08:30 /dev/ttyUSB0

它与 Arduino IDE 使用的端口相同,并且可以从 Arduino IDE 内部进行访问。 在启动 GDB 之前,我完全关闭了 Arduino IDE 应用程序。但还是没有成功。

有人知道可能是什么问题吗?

debugging arduino serial-port gdb esp8266
1个回答
0
投票

引用自这里

注意 - 由于调试器使用 ESP 的串行接口,您必须从代码中删除对 Serial 的所有调用

© www.soinside.com 2019 - 2024. All rights reserved.