Skip to content
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

Implement official Arduino IDE debugger API on 2.x #9118

Merged
merged 5 commits into from
Feb 9, 2024

Conversation

pillo79
Copy link
Contributor

@pillo79 pillo79 commented Jan 16, 2024

This PR replaces the current experimental sketch debugging description with a full implementation according to the finalized Arduino Platform Debug Specification. It is a backport of #9116 to the release/v2.x branch.

Use regexs to replace all occurrences of `{runtime.platform.path}` with
the correct `{runtime.tools.*.path}`, regardless of directory separator,
and remove dependency on specific text around each path.

Note that the order has been changed to ensure that the longest paths
are replaced first, to avoid replacing parts of other paths.
Ensure Windows paths properly use a backslash as folder separator.
Implement sketch debugging according to the official Arduino
Platform Debug Specification [1].

The biggest improvement is that now `launch.json` can be fully
customized by the core (including the type of each entry),
so there is no need to copy files in the sketch folder.
In particular, `debug_custom.json` is not used anymore.

[1] https://arduino.github.io/arduino-cli/latest/platform-specification/#sketch-debugging-configuration

BREAKING CHANGE: This commit requires Arduino IDE 2.3.0 or later to use
the debugging features. Older versions will no longer be able to start
a debug session successfully.
@VojtechBartoska VojtechBartoska added this to the 2.0.15 milestone Jan 17, 2024
@VojtechBartoska VojtechBartoska added the IDE: Arduino IDE Issue relates to Arduino IDE label Jan 25, 2024
Cortex-debug requires objdump to be in the same folder as gdb, or needs
the full path to the executable in the `launch.json` file. This is now
possible with the new debugging API.

On Arduino-ESP32 core versions 2.x, though, this causes a crash within
the Cortex-Debug extension as a result of loading the symbol table. This
feature is thus disabled for now.
If the `debug.executable` variable is null or unset, the Debug button
appears grayed out. The new IDE also takes current parameters into
account, allowing to conditionally enable the Debug button only when
some conditions are met.
@pillo79
Copy link
Contributor Author

pillo79 commented Feb 1, 2024

While testing this we found an issue with Cortex-Debug. It seems that some global symbols that are defined in core 2.x cause the plugin to crash when opening the "globals" sidebar. Since this feature was not present until now, I have disabled it in bca404d.
Otherwise, all tests OK on our side so marking this ready for review/merge.

@pillo79 pillo79 marked this pull request as ready for review February 1, 2024 17:09
@me-no-dev
Copy link
Member

@pillo79 is it now supported by the latest released IDE?

@pillo79
Copy link
Contributor Author

pillo79 commented Feb 1, 2024

Not yet - IDE 2.6.0 is currently scheduled to be released by mid next week.

@me-no-dev
Copy link
Member

@pillo79 OK. let's merge it when it's released. LGTM

@VojtechBartoska VojtechBartoska added the Status: Review needed Issue or PR is awaiting review label Feb 2, 2024
@pillo79
Copy link
Contributor Author

pillo79 commented Feb 9, 2024

IDE 2.3 has been released yesterday 👍

@me-no-dev me-no-dev merged commit 03da972 into espressif:release/v2.x Feb 9, 2024
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IDE: Arduino IDE Issue relates to Arduino IDE Status: Review needed Issue or PR is awaiting review
Projects
Development

Successfully merging this pull request may close these issues.

3 participants