diff options
| author | Chaoren Lin <chaorenl@google.com> | 2015-03-19 23:28:10 +0000 |
|---|---|---|
| committer | Chaoren Lin <chaorenl@google.com> | 2015-03-19 23:28:10 +0000 |
| commit | c16f5dca27c693f934b12c948b7d53e98ce9111d (patch) | |
| tree | 7e0049694785f47b4700df8c65117bf9b06dc56e /lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp | |
| parent | d83003ea59ca5592580fa2e0ef27c3cac907aa8f (diff) | |
| download | llvm-c16f5dca27c693f934b12c948b7d53e98ce9111d.zip llvm-c16f5dca27c693f934b12c948b7d53e98ce9111d.tar.gz llvm-c16f5dca27c693f934b12c948b7d53e98ce9111d.tar.bz2 | |
Report watchpoint hits during single stepping.
Summary:
Reorganized NativeProcessLinux::MonitorSIGTRAP to check for watchpoint hits on
TRAP_TRACE.
Added test for stepping over watchpoints.
https://llvm.org/bugs/show_bug.cgi?id=22814
Reviewers: ovyalov, tberghammer, vharron, clayborg
Subscribers: jingham, labath, lldb-commits
Differential Revision: http://reviews.llvm.org/D8404
llvm-svn: 232784
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp')
| -rw-r--r-- | lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp | 49 |
1 files changed, 10 insertions, 39 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp index 148f55f..51597f8 100644 --- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp @@ -22,6 +22,7 @@ #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/HostNativeThread.h" +#include "lldb/Utility/LLDBAssert.h" #include "lldb/lldb-enumerations.h" #include "llvm/ADT/SmallString.h" @@ -379,53 +380,23 @@ NativeThreadLinux::SetStoppedByBreakpoint () } void -NativeThreadLinux::SetStoppedByWatchpoint () +NativeThreadLinux::SetStoppedByWatchpoint (uint32_t wp_index) { - Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD)); - lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; - if (log) - { - NativeProcessProtocolSP process_sp = m_process_wp.lock (); - if (process_sp) - pid = process_sp->GetID (); - } - const StateType new_state = StateType::eStateStopped; MaybeLogStateChange (new_state); m_state = new_state; - - NativeRegisterContextSP reg_ctx = GetRegisterContext (); - const uint32_t num_hw_watchpoints = reg_ctx->NumSupportedHardwareWatchpoints (); - m_stop_description.clear (); - for (uint32_t wp_index = 0; wp_index < num_hw_watchpoints; ++wp_index) - { - if (reg_ctx->IsWatchpointHit (wp_index).Success()) - { - if (log) - log->Printf ("NativeThreadLinux:%s (pid=%" PRIu64 ", tid=%" PRIu64 ") watchpoint found with idx: %u", - __FUNCTION__, pid, GetID (), wp_index); - - std::ostringstream ostr; - ostr << reg_ctx->GetWatchpointAddress (wp_index) << " " << wp_index; - m_stop_description = ostr.str(); - - m_stop_info.reason = StopReason::eStopReasonWatchpoint; - m_stop_info.details.signal.signo = SIGTRAP; - return; - } - } - // The process reported a watchpoint was hit, but we haven't found the - // watchpoint. Assume that a stopped by trace is reported as a hardware - // watchpoint what happens on some linux kernels (e.g.: android-arm64 - // platfrom-21). + lldbassert(wp_index != LLDB_INVALID_INDEX32 && + "wp_index cannot be invalid"); - if (log) - log->Printf ("NativeThreadLinux:%s (pid=%" PRIu64 ", tid=%" PRIu64 ") none of the watchpoint was hit.", - __FUNCTION__, pid, GetID ()); + std::ostringstream ostr; + ostr << GetRegisterContext()->GetWatchpointAddress(wp_index) << " "; + ostr << wp_index; + m_stop_description = ostr.str(); - SetStoppedByTrace (); + m_stop_info.reason = StopReason::eStopReasonWatchpoint; + m_stop_info.details.signal.signo = SIGTRAP; } bool |
