| Summary: | GDB "Attach" gets stuck without notice, when lacking permission to attach | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Martin Oberhuber <mober.at+eclipse> | ||||
| Component: | cdt-debug-dsf-gdb | Assignee: | Jonah Graham <jonah> | ||||
| Status: | RESOLVED FIXED | QA Contact: | Jonah Graham <jonah> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | alex22207, cdtdoug, jonah, malaperle | ||||
| Version: | 9.3.2 | ||||||
| Target Milestone: | 9.4.0 | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| See Also: |
https://git.eclipse.org/r/111314 https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=5fd3ddb84de5083e8e092f84a002084cdf9e8ec8 |
||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
(In reply to Martin Oberhuber from comment #0) > BTW, Bugzilla "Version" 9.3.2 seems to be missing for Oxygen.1 ... I added 9.3.2 to Bugzilla and changed this bug to be found in Version 9.3.2. (In reply to Martin Oberhuber from comment #0) > 634,489 (gdb) > 642,462 18-target-attach --thread-group i1 781 > 642,464 &"Could not attach to process. If your uid matches the uid of the > target\nprocess, check th\ > e setting of /proc/sys/kernel/yama/ptrace_scope, or try\nagain as the root > user. For more details, \ > see /etc/sysctl.d/10-ptrace.conf\n" :-( GDB is not responding to MI command 18. We'll have to add some checks for that error message to convert to an error response (and if the problem still exists in 8.0.1 submit a bug report to GDB too). Hmm, I thought this was fixed with bug 487128 (In reply to Marc-André Laperle from comment #2) > Hmm, I thought this was fixed with bug 487128 I haven't investigated beyond what is in the comments. But in Bug 426308 (linked from 487128) the attach is actually returning an MI error message. From the trace in Comment 0, GDB is not returning ^error at all in this case? This is a buffering bug introduced in GDB 7.11 that has been fixed in newer GDBs. Issuing a newline after the -target-attach should have returned kicks GDB to flush the buffer. e.g (where $PID is a process id with no permission, such as avahi-daemon) start GDB with output not connected to tty (by teeing it): $ gdb --interpreter=mi2 | tee out then send: 19-target-attach --thread-group i1 $PID no response from GDB press Enter and you should see result. As a single liner: (sleep 1 ; echo 19-target-attach --thread-group i1 $PID ; echo sent target-attach, now waiting 1>&2 ; sleep 5 ; echo) | gdb.7.11 --interpreter=mi2 | tee out New Gerrit change created: https://git.eclipse.org/r/111314 Gerrit change https://git.eclipse.org/r/111314 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=5fd3ddb84de5083e8e092f84a002084cdf9e8ec8 Hi Martin, I am pretty sure I reproduced and fixed the problem you have submitted. I would be very grateful if you could test if I actually fixed the bug you identified. Thanks Jonah Created attachment 276394 [details]
gdb trace output
gdb trace output.
I'm experiencing the exact behavior as Martin Oberhuber describes in his post of 2017-09-15 08:17:21 EDT. I've attached my GDB trace log. Interesting that, unlike Martin, I am not seeing any obvious sign of an error in the logs. The launcher just hangs at 97%. I'm running CDT Version: 9.5.0.201806170908 on Ubuntu 18.04. Is this a bug or a bad config on my end? Any assistance is appreciated. Thanks, Alex (In reply to Alex Remily from comment #9) Sorry for the delay in replying, I have been away. From the logs it looks like a different bug and the 97% is a coincidence. Lets continue the discussion in Bug 540795. |
Build ID: Eclipse C/C++ Package Oxygen.1 RC4 on Ubuntu 16.04.2 Steps to Reproduce: 1. Launch Eclipse as a normal user on Linux 2. Run > Debug Configurations , new C/C++ Attach Application 3. Make "Project" and "Executable" fields empty, click Debug 4. In the process picker, choose a root-owned process eg avahi-daemon --> The "Launching..." progress bar gets stuck at 97%, there is no other indication of failure (very confusing!) Expected behavior: the Launch should stop and fail with an error message. BTW, Bugzilla "Version" 9.3.2 seems to be missing for Oxygen.1 ... In the GDB Traces console, I see this: 634,401 2-gdb-version 634,402 ~"GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1\n" [...] 634,489 (gdb) 642,462 18-target-attach --thread-group i1 781 642,464 &"Could not attach to process. If your uid matches the uid of the target\nprocess, check th\ e setting of /proc/sys/kernel/yama/ptrace_scope, or try\nagain as the root user. For more details, \ see /etc/sysctl.d/10-ptrace.conf\n"