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

problem with debugging file via lldb #594

Closed
ghost opened this issue Sep 15, 2021 · 9 comments
Closed

problem with debugging file via lldb #594

ghost opened this issue Sep 15, 2021 · 9 comments
Labels

Comments

@ghost
Copy link

ghost commented Sep 15, 2021

Hello,
i have a problem with remote debugging crosscompiled binary file. The breakpoints doesnt hit. If i compile directly with cargo build, everything works fine. Do u have some advice, what might be wrong ? The cross binary file missing any debug symbols ?

I am using VS CODE and CODELLDB

@ghost
Copy link
Author

ghost commented Sep 16, 2021

I just compared binary filed compile with cargo build a cross build and they are different cross binary is smaller. Do anyone has any advice ?

@ghost ghost closed this as completed Jan 14, 2022
@romanroth
Copy link

@kytas I am having the same problem, how did you fix it?

@ghost
Copy link
Author

ghost commented Jan 19, 2024

@kytas I am having the same problem, how did you fix it?

hello, in older version u must use "sourceMap": {
"/project": "${workspaceFolder}"
}, in launch.json
because the symbols has another path.
Nowdays i dont have the source map and debugging working. I have dockerfile for arm achitecture like Raspberry etc.

@romanroth
Copy link

@kytas I am having the same problem, how did you fix it?

hello, in older version u must use "sourceMap": { "/project": "${workspaceFolder}" }, in launch.json because the symbols has another path. Nowdays i dont have the source map and debugging working. I have dockerfile for arm achitecture like Raspberry etc.

Thank your for your answer. I already figured out to use the sourceMap and now my breakpoints are hit.

For anyone stumbling on this issue in the future this is what you must do if your breakpoints are not getting hit (if you are using cross):
The paths must be the "remote" cross path as the key, and your local path as the value. They must both be absolute and point to their respective src directory. If you get an message of the form Could not resolve any locations for breakpoint at d:\<path>\<projectname>\src\main.rs:2, but found a valid location at /mnt/d/<path>/<projectname>/src/main.rs:2 (or similar) inside the "DEBUG CONSOLE" then your source mapping is not correct and you will not hit any breakpoints!
An example for a correct path mapping would be:

"sourceMap": {
    "/mnt/<path-to-project>/src/": "d:\\<path-to-project>\\src\\"
}

To find out the right paths just check the error message you get if your breakpoints are not getting hit.

@Emilgardis
Copy link
Member

I wonder if we could make this process a bit better, like a env var that we can set

@romanroth
Copy link

@Emilgardis That may not be a bad idea. I also tried setting it up on another windows machine and there the source path wasn't /mnt/... but just /project/src/ so I don't know if the path always remains the same between different systems.

@Emilgardis
Copy link
Member

That's probably because you're using different versions of cross, on current cross from the main branch it should always use /mnt/ on windows

@romanroth
Copy link

@Emilgardis Huh thats odd. I just started using cross on both machines and if i recall correctly they both installed the newest release 0.2.5. But I mean it is an easy fix if the paths get mixed up so its not a big issue i guess.

@Emilgardis
Copy link
Member

Emilgardis commented Jan 20, 2024

On 0.2.5, installed as cargo install cross the paths can be either absolute (i.e /mnt/drive/...) or "linked" to /project, depending on if the workspace has path dependencies or not. If there are no path dependencies, it'll use /project. Anyway, the more appropriate behaviour we determined is to just always use the absolute path

relevant issue: #1278

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants