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

Reverse sort sourceMap #1428

Merged
merged 2 commits into from
Dec 4, 2023
Merged

Conversation

ya-mouse
Copy link
Contributor

Do reverse sort of the sourceMap.

In my launch.json configuration I have the following sourceFileMap:

            "sourceFileMap": {
                "/usr/src/debug/my-project/git-r0/build/src/../../git": "${workspaceFolder}",
                "/usr/src/debug": {
                    "editorPath": "${config:YOCTO_ARCH}",
                    "useForBreakpoints": false
                }
            },

The YOCTO_ARCH set in settings.json to:

    "terminal.integrated.env.linux": {
        "YOCTO_ARCH": "/home/mouse/linux-bsp/linux-devel-build/build/work/cortexa7t2hf-neon-vfpv4_linux-linux-gnueabi"
    },

The proposed change addresses an issue encountered while debugging a binary that's running on a remote system and built using Yocto. Currently, when debugging, the source files are being referenced from the Yocto build tree instead of the local workspace. This issue prevents setting breakpoints effectively in the local workspace source files.

To resolve this, the change involves modifying the way source mappings are processed. Specifically, it proposes sorting the mappings in reverse order, starting with the longer, more specific paths and moving towards the more general ones. By doing this, the debugger will first consider the project-specific paths defined in sourceFileMap. If it doesn't find a match there, it will then fall back to the more general paths. This reverse sorting ensures that the local workspace sources are prioritized over the Yocto build tree sources, allowing for effective breakpoint setting and debugging in the local workspace.

Copy link
Member

@gregg-miskelly gregg-miskelly left a comment

Choose a reason for hiding this comment

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

Aside from that, this change looks good to me. Thanks for taking the time to submit this!

src/MICore/LaunchOptions.cs Outdated Show resolved Hide resolved
Copy link
Member

@gregg-miskelly gregg-miskelly left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to submit this!

@gregg-miskelly
Copy link
Member

@WardenGnaw do you want to take a quick look also?

@gregg-miskelly gregg-miskelly merged commit 97b44d7 into microsoft:main Dec 4, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants