diff options
| author | Hafiz Abid Qadeer <hafiz_abid@mentor.com> | 2013-10-18 10:04:33 +0000 |
|---|---|---|
| committer | Hafiz Abid Qadeer <hafiz_abid@mentor.com> | 2013-10-18 10:04:33 +0000 |
| commit | 85a4daf4f609e28a075696ab0738f0e9728335ae (patch) | |
| tree | dbf80e1744aba79dc376cce565b153e932d921fe /lldb/source/Plugins/Process/gdb-remote | |
| parent | eb4003651d97066c55a23cd5fc5d8356beda0de7 (diff) | |
| download | bcm5719-llvm-85a4daf4f609e28a075696ab0738f0e9728335ae.tar.gz bcm5719-llvm-85a4daf4f609e28a075696ab0738f0e9728335ae.zip | |
Adjust PC after hitting breakpoint on remote target.
This commit adds an example python file that can be used with 'target-definition-file' setting for Linux gdbserver.
This file has an extra key 'breakpoint-pc-offset' that LLDB uses to determine how much to change the PC
after hitting the breakpoint.
llvm-svn: 192962
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
| -rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 9 | ||||
| -rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 0f5f8903799..d611aede984 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -271,7 +271,8 @@ ProcessGDBRemote::ProcessGDBRemote(Target& target, Listener &listener) : m_thread_create_bp_sp (), m_waiting_for_attach (false), m_destroy_tried_resuming (false), - m_command_sp () + m_command_sp (), + m_breakpoint_pc_offset (0) { m_async_broadcaster.SetEventName (eBroadcastBitAsyncThreadShouldExit, "async thread should exit"); m_async_broadcaster.SetEventName (eBroadcastBitAsyncContinue, "async thread continue"); @@ -344,6 +345,8 @@ ProcessGDBRemote::ParsePythonTargetDefinition(const FileSpec &target_definition_ } } + m_breakpoint_pc_offset = target_dict.GetItemForKeyAsInteger("breakpoint-pc-offset", 0); + if (m_register_info.SetRegisterInfo (target_dict, GetTarget().GetArchitecture().GetByteOrder()) > 0) { return true; @@ -1722,7 +1725,7 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) // Currently we are going to assume SIGTRAP means we are either // hitting a breakpoint or hardware single stepping. handled = true; - addr_t pc = thread_sp->GetRegisterContext()->GetPC(); + addr_t pc = thread_sp->GetRegisterContext()->GetPC() + m_breakpoint_pc_offset; lldb::BreakpointSiteSP bp_site_sp = thread_sp->GetProcess()->GetBreakpointSiteList().FindByAddress(pc); if (bp_site_sp) @@ -1732,6 +1735,8 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) // will be taken care of when the thread resumes and notices that there's a breakpoint under the pc. if (bp_site_sp->ValidForThisThread (thread_sp.get())) { + if(m_breakpoint_pc_offset != 0) + thread_sp->GetRegisterContext()->SetPC(pc); thread_sp->SetStopInfo (StopInfo::CreateStopReasonWithBreakpointSiteID (*thread_sp, bp_site_sp->GetID())); } else diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index 86f051040a8..b18ac5b1723 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -338,6 +338,7 @@ protected: bool m_waiting_for_attach; bool m_destroy_tried_resuming; lldb::CommandObjectSP m_command_sp; + int64_t m_breakpoint_pc_offset; bool StartAsyncThread (); |

