aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/Host/common/NativeProcessProtocol.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2022-07-04 19:20:19 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-02-08 19:02:26 +0000
commit81ad626541db97eb356e2c1d4a20eb2a26a766ab (patch)
tree311b6a8987c32b1e1dcbab65c54cfac3fdb56175 /contrib/llvm-project/lldb/source/Host/common/NativeProcessProtocol.cpp
parent5fff09660e06a66bed6482da9c70df328e16bbb6 (diff)
parent145449b1e420787bb99721a429341fa6be3adfb6 (diff)
Diffstat (limited to 'contrib/llvm-project/lldb/source/Host/common/NativeProcessProtocol.cpp')
-rw-r--r--contrib/llvm-project/lldb/source/Host/common/NativeProcessProtocol.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/contrib/llvm-project/lldb/source/Host/common/NativeProcessProtocol.cpp b/contrib/llvm-project/lldb/source/Host/common/NativeProcessProtocol.cpp
index ea80a05430f7..be521a31cb37 100644
--- a/contrib/llvm-project/lldb/source/Host/common/NativeProcessProtocol.cpp
+++ b/contrib/llvm-project/lldb/source/Host/common/NativeProcessProtocol.cpp
@@ -12,6 +12,7 @@
#include "lldb/Host/common/NativeRegisterContext.h"
#include "lldb/Host/common/NativeThreadProtocol.h"
#include "lldb/Utility/LLDBAssert.h"
+#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/State.h"
#include "lldb/lldb-enumerations.h"
@@ -74,7 +75,7 @@ llvm::Optional<WaitStatus> NativeProcessProtocol::GetExitStatus() {
bool NativeProcessProtocol::SetExitStatus(WaitStatus status,
bool bNotifyStateChange) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+ Log *log = GetLog(LLDBLog::Process);
LLDB_LOG(log, "status = {0}, notify = {1}", status, bNotifyStateChange);
// Exit status already set
@@ -128,7 +129,7 @@ NativeProcessProtocol::GetWatchpointMap() const {
llvm::Optional<std::pair<uint32_t, uint32_t>>
NativeProcessProtocol::GetHardwareDebugSupportInfo() const {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+ Log *log = GetLog(LLDBLog::Process);
// get any thread
NativeThreadProtocol *thread(
@@ -152,7 +153,7 @@ Status NativeProcessProtocol::SetWatchpoint(lldb::addr_t addr, size_t size,
// thread that is attached to via the (FIXME implement) OnThreadAttached ()
// method.
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+ Log *log = GetLog(LLDBLog::Process);
// Update the thread list
UpdateThreads();
@@ -236,7 +237,7 @@ Status NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr,
// This default implementation assumes setting a hardware breakpoint for this
// process will require setting same hardware breakpoint for each of its
// existing threads. New thread will do the same once created.
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+ Log *log = GetLog(LLDBLog::Process);
// Update the thread list
UpdateThreads();
@@ -308,24 +309,36 @@ Status NativeProcessProtocol::RemoveHardwareBreakpoint(lldb::addr_t addr) {
void NativeProcessProtocol::SynchronouslyNotifyProcessStateChanged(
lldb::StateType state) {
- Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+ Log *log = GetLog(LLDBLog::Process);
m_delegate.ProcessStateChanged(this, state);
+ switch (state) {
+ case eStateStopped:
+ case eStateExited:
+ case eStateCrashed:
+ NotifyTracersProcessDidStop();
+ break;
+ default:
+ break;
+ }
+
LLDB_LOG(log, "sent state notification [{0}] from process {1}", state,
GetID());
}
void NativeProcessProtocol::NotifyDidExec() {
- Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+ Log *log = GetLog(LLDBLog::Process);
LLDB_LOG(log, "process {0} exec()ed", GetID());
+ m_software_breakpoints.clear();
+
m_delegate.DidExec(this);
}
Status NativeProcessProtocol::SetSoftwareBreakpoint(lldb::addr_t addr,
uint32_t size_hint) {
- Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
+ Log *log = GetLog(LLDBLog::Breakpoints);
LLDB_LOG(log, "addr = {0:x}, size_hint = {1}", addr, size_hint);
auto it = m_software_breakpoints.find(addr);
@@ -342,7 +355,7 @@ Status NativeProcessProtocol::SetSoftwareBreakpoint(lldb::addr_t addr,
}
Status NativeProcessProtocol::RemoveSoftwareBreakpoint(lldb::addr_t addr) {
- Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
+ Log *log = GetLog(LLDBLog::Breakpoints);
LLDB_LOG(log, "addr = {0:x}", addr);
auto it = m_software_breakpoints.find(addr);
if (it == m_software_breakpoints.end())
@@ -408,7 +421,7 @@ Status NativeProcessProtocol::RemoveSoftwareBreakpoint(lldb::addr_t addr) {
llvm::Expected<NativeProcessProtocol::SoftwareBreakpoint>
NativeProcessProtocol::EnableSoftwareBreakpoint(lldb::addr_t addr,
uint32_t size_hint) {
- Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
+ Log *log = GetLog(LLDBLog::Breakpoints);
auto expected_trap = GetSoftwareBreakpointTrapOpcode(size_hint);
if (!expected_trap)
@@ -554,7 +567,7 @@ size_t NativeProcessProtocol::GetSoftwareBreakpointPCOffset() {
void NativeProcessProtocol::FixupBreakpointPCAsNeeded(
NativeThreadProtocol &thread) {
- Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS);
+ Log *log = GetLog(LLDBLog::Breakpoints);
Status error;