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

Path Substitutions Ignored for Attach #293

Closed
brownts opened this issue Nov 6, 2021 · 4 comments · Fixed by #295
Closed

Path Substitutions Ignored for Attach #293

brownts opened this issue Nov 6, 2021 · 4 comments · Fixed by #295

Comments

@brownts
Copy link
Collaborator

brownts commented Nov 6, 2021

The path substitutions are intially handled in "setPathSubstitutions" (i.e., gdb.ts and lldb.ts) by adding specific debugger commands (e.g., "set substitute-path" for GDB), to the list of "extraCommands" in miDebugger. However, these extra commands are only sent to the backend for the "launch" configuration, but not for the "attach". It appears the only place the "extraCommands" are referenced are in "MI2.initCommands", which is only invoked from the "MI2.load" API (which corresponds to the "launch" configuration). It is likely "initCommands" should also be called from the "MI2.connect" and "MI2.attach" APIs as well, which correspond to the "attach" configuration.

@GitMensch
Copy link
Collaborator

Good catch!

@brownts
Copy link
Collaborator Author

brownts commented Nov 8, 2021

I was looking into this a bit more and it seems like this likely doesn't work at all for LLDB. I don't typically use LLDB, but installed it to experiment with a potential fix to this. I noticed that in "lldb.js", neither "launchRequest" nor "attachRequest" call "setPathSubstitutions" (as they do in the gdb.ts versions), so no extra commands are even enqueued for LLDB. I played around with adding a call to "setPathSubstitutions" in the LLDB "launchRequest" to see if it would then at least work for the launch configuration, but ran into another problem. It appears the "settings set target.source-map" (used in the LLDB version of "setPathSubstitutions") is not recognized by LLDB-MI (at least lldb-mi-9 that I was using).

GDB -> App: {"token":4,"outOfBandRecord":[],"resultRecords":{"resultClass":"error","results":[["msg","Driver. Received command '4-settings set target.source-map C:\\test /home/troy/git/hello_world_exe/../..'. It was not handled. Command 'settings' not in Command Factory"]]}}

It's unclear to me if this was not tested or maybe my lldb-mi version is too old. Is there an alternative command that should be used here instead or do I need a newer version of lldb-mi?

@GitMensch
Copy link
Collaborator

That is not lldb-mi command, it should be sent to lldb as "normal command" as it is when you enter a command in the console - which should work, doesn't it? If that works the setPathSubstitutions "just" needs to use the same sequence of commands.

@brownts
Copy link
Collaborator Author

brownts commented Nov 8, 2021

Thanks. I think my problem is that I needed to use "sendCliCommand" instead of just "sendCommand". That seems to fix that particular issue I was having. I'll keep working on this.

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 a pull request may close this issue.

2 participants