aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorMichał Górny <mgorny@moritz.systems>2022-07-18 17:54:31 +0200
committerMichał Górny <mgorny@moritz.systems>2022-07-21 17:11:38 +0200
commitb61b8efcf31b3d53377b9cf6cb3eb87742602ff6 (patch)
tree0b5d4f902104b2f18ec2ac72023d3fa2cd564a3e /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parent5d8a76feb02ff3db5e25b9c5a8edff49e750f7fb (diff)
downloadllvm-b61b8efcf31b3d53377b9cf6cb3eb87742602ff6.zip
llvm-b61b8efcf31b3d53377b9cf6cb3eb87742602ff6.tar.gz
llvm-b61b8efcf31b3d53377b9cf6cb3eb87742602ff6.tar.bz2
[lldb] [gdb-remote] Fix process ID after following forked child
Update the process ID after handling fork/vfork to ensure that the process plugin reports the correct PID immediately. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D130037
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index fe6a3f9..5f18706 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -5307,8 +5307,11 @@ void ProcessGDBRemote::DidFork(lldb::pid_t child_pid, lldb::tid_t child_tid) {
// Hardware breakpoints/watchpoints are not inherited implicitly,
// so we need to readd them if we're following child.
- if (GetFollowForkMode() == eFollowChild)
+ if (GetFollowForkMode() == eFollowChild) {
DidForkSwitchHardwareTraps(true);
+ // Update our PID
+ SetID(child_pid);
+ }
}
void ProcessGDBRemote::DidVFork(lldb::pid_t child_pid, lldb::tid_t child_tid) {
@@ -5361,6 +5364,11 @@ void ProcessGDBRemote::DidVFork(lldb::pid_t child_pid, lldb::tid_t child_tid) {
error.AsCString() ? error.AsCString() : "<unknown error>");
return;
}
+
+ if (GetFollowForkMode() == eFollowChild) {
+ // Update our PID
+ SetID(child_pid);
+ }
}
void ProcessGDBRemote::DidVForkDone() {