Enable reporting fork/vfork events to the server when supported.
At this moment, this is used only to test the server code, as real
client does not report fork-events and vfork-events as supported.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This is the final piece for moving minimal fork/vfork support to gdb-remote protocol. However, for some reason (unlike the original code in D99864), it crashes on random assertions about m_enabled_extensions value — probably memory corruption somewhere. I'm debugging it.
Copy software breakpoints to the forked process, to future-proof this patch for breakpoint support (I suppose there's no point in splitting it more).
Add GetSupportedExtensions() to actually enable the new code.
Rebase. Store mainloop arg of the original process, and pass it to the children to make them independent of the 'main' process.
Now includes lldb-server tests.
@labath, please let me know if I should merge this with previous patches, or if it's fine to commit in split.
This seems reasonable.
Why don't we have tests that detach from the parent process (and maybe continue the child)? Does that already work? (or in general, what is expected to work after this patch?)
lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | ||
---|---|---|
932 | Store directly into unique_ptr<NativeProcessLinux> above. | |
938–940 | I'd consider merging the two functions into SetStoppedByFork(is_vfork, child_pid) | |
lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp | ||
401–402 | duplicated | |
409–410 | ditto | |
lldb/test/API/tools/lldb-server/main.cpp | ||
322–327 ↗ | (On Diff #339257) | I guess these would need to be ifdefed too. |
Note that you don't actually have to use/extend this particular inferior for these tests. Feel free to create special purpose inferiors, if that's a better fit for the test, just like we do with "normal" tests...
It doesn't, we need D100261 for that. Right now current_process will become nullptr if we detach the parent.
That said, technically we could test that after detaching the parent we get an error from other requests ;-).
Implemented all the requests, modulo claim that PID and TID are duplicate ;-). Also found cases for bool() with Extension stuff.
I think that's a good thing to test, though I suppose it could also be a part of the Hg patch.
lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp | ||
---|---|---|
402–403 | Still duplicated. :) |
lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp | ||
---|---|---|
402–403 | I'm confused. Maybe you're not noticing the tiny one-letter difference, i.e. pid vs tid? ;-) Linux is the only target where both are equal and the stop info needs to be generic, so that other platforms can assign distinct pid and tid. |
Add multiprocess to supported features.
Tests were moved to earlier commit. Now this commit only enables the relevant category.
Store directly into unique_ptr<NativeProcessLinux> above.