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

Exec gdb/lldb in rust-{gdb/lldb} wrapper scripts #53477

Merged
merged 2 commits into from
Aug 22, 2018

Conversation

ftilde
Copy link
Contributor

@ftilde ftilde commented Aug 18, 2018

This way, the process we get by executing rust-gdb or rust-lldb (eventually) is an actual gdb or lldb process and behaves accordingly. Previously (and at least to me unexpectedly) it was just a script waiting for the debugger to exit. Sending a signal (e.g. SIGINT) to the spawned process did therefore not affect the debugger process (which was just a child of the wrapper script).

In order to work around that we exec (according to this part of the posix shell) and replace the script process with the debugger in the last line of the script. The lldb script had to be modified to not pass the configuration commands via a script file (which in my opinion is cleaner anyway).

ftilde added 2 commits August 19, 2018 00:00
Arguments are passed on the command line via --one-line-before-file
(instead of in a file via --source-before-file) to lldb.
This way the process we get by calling rust-{gdb,lldb} is an actual
{gdb,lldb} instance and not (perhaps surprisingly) a script waiting for
the debugger process to finish. Thus, sending a SIGINT to the spawned
process stops execution of the child, for example.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 18, 2018
@eddyb
Copy link
Member

eddyb commented Aug 18, 2018

r? @michaelwoerister

@michaelwoerister
Copy link
Member

Looks great, thanks @ftilde!

@bors r+

@bors
Copy link
Contributor

bors commented Aug 20, 2018

📌 Commit d6426e8 has been approved by michaelwoerister

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 20, 2018
@bors
Copy link
Contributor

bors commented Aug 22, 2018

⌛ Testing commit d6426e8 with merge 786ccc3...

bors added a commit that referenced this pull request Aug 22, 2018
Exec gdb/lldb in rust-{gdb/lldb} wrapper scripts

This way, the process we get by executing `rust-gdb` or `rust-lldb` (eventually) is an actual `gdb` or `lldb` process and behaves accordingly. Previously (and at least to me unexpectedly) it was just a script waiting for the debugger to exit. Sending a signal (e.g. SIGINT) to the spawned process did therefore not affect the debugger process (which was just a child of the wrapper script).

In order to work around that we `exec` (according to [this](http://pubs.opengroup.org/onlinepubs/009695399/utilities/exec.html) part of the posix shell) and replace the script process with the debugger in the last line of the script. The lldb script had to be modified to not pass the configuration commands via a script file (which in my opinion is cleaner anyway).
@bors
Copy link
Contributor

bors commented Aug 22, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: michaelwoerister
Pushing 786ccc3 to master...

@bors bors merged commit d6426e8 into rust-lang:master Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants