Commit Graph

38 Commits

Author SHA1 Message Date
Peter Dragun
ffd3a58ff9 fix(tools/coredump): do not detect port when core file is used
Closes https://github.com/espressif/esp-idf/issues/12673
2023-12-05 09:52:19 +01:00
Erhan Kurubas
94c27b976d fix(coredump-info): set default gdb timeout as 3 seconds 2023-11-13 15:34:24 +01:00
Michal Jenikovsky
e9bb33624b idf.py: gdb action incorrectly generated EOL gdbinit scripts
GDB on Windows incorrectly reads EOL in the script files causing 'gdb'
action to fail.

(gdb) source .../build/gdbinit/py_extensions
(gdb) source .../build\gdbinit\symbols
add symbol table from file "...\build\bootloader\bootloader.elf"
.../build\gdbinit\symbols:6: Error in sourced command file:
Undefined command: "".  Try "help".

Forcing line separator to '\n' resolved the issue

Signed-off-by: Michal Jenikovsky <jendo@jmsystems.sk>
2023-08-11 12:37:29 +02:00
Ivan Grokhotkov
cfa1896780 Merge branch 'contrib/github_pr_11535' into 'master'
Replace deprecated flushregs alias with full gdb command (GitHub PR)

Closes IDFGH-10272

See merge request espressif/esp-idf!24752
2023-07-28 22:40:22 +08:00
Aleksei Apaseev
6532076ad6 coredump: added the chip_rev field into the coredump header 2023-07-26 10:53:28 +08:00
Aleksei Apaseev
ba51b09cb2 coredump: added the chip_rev field into the coredump header 2023-07-26 10:53:28 +08:00
Frantisek Hrbata
ff1ce54869 fix(debug_ext): CTRL+C handling while waiting on gdb process
idf.py spawns gdb process within a thread and uses Thread.join() to wait
for the gdb process to finish. As CTRL+C(SIGINT) is used by gdb to interrupt the
running program, we catch the SIGINT while waiting on the gdb to finish,
and try Thread.join() again.

With cpython's commit

	commit a22be4943c119fecf5433d999227ff78fc2e5741
	Author: Victor Stinner <vstinner@python.org>
	Date:   Mon Sep 27 14:20:31 2021 +0200

	    bpo-45274: Fix Thread._wait_for_tstate_lock() race condition (GH-28532)

this logic doesn't work anymore, because cpython internally marks the
thread as stopped when join() is interrupted with an exception. IMHO
this is broken in cpython and there is a bug report about this
https://github.com/python/cpython/issues/90882. Problem is that
waiting on a thread to finish is based on acquiring a lock. Meaning
join() is waiting on _tstate_lock. If this wait is interrupted, the
above referenced commit adds a logic that checks if the lock is help,
meaning the thread is done and marks the thread as stopped. But there is
no way to tell if the lock was acquired by us running join() or if it's
held by someone else e.g. still by the thread bootstrap code. Meaning
the thread is still running.

I may be missing something, but I don't see any reason why to spawn gdb
process within a thread. This change removes the thread and spawns gdb
directly. Instead waiting on a thread, we wait on the process to finish,
replacing join() with wait() and avoiding this problem.

Closes https://github.com/espressif/esp-idf/issues/11871

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-07-17 08:00:23 +02:00
Daniel Mangum
647e7a2a71
fix: Replace deprecated flushregs alias with full gdb command
Usage of `flushregs` in gdb will result in the following warning:

```
Warning: 'flushregs', an alias for the command 'maintenance flush register-cache', is deprecated.
Use 'maintenance flush register-cache'.
```

This patch updates to use the recommend command.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
Merges https://github.com/espressif/esp-idf/pull/11535
2023-07-13 09:26:47 +02:00
Peter Dragun
58c467f3aa fix(tools/coredump-info): pass non-default partition table offset to esp-coredump
Closes https://github.com/espressif/esp-idf/issues/11564
2023-07-10 10:42:06 +02:00
Frantisek Hrbata
4ee00623a3 tools: allow to use hints for debug targets
The debug targets are currently not utilizing hints, because they
are not using RunTool() helper from tools.py to spawn sub-processes.
Adjusting debug targets to use RunTool() would require some significant
changes to debug targets and RunTool() as well. Since debug targets
are already storing their output in logs, we can use these and process
them for hints.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-02-01 15:06:39 +01:00
Frantisek Hrbata
9d1c62becb tools: fix idf.py gdb memory access before remote target is connected
Currently loading of esp32s3 ROM ELF symbols fails with
"Cannot access memory at address 0x3ff194ad". Let's perform
add-symbol-file after connection to the target.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-01-20 11:02:26 +01:00
Alexey Lapshin
6c674f12fa Merge branch 'fix/idf-gdb-remove-ROM-access-workaround' into 'master'
tools: remove obsolete workaround for reading ROM data from flash

See merge request espressif/esp-idf!21944
2023-01-19 23:58:35 +08:00
Frantisek Hrbata
8934233b0b tools: fix unnecessary port detection for multiple targets
When multiple targets are specified, e.g. idf.py flash monitor, the
automatic port detection is performed twice. Keep the port value in
args.port and avoid multiple calls to get_default_serial_port().

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-01-11 16:13:28 +01:00
Alexey Lapshin
a0bac6d309 tools: remove obsolete workaround for reading ROM data from flash 2023-01-09 11:36:11 +07:00
Roland Dobai
a816dfbfc3 Tools: gdbgui is not supported on Python 3.11
Closes https://github.com/espressif/esp-idf/issues/10116
2022-11-25 16:40:28 +01:00
Aleksei Apaseev
06ac2166d6 tools: added idf.py coredump sub-command 2022-10-28 03:01:56 +00:00
Roland Dobai
d08898aabc Merge branch 'fix/tools-gdbinit-with-elf-symbols' into 'master'
tools: fixed elf symbols load if gdbinit specified

Closes IDF-4991 and GCC-246

See merge request espressif/esp-idf!18089
2022-09-26 16:20:19 +08:00
Alexey Lapshin
4539020dac tools: fix openocd old logs print 2022-09-21 22:41:16 +04:00
Alexey Lapshin
0fd4b09a46 tools: add test for ROM symbols in GDB 2022-09-21 22:39:03 +04:00
Alexey Lapshin
29655fe22a tools: fixed elf symbols load if gdbinit specified
ROM and bootloader symbols add to use in GDB (via 'idf.py gdb')
2022-09-21 22:39:03 +04:00
Ivan Grokhotkov
d366664b0d
tools: use built-in USB_SERIAL_JTAG for "idf.py openocd" on C3 and S3
Since both chips have built-in JTAG functionality, and there are no
official boards with FT2232H for these chips, use the built-in JTAG
by default.

To use them with esp-prog, set:
  OPENOCD_COMMANDS="-f board/esp32c3-ftdi.cfg"
or pass this via the --openocd-commands argument to idf.py.
2022-08-05 18:22:30 +02:00
simon.chupin
44f3c19fa9 tools: Add python types hints 2022-06-15 14:33:29 +02:00
simon.chupin
1c5e596633 idf.py: Change copyright in tools dir 2022-05-24 14:01:50 +02:00
Roland Dobai
9b64c40981 Merge branch 'feature/add_freertos_gdb_integration' into 'master'
tools: add freertos support to GDB

Closes GCC-226

See merge request espressif/esp-idf!17571
2022-04-28 14:36:58 +08:00
Alexey Lapshin
a2f6595c5f tools: add freertos support to GDB
GDB with python support will automatically load freertos-gdb python module.
It comes to GDB with commands starting with 'freertos' to show human-readable
tables with freertos task/queue/timer information

Python module URL: https://pypi.org/project/freertos-gdb
2022-03-25 15:25:36 +04:00
Marek Fiala
b5c374ae3e tools: Deprecated commands removed from idf.py
Remove deprecated commands from idf.py, but they are still kept working as cmake deprecated targets.
2022-03-25 09:08:53 +01:00
Roland Dobai
b28d7e6850 Tools: Improve the Python package system
Introduce features into the Python package management system & manage
package versions outside of ESP-IDF repo.
2022-01-17 16:54:36 +01:00
Fu Hanxi
42405604af idf.py gdb: autoload prefix_map_gdbinit when exists in project_description.json 2021-10-26 14:20:40 +08:00
Marek Fiala
ff18a96f7d tools: replace _ with - in idf.py
Closes https://github.com/espressif/esp-idf/issues/5126
2021-10-13 17:30:38 +08:00
Roland Dobai
0102cbf334 tools: Add various fixes for idf.py gdbgui
Closes https://github.com/espressif/esp-idf/issues/5968
2021-04-27 17:34:31 +02:00
Martin Vychodil
7bbe2a235f * fixed generation of .gdbinit file (esp32c3 dbg issue) 2021-03-15 15:52:07 +01:00
Fu Hanxi
0146f258d7 style: format python files with isort and double-quote-string-fixer 2021-01-26 10:49:01 +08:00
David Cermak
3b3409fb20 idf.py: Fixed gdb target to exit cleanly when no openocd watch task
When idf.py gdb starts, it expects openocd was started in the background
and creates a thread to watch for openocd errors. when gdb target exits,
the debug_ext.py aims to cleanup all threads and processes, but fails
with traceback if openocd-watch thread not available, which could happen
if openocd started separately.
2020-09-18 08:30:21 +02:00
Ivan Grokhotkov
6467f5dd54 tools: idf.py: default to board/esp32s2-kaluga-1.cfg for ESP32-S2
NFC. Kaluga-1 config is same as devkitj + esp32s2.
2020-07-24 15:54:47 +02:00
Ivan Grokhotkov
7dad294061 tools/idf.py: add --gdbinit argument to gdb, gdbgui, gdbtui
Allows starting a debugging session with a custom set of init commands
2020-04-29 23:43:38 +02:00
David Cermak
2c2f909133 idf.py: debug ext prints detailed info/hint on common openocd issues 2020-04-15 09:07:17 +02:00
David Cermak
ec391ddfa1 idf.py: fix debug extenstion to work with unit tests 2020-04-09 14:54:10 +02:00
David Cermak
3b5c3d6521 idf.py: debug targets for easier execution of openocd, gdb, gdbui
Support for execution of asynchronous target, such as openocd, which
by default runs in the background, but if it's the only target idf.py
outputs the openocd in the console waiting for termination by user.

Supports also blocking commands gdb and gdbtui to start a debugging
session in an active console.

Supports running gdbgui running a UI debugging session in a browser
window, using the active console for other commands, such as openocd
or monitor.

Supports combining the debug targets in one action list, such as
idf.py openocd gdbgui monitor
2020-04-07 17:37:48 +02:00