-
-
Notifications
You must be signed in to change notification settings - Fork 403
Add debug command #567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
An even better alternative to printing the debugging tool locations as described above would be to add a The current proof-of-concept of the debugger does the following:
where gdb.cfg is a temporary file with the content
|
Thanks @spoenemann We can provide:
Questions:
|
That sounds good! Regarding the second question: I have been able to debug with the default compiler settings, which use |
I'd think that the GDB port is sufficient for the time being. One would need to find out what's the default behaviour for OpenOCD, i.e. does it spawn a telnet server by default. If so, this port would need to be set to some value so as not to conflict with other sessions. |
Note that you can also let gdb spawn openocd and talk to it through a pair of pipes, which saves one open network port. A long time ago, I figured this out for an arduino-debugger tool that never really got finished. For another platform, I'm using this technique again, which is done using this command in the gdb init file (this uses normal gdb commands):
Looking back at my arduino-debugger work, which used gdb mi commands, the command I used was:
Note that this The "telnet_port 0" is added to disable the unused telnet port (which is inside the openocdConfig file in the second version).
I guess this depends on the flags set in platform.txt. The default AVR core always builds with -g, but some cores (such as STM32) need a board option to enable -g.
I suspect this needs only
@cmaglie, starting a "GDB server" in this case means just starting openocd, right, which provides a gdb server? I wonder if it would make sense to let arduino-cli start both openocd and gdb (as suggested above) and maybe even directly connect gdb (using mi2) to stdin/stdout (not needing any network ports at all)? That would also remove the need for a stop command, since the IDE could just send a term (or gdb quit command or whatever).
If there would be a stop command, how will you select the instance of the server to stop? More generally, how will you select the board to debug? I guess this could be done similarly to how a board is selected for upload, but might need some platform.txt additions to know what options to pass to openocd to select the board (I guess the options are dependent on what adapter is used by openocd). |
AFAIK, it is enabled by default, setting |
Hi @matthijskooijman thank you for the hints!
that would be the ideal solution using In our case we are using arduino-cli as a daemon/grpc (for integration with IDE) and, since we don't have stdin/out, we must stream the gdb stdin/out via GRPC... it's doable but it's more work. @rsora let's figure this out...
Yes, well I've omitted the details, we could simply return a session-id when the gdb is opened, and use the same id in the close command to indentify the session to close. |
Feature Request
We are implementing a debugger for the Arduino Pro IDE. The debugger needs specific command line tools for the selected board. Currently we have hard-coded the paths to these tools for the Arduino Zero board, but of course we'd like to generalize this (arduino/arduino-pro-ide#185).
Could the CLI provide paths to the debugging tools when we query board details?
This is the list of required tools, along with the path we currently use for Arduino Zero:
$Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-gdb
$Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-objdump
$Arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/bin/openocd
$Arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/share/openocd/scripts
$Arduino15/packages/arduino/hardware/samd/1.8.4/variants/arduino_zero/openocd_scripts/arduino_zero.cfg
The text was updated successfully, but these errors were encountered: