Debian bug 271069, gdb startup fails
History:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=271069
I've been looking at this bug. I've already fixed the EINTR problem; I didn't see your patch (not sure why the BTS didn't forward it to me). But 2.6.10-rc1 does the same thing outside of UML, so I needed to fix it anyway.
However, GDB startup still fails in UML using './linux debug'. Here's what happens:
- GDB forks
- the child issues TRACEME
- GDB waits for it, successfully now that EINTR is handled
- GDB issues PTRACE_SETOPTIONS (returns -EINVAL because the proxy does not support it)
- GDB decides that the feature isn't available (good so far; it isn't)
- GDB tries to clean up. It sends PTRACE_KILL to the child it forked.
- GDB waits for the child to exit. Which it never does.
I imagine the proxy is just not able to cope with this. It certainly doesn't look as if it can. For instance, arg2 is completely ignored except for PTRACE_ATTACH; I think what has happened is that the PTRACE_KILL was sent to the wrong process. And the waitpids are probably waiting for the wrong process too.
I think the only way to fix this is to teach the UML proxy to get out of the way if the pid is not the expected one, for at least PTRACE_KILL and waitpid; but it should probably continue to return failure for PTRACE_SETOPTIONS.
Signature · 12 lines
Daniel Jacobowitz ------------------------------------------------------- This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8 _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 26 lines · Daniel Jacobowitz
History:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=271069I've been looking at this bug. I've already fixed the EINTR problem; I didn't see your patch (not sure why the BTS didn't forward it to me). But 2.6.10-rc1 does the same thing outside of UML, so I needed to fix it anyway.
However, GDB startup still fails in UML using './linux debug'. Here's what happens:
- GDB forks
- the child issues TRACEME
- GDB waits for it, successfully now that EINTR is handled
- GDB issuesPTRACE_SETOPTIONS(returns-EINVALbecause the proxy does not support it)
- GDB decides that the feature isn't available (good so far; it isn't)
- GDB tries to clean up. It sendsPTRACE_KILLto the child it forked.
- GDB waits for the child to exit. Which it never does.I imagine the proxy is just not able to cope with this. It certainly doesn't look as if it can. For instance, arg2 is completely ignored except for
PTRACE_ATTACH; I think what has happened is that thePTRACE_KILLwas sent to the wrong process. And the waitpids are probably waiting for the wrong process too.
Quoted 4 lines
I think the only way to fix this is to teach the UML proxy to get out of the way if the pid is not the expected one, for at least
PTRACE_KILLand waitpid; but it should probably continue to return failure forPTRACE_SETOPTIONS.
Actually, while the proxy probably should be fixed anyway, I've worked around this in GDB. It will be in the Debian 6.3-2 packages, which I'm working on right now.
Should "kill" work from the GDB prompt? If so, that does need some work in the proxy.
Signature · 12 lines
Daniel Jacobowitz ------------------------------------------------------- This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8 _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 8 lines · [email protected] said:
- GDB forks
- the child issues TRACEME
- GDB waits for it, successfully now that EINTR is handled
- GDB issuesPTRACE_SETOPTIONS(returns-EINVALbecause the proxy does not support it)
- GDB decides that the feature isn't available (good so far; it isn't)
- GDB tries to clean up. It sendsPTRACE_KILLto the child it forked.
- GDB waits for the child to exit. Which it never does.
From your description above (I haven't seen this personally), there are a couple of things I don't understand.
First, I don't see how a PTRACE_KILL can be going to the wrong process. I see only one child under ptrace.
Second, it would seem that, even if this was successful, the end result is './linux debug' just dropping you back to a shell prompt. This may be better than the current hang, but it's not the desired result.
Jeff
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 11 lines · Jeff Dike
Quoted 10 lines · [email protected] said:
- GDB forks
- the child issues TRACEME
- GDB waits for it, successfully now that EINTR is handled
- GDB issuesPTRACE_SETOPTIONS(returns-EINVALbecause the proxy does not support it)
- GDB decides that the feature isn't available (good so far; it isn't)
- GDB tries to clean up. It sendsPTRACE_KILLto the child it forked.
- GDB waits for the child to exit. Which it never does.From your description above (I haven't seen this personally), there are a
Quoted 8 lines
couple of things I don't understand.
First, I don't see how a
PTRACE_KILLcan be going to the wrong process. I see only one child under ptrace.Second, it would seem that, even if this was successful, the end result is './linux debug' just dropping you back to a shell prompt. This may be better than the current hang, but it's not the desired result.
GDB isn't trying to kill UML; it's trying to kill a process that it forked, for the express purpose of figuring out whether certain debug facilities are available on the system. So GDB is "attached" to both UML and this new child. It's trying to kill (as well as do other things to) the new child; but UML's proxy layer assumes that anything GDB does by ptrace is intended to go to UML instead.
Signature · 12 lines
Daniel Jacobowitz ------------------------------------------------------- This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8 _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 3 lines · [email protected] said:
GDB isn't trying to kill UML; it's trying to kill a process that it forked, for the express purpose of figuring out whether certain debug facilities are available on the system.
Ahh, thanks for the clarification.
Jeff
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel