[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-22 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment. I'm certainly not planning to put any obstacles to full multiprocess debugging in the future, and I'm going to try to pave the way for it whenever possible. One thing I'm considering right now is adding some support for tracking additional `NativeProcess*` instances to L

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-22 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment. In D98822#2640881 , @labath wrote: > In D98822#2637871 , @jingham wrote: > >> The gdb model - since gdb only supports one debugee per gdb - is to either >> follow the fork or follow the par

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment. In D98822#2637871 , @jingham wrote: > The gdb model - since gdb only supports one debugee per gdb - is to either > follow the fork or follow the parent. It would be more in keeping with > lldb's model to make a new target for the

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-20 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 332086. mgorny added a comment. Generalize the waiting function and use it for forks as well. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98822/new/ https://reviews.llvm.org/D98822 Files: lldb/include/lldb/Host/common/NativeProcessProtocol.h l

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-19 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 332013. mgorny added a comment. Add a super-trivial test that the debugger doesn't lose parent after the fork. Next on the list: clear software breakpoints in the detached fork. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98822/new/ https://review

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-19 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment. In D98822#2637871 , @jingham wrote: > The gdb model - since gdb only supports one debugee per gdb - is to either > follow the fork or follow the parent. It would be more in keeping with > lldb's model to make a new target for the

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-19 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 331982. mgorny added a comment. Now using the new thingie for threads. `getTIDForPID()` temporarily commented out but I plan to use it to distinguish `clone()` for new thread from `clone()` for new process. CHANGES SINCE LAST ACTION https://reviews.llvm.o

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-19 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment. The gdb model - since gdb only supports one debugee per gdb - is to either follow the fork or follow the parent. It would be more in keeping with lldb's model to make a new target for the child side of the fork, and use that to follow the child. That way you can conti

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-19 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 331846. mgorny added a comment. Fix typo: qSupported needs to be joined using `;`, not `,`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98822/new/ https://reviews.llvm.org/D98822 Files: lldb/include/lldb/Host/common/NativeProcessProtocol.h lld

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-19 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 331824. mgorny marked 3 inline comments as done. mgorny added a comment. Switched `Extension` to bitmask-enum, fixed prototype and decl for `getPIDForTID` and switched server features into a virtual as suggested by @labath. CHANGES SINCE LAST ACTION https

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-18 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 331688. mgorny added a comment. Actually wait for two signals. Store the extra info on parent signal, and use it when handling the fork. For now, the handler just detaches the child and resumes the parent. CHANGES SINCE LAST ACTION https://reviews.llvm.or

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-18 Thread Michał Górny via Phabricator via lldb-commits
mgorny added inline comments. Comment at: lldb/include/lldb/Host/common/NativeProcessProtocol.h:401-404 + struct Extension { +static constexpr uint32_t fork = 1; +static constexpr uint32_t vfork = 2; + }; labath wrote: > The llvm way to do this is via a

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-18 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment. In D98822#2635647 , @labath wrote: > Seems mostly ok. The getPidForTid business does not seem completely ideal, > though. I think it may be cleaner to keep the threads for which we have > received the creation event in some kind o

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-18 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment. Seems mostly ok. The getPidForTid business does not seem completely ideal, though. I think it may be cleaner to keep the threads for which we have received the creation event in some kind of a purgatory list until we receive the corresponding parent event (which will cla

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-18 Thread Michał Górny via Phabricator via lldb-commits
mgorny added inline comments. Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:456 + LLDB_LOG(log, "tid {0} belongs to a different tgid {1}, assuming child", + pid, tgid.getValue()); + MonitorFork(pid, false, 0); For so

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-18 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 331609. mgorny added a comment. Add a helper function to get PID (TGID) from TID. Recognize fork notifications from parent (SIGTRAP) and from child (SIGSTOP with a TGID != `GetID()`) and call a helper for them. The helper doesn't do anything except for loggin

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-17 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 331417. mgorny added a comment. Added option setting to the Linux plugin. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98822/new/ https://reviews.llvm.org/D98822 Files: lldb/include/lldb/Host/common/NativeProcessProtocol.h lldb/packages/Python/

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-17 Thread Michał Górny via Phabricator via lldb-commits
mgorny added inline comments. Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:2026 +llvm::Error NativeProcessLinux::SetEnabledExtensions(uint32_t flags) { + return llvm::createStringError(llvm::inconvertibleErrorCode(), + "Not

[Lldb-commits] [PATCH] D98822: [lldb] follow-fork/vfork support [WIP]

2021-03-17 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision. mgorny added reviewers: labath, emaste, krytarowski. mgorny requested review of this revision. So far no real meat yet, just taking the API for a test drive. https://reviews.llvm.org/D98822 Files: lldb/include/lldb/Host/common/NativeProcessProtocol.h lldb/packa