-
Notifications
You must be signed in to change notification settings - Fork 114
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
Attach to PID does not process "Initial Commands" before attaching #329
Comments
That is actually a duplicate as we did had that "side-noted" multiple times, but it is the most expressive ones so is the one this is to be tracked under. Note: we only do the |
Ah, ok, I'm sure I probably missed that it was already documented in one of the previous issues. I happened to stumble upon it and dug into it a bit to understand what has happening. Can you link the other issues to this one if this will be the place where we fix it? I don't think I can assign this to myself (as I'm not a Collaborator, only Contributor). However, I'd be fine if you assigned this to me. I'll take a look at #316. Probably makes sense to finish that one first and then start on this one separately. It does looks like there would be some overlap of the affected source, but probably would be good keep the issues separate if possible. |
It was only a "side note" in other issues, when I stumble over one I'll reference this one there. |
@brownts is this still open? Looks like "kind of related" to the other nice work you've did. |
Yes, this is still open. I was trying to push through a few of the other issues and PRs that were already in work. This was going to be the next thing I took a look at. It will require a change to both the MI2::attach and MI2::ssh. |
Thanks for your work on this extension, it helps a lot! |
@brownts would you also like to have collaborator access? Also we might want to move the repository to a GitHub team eventually, so there can be more than one owner on it. |
Sure, that would be wonderful! 👍 |
The current method used to attach to a process on the local machine is to specify the PID on the command line to the debugger. However, by doing this, the debugger will attach to the process prior to executing the initial configuration commands (specified in
MI2::initCommands
). This is inconsistent with remote attach operations (usingtarget-select remote
ortarget-select extended-remote
) which only attach to the remote process after the initial configuration commands have been processed.The problem with attaching prior to processing the initial configuration commands is that there can be spurious errors that occur because of this. For example, if a source path mapping is needed to resolve the source code, when the debugger attaches to the process, it will attempt to locate the source file, but won't be able to find it because the source path mappings commands have not yet been processed. Additionally, this can also lead to errors attempting other commands, such as
gdb-set target-async on
failing with "Cannot change this setting while the inferior is running".The below output demonstrates both the source path mapping issue as well as the issue with the failing
gdb-set target-async on
command. I'd suggest that the current behavior be changed to process the initial configuration commands first, and then issue a "target-attach" command afterwards to attach to the local process.The text was updated successfully, but these errors were encountered: