Skip to content

Fix regression in overriding remapped debug configuration data via debug_custom.json #49

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

Merged
merged 3 commits into from
Mar 5, 2024
Merged

Fix regression in overriding remapped debug configuration data via debug_custom.json #49

merged 3 commits into from
Mar 5, 2024

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Mar 3, 2024

Some of the data from the arduino-cli debug --info output does not match exactly with the launch.json format required by the Cortex-Debug VS Code extension used at the Arduino IDE integrated sketch debugger. For this reason, some remapping of the Arduino CLI data is required.

The user can adjust the debugger configuration via a debug_custom.json file in the sketch project. The data from this file is merged into the base data provided by arduino-cli debug --info. The data from debug_custom.json should override the base data where there is overlap.

During the recent reworking of the debugger configuration generation code (#41), a regression was introduced that caused the override to no longer work for the remapped Arduino CLI data. The cause was applying the remapping after merging the debug_custom.json data, which resulted in the debug_custom.json data being overridden by that subset of the Arduino CLI data.

This was not caught by the project's tests because there was no coverage for overrides. I have added coverage and you can see the test fails when ran on the codebase prior to the patch:

https://github.com/arduino/vscode-arduino-tools/actions/runs/8128174502/job/22213780846?pr=49#step:6:159

The bug is fixed by performing the remapping before merging the debug_custom.json data.

Fixes #48

per1234 added 2 commits March 2, 2024 19:53
Some of the data from the `arduino-cli debug --info` output does not match exactly with the launch.json format required
by the IDE's debugger. For this reason, some remapping of the data is required. The remapping code is validated by
tests.

Previously the tests passed the remapping test data via the argument used for the data from the user's debug_custom.json
file. This was incorrect since the remapping is specific to the data from Arduino CLI. No remapping is necessary for the
debug_custom.json data since this is directly correlated to launch.json and thus will always use the correct data format
for direct inclusion in launch.json.
….json

Some of the data from the `arduino-cli debug --info` output does not match exactly with the launch.json format required
by the IDE's debugger. For this reason, some remapping of the data is required.

The user can adjust the debugger configuration via a debug_custom.json file in the sketch project. The data from this
file is merged into the base data provided by `arduino-cli debug --info`. It is essential that the data from
debug_custom.json overrides the base data where there is overlap, yet previously there was no test coverage for this.

Since the merging code gives special handling to the remapped Arduino CLI data, it is especially important to provide
good coverage for overriding that data.
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Mar 3, 2024
Some of the data from the `arduino-cli debug --info` output does not match exactly with the launch.json format required
by the IDE's debugger. For this reason, some remapping of the data is required.

The user can adjust the debugger configuration via a debug_custom.json file in the sketch project. The data from this
file is merged into the base data provided by `arduino-cli debug --info`. The data from debug_custom.json should
override the base data where there is overlap.

Previously the override did not work for the remapped Arduino CLI data since the remapping was applied after merging the
debug_custom.json data, which caused the debug_custom.json data to be overridden by that subset of the Arduino CLI data.
The bug is fixed by performing the remapping before merging the debug_custom.json data.
Copy link

@dankeboy36 dankeboy36 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Per!

@per1234 per1234 merged commit 0227d28 into arduino:main Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not possible to override debug configuration keys that are remapped from Arduino CLI
4 participants