1 //===-- NativeProcessProtocol.cpp -------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/Host/common/NativeProcessProtocol.h"
11 #include "lldb/Host/Host.h"
12 #include "lldb/Host/common/NativeBreakpointList.h"
13 #include "lldb/Host/common/NativeRegisterContext.h"
14 #include "lldb/Host/common/NativeThreadProtocol.h"
15 #include "lldb/Utility/LLDBAssert.h"
16 #include "lldb/Utility/Log.h"
17 #include "lldb/Utility/State.h"
18 #include "lldb/lldb-enumerations.h"
21 using namespace lldb_private;
23 // -----------------------------------------------------------------------------
24 // NativeProcessProtocol Members
25 // -----------------------------------------------------------------------------
27 NativeProcessProtocol::NativeProcessProtocol(lldb::pid_t pid, int terminal_fd,
28 NativeDelegate &delegate)
29 : m_pid(pid), m_terminal_fd(terminal_fd) {
30 bool registered = RegisterNativeDelegate(delegate);
35 lldb_private::Status NativeProcessProtocol::Interrupt() {
38 error.SetErrorString("local host does not support signaling");
41 return Signal(SIGSTOP);
45 Status NativeProcessProtocol::IgnoreSignals(llvm::ArrayRef<int> signals) {
46 m_signals_to_ignore.clear();
47 m_signals_to_ignore.insert(signals.begin(), signals.end());
52 NativeProcessProtocol::GetMemoryRegionInfo(lldb::addr_t load_addr,
53 MemoryRegionInfo &range_info) {
54 // Default: not implemented.
55 return Status("not implemented");
58 llvm::Optional<WaitStatus> NativeProcessProtocol::GetExitStatus() {
59 if (m_state == lldb::eStateExited)
65 bool NativeProcessProtocol::SetExitStatus(WaitStatus status,
66 bool bNotifyStateChange) {
67 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
68 LLDB_LOG(log, "status = {0}, notify = {1}", status, bNotifyStateChange);
70 // Exit status already set
71 if (m_state == lldb::eStateExited) {
73 LLDB_LOG(log, "exit status already set to {0}", *m_exit_status);
75 LLDB_LOG(log, "state is exited, but status not set");
79 m_state = lldb::eStateExited;
80 m_exit_status = status;
82 if (bNotifyStateChange)
83 SynchronouslyNotifyProcessStateChanged(lldb::eStateExited);
88 NativeThreadProtocol *NativeProcessProtocol::GetThreadAtIndex(uint32_t idx) {
89 std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
90 if (idx < m_threads.size())
91 return m_threads[idx].get();
95 NativeThreadProtocol *
96 NativeProcessProtocol::GetThreadByIDUnlocked(lldb::tid_t tid) {
97 for (const auto &thread : m_threads) {
98 if (thread->GetID() == tid)
104 NativeThreadProtocol *NativeProcessProtocol::GetThreadByID(lldb::tid_t tid) {
105 std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
106 return GetThreadByIDUnlocked(tid);
109 bool NativeProcessProtocol::IsAlive() const {
110 return m_state != eStateDetached && m_state != eStateExited &&
111 m_state != eStateInvalid && m_state != eStateUnloaded;
114 const NativeWatchpointList::WatchpointMap &
115 NativeProcessProtocol::GetWatchpointMap() const {
116 return m_watchpoint_list.GetWatchpointMap();
119 llvm::Optional<std::pair<uint32_t, uint32_t>>
120 NativeProcessProtocol::GetHardwareDebugSupportInfo() const {
121 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
124 NativeThreadProtocol *thread(
125 const_cast<NativeProcessProtocol *>(this)->GetThreadAtIndex(0));
127 LLDB_LOG(log, "failed to find a thread to grab a NativeRegisterContext!");
131 NativeRegisterContext ®_ctx = thread->GetRegisterContext();
132 return std::make_pair(reg_ctx.NumSupportedHardwareBreakpoints(),
133 reg_ctx.NumSupportedHardwareWatchpoints());
136 Status NativeProcessProtocol::SetWatchpoint(lldb::addr_t addr, size_t size,
137 uint32_t watch_flags,
139 // This default implementation assumes setting the watchpoint for the process
140 // will require setting the watchpoint for each of the threads. Furthermore,
141 // it will track watchpoints set for the process and will add them to each
142 // thread that is attached to via the (FIXME implement) OnThreadAttached ()
145 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
147 // Update the thread list
150 // Keep track of the threads we successfully set the watchpoint for. If one
151 // of the thread watchpoint setting operations fails, back off and remove the
152 // watchpoint for all the threads that were successfully set so we get back
153 // to a consistent state.
154 std::vector<NativeThreadProtocol *> watchpoint_established_threads;
156 // Tell each thread to set a watchpoint. In the event that hardware
157 // watchpoints are requested but the SetWatchpoint fails, try to set a
158 // software watchpoint as a fallback. It's conceivable that if there are
159 // more threads than hardware watchpoints available, some of the threads will
160 // fail to set hardware watchpoints while software ones may be available.
161 std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
162 for (const auto &thread : m_threads) {
163 assert(thread && "thread list should not have a NULL thread!");
165 Status thread_error =
166 thread->SetWatchpoint(addr, size, watch_flags, hardware);
167 if (thread_error.Fail() && hardware) {
168 // Try software watchpoints since we failed on hardware watchpoint
169 // setting and we may have just run out of hardware watchpoints.
170 thread_error = thread->SetWatchpoint(addr, size, watch_flags, false);
171 if (thread_error.Success())
173 "hardware watchpoint requested but software watchpoint set");
176 if (thread_error.Success()) {
177 // Remember that we set this watchpoint successfully in case we need to
179 watchpoint_established_threads.push_back(thread.get());
181 // Unset the watchpoint for each thread we successfully set so that we
182 // get back to a consistent state of "not set" for the watchpoint.
183 for (auto unwatch_thread_sp : watchpoint_established_threads) {
184 Status remove_error = unwatch_thread_sp->RemoveWatchpoint(addr);
185 if (remove_error.Fail())
186 LLDB_LOG(log, "RemoveWatchpoint failed for pid={0}, tid={1}: {2}",
187 GetID(), unwatch_thread_sp->GetID(), remove_error);
193 return m_watchpoint_list.Add(addr, size, watch_flags, hardware);
196 Status NativeProcessProtocol::RemoveWatchpoint(lldb::addr_t addr) {
197 // Update the thread list
200 Status overall_error;
202 std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
203 for (const auto &thread : m_threads) {
204 assert(thread && "thread list should not have a NULL thread!");
206 const Status thread_error = thread->RemoveWatchpoint(addr);
207 if (thread_error.Fail()) {
208 // Keep track of the first thread error if any threads fail. We want to
209 // try to remove the watchpoint from every thread, though, even if one or
211 if (!overall_error.Fail())
212 overall_error = thread_error;
215 const Status error = m_watchpoint_list.Remove(addr);
216 return overall_error.Fail() ? overall_error : error;
219 const HardwareBreakpointMap &
220 NativeProcessProtocol::GetHardwareBreakpointMap() const {
221 return m_hw_breakpoints_map;
224 Status NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr,
226 // This default implementation assumes setting a hardware breakpoint for this
227 // process will require setting same hardware breakpoint for each of its
228 // existing threads. New thread will do the same once created.
229 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
231 // Update the thread list
234 // Exit here if target does not have required hardware breakpoint capability.
235 auto hw_debug_cap = GetHardwareDebugSupportInfo();
237 if (hw_debug_cap == llvm::None || hw_debug_cap->first == 0 ||
238 hw_debug_cap->first <= m_hw_breakpoints_map.size())
239 return Status("Target does not have required no of hardware breakpoints");
241 // Vector below stores all thread pointer for which we have we successfully
242 // set this hardware breakpoint. If any of the current process threads fails
243 // to set this hardware breakpoint then roll back and remove this breakpoint
244 // for all the threads that had already set it successfully.
245 std::vector<NativeThreadProtocol *> breakpoint_established_threads;
247 // Request to set a hardware breakpoint for each of current process threads.
248 std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
249 for (const auto &thread : m_threads) {
250 assert(thread && "thread list should not have a NULL thread!");
252 Status thread_error = thread->SetHardwareBreakpoint(addr, size);
253 if (thread_error.Success()) {
254 // Remember that we set this breakpoint successfully in case we need to
256 breakpoint_established_threads.push_back(thread.get());
258 // Unset the breakpoint for each thread we successfully set so that we
259 // get back to a consistent state of "not set" for this hardware
261 for (auto rollback_thread_sp : breakpoint_established_threads) {
262 Status remove_error =
263 rollback_thread_sp->RemoveHardwareBreakpoint(addr);
264 if (remove_error.Fail())
266 "RemoveHardwareBreakpoint failed for pid={0}, tid={1}: {2}",
267 GetID(), rollback_thread_sp->GetID(), remove_error);
274 // Register new hardware breakpoint into hardware breakpoints map of current
276 m_hw_breakpoints_map[addr] = {addr, size};
281 Status NativeProcessProtocol::RemoveHardwareBreakpoint(lldb::addr_t addr) {
282 // Update the thread list
287 std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
288 for (const auto &thread : m_threads) {
289 assert(thread && "thread list should not have a NULL thread!");
290 error = thread->RemoveHardwareBreakpoint(addr);
293 // Also remove from hardware breakpoint map of current process.
294 m_hw_breakpoints_map.erase(addr);
299 bool NativeProcessProtocol::RegisterNativeDelegate(
300 NativeDelegate &native_delegate) {
301 std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
302 if (std::find(m_delegates.begin(), m_delegates.end(), &native_delegate) !=
306 m_delegates.push_back(&native_delegate);
307 native_delegate.InitializeDelegate(this);
311 bool NativeProcessProtocol::UnregisterNativeDelegate(
312 NativeDelegate &native_delegate) {
313 std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
315 const auto initial_size = m_delegates.size();
317 remove(m_delegates.begin(), m_delegates.end(), &native_delegate),
320 // We removed the delegate if the count of delegates shrank after removing
321 // all copies of the given native_delegate from the vector.
322 return m_delegates.size() < initial_size;
325 void NativeProcessProtocol::SynchronouslyNotifyProcessStateChanged(
326 lldb::StateType state) {
327 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
329 std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
330 for (auto native_delegate : m_delegates)
331 native_delegate->ProcessStateChanged(this, state);
334 if (!m_delegates.empty()) {
335 log->Printf("NativeProcessProtocol::%s: sent state notification [%s] "
336 "from process %" PRIu64,
337 __FUNCTION__, lldb_private::StateAsCString(state), GetID());
339 log->Printf("NativeProcessProtocol::%s: would send state notification "
340 "[%s] from process %" PRIu64 ", but no delegates",
341 __FUNCTION__, lldb_private::StateAsCString(state), GetID());
346 void NativeProcessProtocol::NotifyDidExec() {
347 Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
349 log->Printf("NativeProcessProtocol::%s - preparing to call delegates",
353 std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
354 for (auto native_delegate : m_delegates)
355 native_delegate->DidExec(this);
359 Status NativeProcessProtocol::SetSoftwareBreakpoint(lldb::addr_t addr,
360 uint32_t size_hint) {
361 Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
362 LLDB_LOG(log, "addr = {0:x}, size_hint = {1}", addr, size_hint);
364 auto it = m_software_breakpoints.find(addr);
365 if (it != m_software_breakpoints.end()) {
366 ++it->second.ref_count;
369 auto expected_bkpt = EnableSoftwareBreakpoint(addr, size_hint);
371 return Status(expected_bkpt.takeError());
373 m_software_breakpoints.emplace(addr, std::move(*expected_bkpt));
377 Status NativeProcessProtocol::RemoveSoftwareBreakpoint(lldb::addr_t addr) {
378 Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
379 LLDB_LOG(log, "addr = {0:x}", addr);
380 auto it = m_software_breakpoints.find(addr);
381 if (it == m_software_breakpoints.end())
382 return Status("Breakpoint not found.");
383 assert(it->second.ref_count > 0);
384 if (--it->second.ref_count > 0)
387 // This is the last reference. Let's remove the breakpoint.
390 // Clear a software breakpoint instruction
391 llvm::SmallVector<uint8_t, 4> curr_break_op(
392 it->second.breakpoint_opcodes.size(), 0);
394 // Read the breakpoint opcode
395 size_t bytes_read = 0;
397 ReadMemory(addr, curr_break_op.data(), curr_break_op.size(), bytes_read);
398 if (error.Fail() || bytes_read < curr_break_op.size()) {
399 return Status("addr=0x%" PRIx64
400 ": tried to read %zu bytes but only read %zu",
401 addr, curr_break_op.size(), bytes_read);
403 const auto &saved = it->second.saved_opcodes;
404 // Make sure the breakpoint opcode exists at this address
405 if (makeArrayRef(curr_break_op) != it->second.breakpoint_opcodes) {
406 if (curr_break_op != it->second.saved_opcodes)
407 return Status("Original breakpoint trap is no longer in memory.");
409 "Saved opcodes ({0:@[x]}) have already been restored at {1:x}.",
410 llvm::make_range(saved.begin(), saved.end()), addr);
412 // We found a valid breakpoint opcode at this address, now restore the
414 size_t bytes_written = 0;
415 error = WriteMemory(addr, saved.data(), saved.size(), bytes_written);
416 if (error.Fail() || bytes_written < saved.size()) {
417 return Status("addr=0x%" PRIx64
418 ": tried to write %zu bytes but only wrote %zu",
419 addr, saved.size(), bytes_written);
422 // Verify that our original opcode made it back to the inferior
423 llvm::SmallVector<uint8_t, 4> verify_opcode(saved.size(), 0);
424 size_t verify_bytes_read = 0;
425 error = ReadMemory(addr, verify_opcode.data(), verify_opcode.size(),
427 if (error.Fail() || verify_bytes_read < verify_opcode.size()) {
428 return Status("addr=0x%" PRIx64
429 ": tried to read %zu verification bytes but only read %zu",
430 addr, verify_opcode.size(), verify_bytes_read);
432 if (verify_opcode != saved)
433 LLDB_LOG(log, "Restoring bytes at {0:x}: {1:@[x]}", addr,
434 llvm::make_range(saved.begin(), saved.end()));
437 m_software_breakpoints.erase(it);
441 llvm::Expected<NativeProcessProtocol::SoftwareBreakpoint>
442 NativeProcessProtocol::EnableSoftwareBreakpoint(lldb::addr_t addr,
443 uint32_t size_hint) {
444 Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
446 auto expected_trap = GetSoftwareBreakpointTrapOpcode(size_hint);
448 return expected_trap.takeError();
450 llvm::SmallVector<uint8_t, 4> saved_opcode_bytes(expected_trap->size(), 0);
451 // Save the original opcodes by reading them so we can restore later.
452 size_t bytes_read = 0;
453 Status error = ReadMemory(addr, saved_opcode_bytes.data(),
454 saved_opcode_bytes.size(), bytes_read);
456 return error.ToError();
458 // Ensure we read as many bytes as we expected.
459 if (bytes_read != saved_opcode_bytes.size()) {
460 return llvm::createStringError(
461 llvm::inconvertibleErrorCode(),
462 "Failed to read memory while attempting to set breakpoint: attempted "
463 "to read {0} bytes but only read {1}.",
464 saved_opcode_bytes.size(), bytes_read);
468 log, "Overwriting bytes at {0:x}: {1:@[x]}", addr,
469 llvm::make_range(saved_opcode_bytes.begin(), saved_opcode_bytes.end()));
471 // Write a software breakpoint in place of the original opcode.
472 size_t bytes_written = 0;
473 error = WriteMemory(addr, expected_trap->data(), expected_trap->size(),
476 return error.ToError();
478 // Ensure we wrote as many bytes as we expected.
479 if (bytes_written != expected_trap->size()) {
480 return llvm::createStringError(
481 llvm::inconvertibleErrorCode(),
482 "Failed write memory while attempting to set "
483 "breakpoint: attempted to write {0} bytes but only wrote {1}",
484 expected_trap->size(), bytes_written);
487 llvm::SmallVector<uint8_t, 4> verify_bp_opcode_bytes(expected_trap->size(),
489 size_t verify_bytes_read = 0;
490 error = ReadMemory(addr, verify_bp_opcode_bytes.data(),
491 verify_bp_opcode_bytes.size(), verify_bytes_read);
493 return error.ToError();
495 // Ensure we read as many verification bytes as we expected.
496 if (verify_bytes_read != verify_bp_opcode_bytes.size()) {
497 return llvm::createStringError(
498 llvm::inconvertibleErrorCode(),
499 "Failed to read memory while "
500 "attempting to verify breakpoint: attempted to read {0} bytes "
502 verify_bp_opcode_bytes.size(), verify_bytes_read);
505 if (llvm::makeArrayRef(verify_bp_opcode_bytes.data(), verify_bytes_read) !=
507 return llvm::createStringError(
508 llvm::inconvertibleErrorCode(),
509 "Verification of software breakpoint "
510 "writing failed - trap opcodes not successfully read back "
511 "after writing when setting breakpoint at {0:x}",
515 LLDB_LOG(log, "addr = {0:x}: SUCCESS", addr);
516 return SoftwareBreakpoint{1, saved_opcode_bytes, *expected_trap};
519 llvm::Expected<llvm::ArrayRef<uint8_t>>
520 NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode(size_t size_hint) {
521 static const uint8_t g_aarch64_opcode[] = {0x00, 0x00, 0x20, 0xd4};
522 static const uint8_t g_i386_opcode[] = {0xCC};
523 static const uint8_t g_mips64_opcode[] = {0x00, 0x00, 0x00, 0x0d};
524 static const uint8_t g_mips64el_opcode[] = {0x0d, 0x00, 0x00, 0x00};
525 static const uint8_t g_s390x_opcode[] = {0x00, 0x01};
526 static const uint8_t g_ppc64le_opcode[] = {0x08, 0x00, 0xe0, 0x7f}; // trap
528 switch (GetArchitecture().GetMachine()) {
529 case llvm::Triple::aarch64:
530 return llvm::makeArrayRef(g_aarch64_opcode);
532 case llvm::Triple::x86:
533 case llvm::Triple::x86_64:
534 return llvm::makeArrayRef(g_i386_opcode);
536 case llvm::Triple::mips:
537 case llvm::Triple::mips64:
538 return llvm::makeArrayRef(g_mips64_opcode);
540 case llvm::Triple::mipsel:
541 case llvm::Triple::mips64el:
542 return llvm::makeArrayRef(g_mips64el_opcode);
544 case llvm::Triple::systemz:
545 return llvm::makeArrayRef(g_s390x_opcode);
547 case llvm::Triple::ppc64le:
548 return llvm::makeArrayRef(g_ppc64le_opcode);
551 return llvm::createStringError(llvm::inconvertibleErrorCode(),
552 "CPU type not supported!");
556 size_t NativeProcessProtocol::GetSoftwareBreakpointPCOffset() {
557 switch (GetArchitecture().GetMachine()) {
558 case llvm::Triple::x86:
559 case llvm::Triple::x86_64:
560 case llvm::Triple::systemz:
561 // These architectures report increment the PC after breakpoint is hit.
562 return cantFail(GetSoftwareBreakpointTrapOpcode(0)).size();
564 case llvm::Triple::arm:
565 case llvm::Triple::aarch64:
566 case llvm::Triple::mips64:
567 case llvm::Triple::mips64el:
568 case llvm::Triple::mips:
569 case llvm::Triple::mipsel:
570 case llvm::Triple::ppc64le:
571 // On these architectures the PC doesn't get updated for breakpoint hits.
575 llvm_unreachable("CPU type not supported!");
579 void NativeProcessProtocol::FixupBreakpointPCAsNeeded(
580 NativeThreadProtocol &thread) {
581 Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS);
585 // Find out the size of a breakpoint (might depend on where we are in the
587 NativeRegisterContext &context = thread.GetRegisterContext();
589 uint32_t breakpoint_size = GetSoftwareBreakpointPCOffset();
590 LLDB_LOG(log, "breakpoint size: {0}", breakpoint_size);
591 if (breakpoint_size == 0)
594 // First try probing for a breakpoint at a software breakpoint location: PC -
596 const lldb::addr_t initial_pc_addr = context.GetPCfromBreakpointLocation();
597 lldb::addr_t breakpoint_addr = initial_pc_addr;
598 // Do not allow breakpoint probe to wrap around.
599 if (breakpoint_addr >= breakpoint_size)
600 breakpoint_addr -= breakpoint_size;
602 if (m_software_breakpoints.count(breakpoint_addr) == 0) {
603 // We didn't find one at a software probe location. Nothing to do.
605 "pid {0} no lldb software breakpoint found at current pc with "
607 GetID(), breakpoint_addr);
612 // We have a software breakpoint and need to adjust the PC.
615 // Change the program counter.
616 LLDB_LOG(log, "pid {0} tid {1}: changing PC from {2:x} to {3:x}", GetID(),
617 thread.GetID(), initial_pc_addr, breakpoint_addr);
619 error = context.SetPC(breakpoint_addr);
621 // This can happen in case the process was killed between the time we read
622 // the PC and when we are updating it. There's nothing better to do than to
623 // swallow the error.
624 LLDB_LOG(log, "pid {0} tid {1}: failed to set PC: {2}", GetID(),
625 thread.GetID(), error);
629 Status NativeProcessProtocol::RemoveBreakpoint(lldb::addr_t addr,
632 return RemoveHardwareBreakpoint(addr);
634 return RemoveSoftwareBreakpoint(addr);
637 Status NativeProcessProtocol::ReadMemoryWithoutTrap(lldb::addr_t addr,
638 void *buf, size_t size,
639 size_t &bytes_read) {
640 Status error = ReadMemory(addr, buf, size, bytes_read);
645 llvm::makeMutableArrayRef(static_cast<uint8_t *>(buf), bytes_read);
646 for (const auto &pair : m_software_breakpoints) {
647 lldb::addr_t bp_addr = pair.first;
648 auto saved_opcodes = makeArrayRef(pair.second.saved_opcodes);
650 if (bp_addr + saved_opcodes.size() < addr || addr + bytes_read <= bp_addr)
651 continue; // Breapoint not in range, ignore
653 if (bp_addr < addr) {
654 saved_opcodes = saved_opcodes.drop_front(addr - bp_addr);
657 auto bp_data = data.drop_front(bp_addr - addr);
658 std::copy_n(saved_opcodes.begin(),
659 std::min(saved_opcodes.size(), bp_data.size()),
665 lldb::StateType NativeProcessProtocol::GetState() const {
666 std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
670 void NativeProcessProtocol::SetState(lldb::StateType state,
671 bool notify_delegates) {
672 std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
674 if (state == m_state)
679 if (StateIsStoppedState(state, false)) {
682 // Give process a chance to do any stop id bump processing, such as
683 // clearing cached data that is invalidated each time the process runs.
684 // Note if/when we support some threads running, we'll end up needing to
685 // manage this per thread and per process.
686 DoStopIDBumped(m_stop_id);
689 // Optionally notify delegates of the state change.
690 if (notify_delegates)
691 SynchronouslyNotifyProcessStateChanged(state);
694 uint32_t NativeProcessProtocol::GetStopID() const {
695 std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
699 void NativeProcessProtocol::DoStopIDBumped(uint32_t /* newBumpId */) {
700 // Default implementation does nothing.
703 NativeProcessProtocol::Factory::~Factory() = default;