[Lldb-commits] [lldb] r186458 - Fix Rendezvous breakpoint to only be set once, resolve addr in BreakpointLocationList::FindByAddress
Michael Sartain
mikesart at valvesoftware.com
Tue Jul 16 14:22:53 PDT 2013
Author: mikesart
Date: Tue Jul 16 16:22:53 2013
New Revision: 186458
URL: http://llvm.org/viewvc/llvm-project?rev=186458&view=rev
Log:
Fix Rendezvous breakpoint to only be set once, resolve addr in BreakpointLocationList::FindByAddress
Differential Revision: http://llvm-reviews.chandlerc.com/D1145
Modified:
lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp
lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
Modified: lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp?rev=186458&r1=186457&r2=186458&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp Tue Jul 16 16:22:53 2013
@@ -14,7 +14,9 @@
// Project includes
#include "lldb/Breakpoint/BreakpointLocationList.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Core/Section.h"
+#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
@@ -114,7 +116,24 @@ BreakpointLocationList::FindByAddress (c
BreakpointLocationSP bp_loc_sp;
if (!m_locations.empty())
{
- addr_map::const_iterator pos = m_address_to_location.find (addr);
+ Address so_addr;
+
+ if (addr.IsSectionOffset())
+ {
+ so_addr = addr;
+ }
+ else
+ {
+ // Try and resolve as a load address if possible.
+ m_owner.GetTarget().GetSectionLoadList().ResolveLoadAddress (addr.GetOffset(), so_addr);
+ if (!so_addr.IsValid())
+ {
+ // The address didn't resolve, so just set to passed in addr.
+ so_addr = addr;
+ }
+ }
+
+ addr_map::const_iterator pos = m_address_to_location.find (so_addr);
if (pos != m_address_to_location.end())
bp_loc_sp = pos->second;
}
Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp?rev=186458&r1=186457&r2=186458&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp Tue Jul 16 16:22:53 2013
@@ -20,6 +20,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlanRunToAddress.h"
+#include "lldb/Breakpoint/BreakpointLocation.h"
#include "AuxVector.h"
#include "DynamicLoaderPOSIXDYLD.h"
@@ -93,12 +94,18 @@ DynamicLoaderPOSIXDYLD::DynamicLoaderPOS
m_rendezvous(process),
m_load_offset(LLDB_INVALID_ADDRESS),
m_entry_point(LLDB_INVALID_ADDRESS),
- m_auxv()
+ m_auxv(),
+ m_dyld_bid(LLDB_INVALID_BREAK_ID)
{
}
DynamicLoaderPOSIXDYLD::~DynamicLoaderPOSIXDYLD()
{
+ if (m_dyld_bid != LLDB_INVALID_BREAK_ID)
+ {
+ m_process->GetTarget().RemoveBreakpointByID (m_dyld_bid);
+ m_dyld_bid = LLDB_INVALID_BREAK_ID;
+ }
}
void
@@ -263,13 +270,19 @@ DynamicLoaderPOSIXDYLD::EntryBreakpointH
void
DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint()
{
- Breakpoint *dyld_break;
- addr_t break_addr;
+ addr_t break_addr = m_rendezvous.GetBreakAddress();
+ Target &target = m_process->GetTarget();
+
+ if (m_dyld_bid == LLDB_INVALID_BREAK_ID)
+ {
+ Breakpoint *dyld_break = target.CreateBreakpoint (break_addr, true).get();
+ dyld_break->SetCallback(RendezvousBreakpointHit, this, true);
+ dyld_break->SetBreakpointKind ("shared-library-event");
+ m_dyld_bid = dyld_break->GetID();
+ }
- break_addr = m_rendezvous.GetBreakAddress();
- dyld_break = m_process->GetTarget().CreateBreakpoint(break_addr, true).get();
- dyld_break->SetCallback(RendezvousBreakpointHit, this, true);
- dyld_break->SetBreakpointKind ("shared-library-event");
+ // Make sure our breakpoint is at the right address.
+ assert (target.GetBreakpointByID(m_dyld_bid)->FindLocationByAddress(break_addr)->GetBreakpoint().GetID() == m_dyld_bid);
}
bool
Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h?rev=186458&r1=186457&r2=186458&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h Tue Jul 16 16:22:53 2013
@@ -92,6 +92,9 @@ protected:
/// Auxiliary vector of the inferior process.
std::unique_ptr<AuxVector> m_auxv;
+ /// Rendezvous breakpoint.
+ lldb::break_id_t m_dyld_bid;
+
/// Enables a breakpoint on a function called by the runtime
/// linker each time a module is loaded or unloaded.
void
More information about the lldb-commits
mailing list