summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-09-14 23:36:40 +0000
committerGreg Clayton <gclayton@apple.com>2010-09-14 23:36:40 +0000
commitf5e56de0809eec71d97f4cc5905f8bd0a4415a50 (patch)
tree5c006894db84ba365b2371957a092dd51dd0ee9f /lldb
parent5f2311dc29c5182b3b5dc07fc5d01ac25eeec877 (diff)
downloadbcm5719-llvm-f5e56de0809eec71d97f4cc5905f8bd0a4415a50.tar.gz
bcm5719-llvm-f5e56de0809eec71d97f4cc5905f8bd0a4415a50.zip
Moved the section load list up into the target so we can use the target
to symbolicate things without the need for a valid process subclass. llvm-svn: 113895
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/API/SBAddress.h2
-rw-r--r--lldb/include/lldb/API/SBTarget.h1
-rw-r--r--lldb/include/lldb/Core/Address.h4
-rw-r--r--lldb/include/lldb/Core/AddressRange.h6
-rw-r--r--lldb/include/lldb/Core/Section.h6
-rw-r--r--lldb/include/lldb/Core/ThreadSafeSTLMap.h7
-rw-r--r--lldb/include/lldb/Symbol/Block.h2
-rw-r--r--lldb/include/lldb/Symbol/Function.h2
-rw-r--r--lldb/include/lldb/Symbol/LineEntry.h4
-rw-r--r--lldb/include/lldb/Symbol/LineTable.h4
-rw-r--r--lldb/include/lldb/Symbol/Symbol.h4
-rw-r--r--lldb/include/lldb/Symbol/SymbolContext.h6
-rw-r--r--lldb/include/lldb/Symbol/Symtab.h4
-rw-r--r--lldb/include/lldb/Symbol/UnwindPlan.h2
-rw-r--r--lldb/include/lldb/Target/Process.h24
-rw-r--r--lldb/include/lldb/Target/Target.h16
-rw-r--r--lldb/lldb.xcodeproj/project.pbxproj9
-rw-r--r--lldb/source/API/SBAddress.cpp4
-rw-r--r--lldb/source/API/SBBreakpoint.cpp8
-rw-r--r--lldb/source/API/SBFrame.cpp2
-rw-r--r--lldb/source/API/SBTarget.cpp5
-rw-r--r--lldb/source/Breakpoint/BreakpointLocation.cpp13
-rw-r--r--lldb/source/Commands/CommandObjectImage.cpp17
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp5
-rw-r--r--lldb/source/Core/Address.cpp83
-rw-r--r--lldb/source/Core/AddressRange.cpp23
-rw-r--r--lldb/source/Core/Disassembler.cpp16
-rw-r--r--lldb/source/Core/Section.cpp32
-rw-r--r--lldb/source/Core/Value.cpp2
-rw-r--r--lldb/source/Core/ValueObject.cpp10
-rw-r--r--lldb/source/Core/ValueObjectVariable.cpp4
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp8
-rw-r--r--lldb/source/Expression/ClangFunction.cpp2
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp10
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp16
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.cpp7
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp2
-rw-r--r--lldb/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp40
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp3
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp2
-rw-r--r--lldb/source/Symbol/Block.cpp6
-rw-r--r--lldb/source/Symbol/Function.cpp4
-rw-r--r--lldb/source/Symbol/LineEntry.cpp15
-rw-r--r--lldb/source/Symbol/LineTable.cpp8
-rw-r--r--lldb/source/Symbol/Symbol.cpp11
-rw-r--r--lldb/source/Symbol/SymbolContext.cpp20
-rw-r--r--lldb/source/Symbol/Symtab.cpp8
-rw-r--r--lldb/source/Symbol/UnwindPlan.cpp7
-rw-r--r--lldb/source/Symbol/Variable.cpp8
-rw-r--r--lldb/source/Target/Process.cpp100
-rw-r--r--lldb/source/Target/StackFrame.cpp8
-rw-r--r--lldb/source/Target/Target.cpp9
-rw-r--r--lldb/source/Target/ThreadPlanCallFunction.cpp12
-rw-r--r--lldb/source/Target/ThreadPlanRunToAddress.cpp2
-rw-r--r--lldb/source/Target/ThreadPlanStepInRange.cpp2
-rw-r--r--lldb/source/Target/ThreadPlanStepOverRange.cpp2
-rw-r--r--lldb/source/Target/ThreadPlanStepRange.cpp10
57 files changed, 290 insertions, 359 deletions
diff --git a/lldb/include/lldb/API/SBAddress.h b/lldb/include/lldb/API/SBAddress.h
index b58556db42c..9032d2046a3 100644
--- a/lldb/include/lldb/API/SBAddress.h
+++ b/lldb/include/lldb/API/SBAddress.h
@@ -39,7 +39,7 @@ public:
GetFileAddress () const;
addr_t
- GetLoadAddress (const lldb::SBProcess &process) const;
+ GetLoadAddress (const lldb::SBTarget &target) const;
bool
OffsetAddress (addr_t offset);
diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h
index c020b774a62..97ddcccd039 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -143,6 +143,7 @@ public:
#endif
protected:
+ friend class SBAddress;
friend class SBDebugger;
friend class SBProcess;
diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index ee56173efc7..6dfdcdcf889 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -197,7 +197,7 @@ public:
CompareFileAddress (const Address& lhs, const Address& rhs);
static int
- CompareLoadAddress (const Address& lhs, const Address& rhs, Process *process);
+ CompareLoadAddress (const Address& lhs, const Address& rhs, Target *target);
static int
CompareModulePointerAndOffset (const Address& lhs, const Address& rhs);
@@ -291,7 +291,7 @@ public:
/// the address is currently not loaded.
//------------------------------------------------------------------
lldb::addr_t
- GetLoadAddress (Process *process) const;
+ GetLoadAddress (Target *target) const;
//------------------------------------------------------------------
/// Get the section relative offset value.
diff --git a/lldb/include/lldb/Core/AddressRange.h b/lldb/include/lldb/Core/AddressRange.h
index 5b9b102f3cd..06af3a8a6cd 100644
--- a/lldb/include/lldb/Core/AddressRange.h
+++ b/lldb/include/lldb/Core/AddressRange.h
@@ -163,7 +163,7 @@ public:
/// in the address range, \b false otherwise.
//------------------------------------------------------------------
bool
- ContainsLoadAddress (const Address &so_addr, Process *process) const;
+ ContainsLoadAddress (const Address &so_addr, Target *target) const;
//------------------------------------------------------------------
/// Check if the resolved load address \a load_addr is contained
@@ -178,7 +178,7 @@ public:
/// range, \b false otherwise.
//------------------------------------------------------------------
bool
- ContainsLoadAddress (lldb::addr_t load_addr, Process *process) const;
+ ContainsLoadAddress (lldb::addr_t load_addr, Target *target) const;
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
@@ -203,7 +203,7 @@ public:
/// @see Address::DumpStyle
//------------------------------------------------------------------
bool
- Dump (Stream *s, Process *process, Address::DumpStyle style, Address::DumpStyle fallback_style = Address::DumpStyleInvalid) const;
+ Dump (Stream *s, Target *target, Address::DumpStyle style, Address::DumpStyle fallback_style = Address::DumpStyleInvalid) const;
//------------------------------------------------------------------
/// Dump a debug description of this object to a Stream.
diff --git a/lldb/include/lldb/Core/Section.h b/lldb/include/lldb/Core/Section.h
index 54331a664cb..d2052167626 100644
--- a/lldb/include/lldb/Core/Section.h
+++ b/lldb/include/lldb/Core/Section.h
@@ -46,7 +46,7 @@ public:
ContainsSection(lldb::user_id_t sect_id) const;
void
- Dump (Stream *s, Process *process, bool show_header) const;
+ Dump (Stream *s, Target *target, bool show_header) const;
lldb::SectionSP
FindSectionByName (const ConstString &section_dstr) const;
@@ -137,13 +137,13 @@ public:
}
void
- Dump (Stream *s, Process *process) const;
+ Dump (Stream *s, Target *target) const;
void
DumpName (Stream *s) const;
lldb::addr_t
- GetLoadBaseAddress (Process *process) const;
+ GetLoadBaseAddress (Target *target) const;
bool
ResolveContainedAddress (lldb::addr_t offset, Address &so_addr) const;
diff --git a/lldb/include/lldb/Core/ThreadSafeSTLMap.h b/lldb/include/lldb/Core/ThreadSafeSTLMap.h
index a8921e5a802..dee525869aa 100644
--- a/lldb/include/lldb/Core/ThreadSafeSTLMap.h
+++ b/lldb/include/lldb/Core/ThreadSafeSTLMap.h
@@ -40,6 +40,13 @@ public:
{
}
+ bool
+ IsEmpty() const
+ {
+ Mutex::Locker locker(m_mutex);
+ return m_collection.empty();
+ }
+
size_t
Erase (const _Key& key)
{
diff --git a/lldb/include/lldb/Symbol/Block.h b/lldb/include/lldb/Symbol/Block.h
index 21a78614f6f..88d63ea3436 100644
--- a/lldb/include/lldb/Symbol/Block.h
+++ b/lldb/include/lldb/Symbol/Block.h
@@ -188,7 +188,7 @@ public:
GetDescription (Stream *s,
Function *function,
lldb::DescriptionLevel level,
- Process *process) const;
+ Target *target) const;
//------------------------------------------------------------------
/// Get the parent block.
diff --git a/lldb/include/lldb/Symbol/Function.h b/lldb/include/lldb/Symbol/Function.h
index 51e76dbf783..d5d8a3e4dce 100644
--- a/lldb/include/lldb/Symbol/Function.h
+++ b/lldb/include/lldb/Symbol/Function.h
@@ -487,7 +487,7 @@ public:
GetCompileUnit() const;
void
- GetDescription(Stream *s, lldb::DescriptionLevel level, Process *process);
+ GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target);
//------------------------------------------------------------------
/// Get accessor for the frame base location.
diff --git a/lldb/include/lldb/Symbol/LineEntry.h b/lldb/include/lldb/Symbol/LineEntry.h
index 709613f343c..0cf7d829d02 100644
--- a/lldb/include/lldb/Symbol/LineEntry.h
+++ b/lldb/include/lldb/Symbol/LineEntry.h
@@ -84,13 +84,13 @@ struct LineEntry
/// @see Address::DumpStyle
//------------------------------------------------------------------
bool
- Dump (Stream *s, Process *process, bool show_file, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_range) const;
+ Dump (Stream *s, Target *target, bool show_file, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_range) const;
bool
GetDescription (Stream *s,
lldb::DescriptionLevel level,
CompileUnit* cu,
- Process *process,
+ Target *target,
bool show_address_only) const;
//------------------------------------------------------------------
diff --git a/lldb/include/lldb/Symbol/LineTable.h b/lldb/include/lldb/Symbol/LineTable.h
index 0fd9ed241d3..d03836c23a8 100644
--- a/lldb/include/lldb/Symbol/LineTable.h
+++ b/lldb/include/lldb/Symbol/LineTable.h
@@ -91,10 +91,10 @@ public:
/// @see Address::DumpStyle
//------------------------------------------------------------------
void
- Dump (Stream *s, Process *process, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_line_ranges);
+ Dump (Stream *s, Target *target, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_line_ranges);
void
- GetDescription (Stream *s, Process *process, lldb::DescriptionLevel level);
+ GetDescription (Stream *s, Target *target, lldb::DescriptionLevel level);
//------------------------------------------------------------------
/// Find a line entry that contains the section offset address \a
diff --git a/lldb/include/lldb/Symbol/Symbol.h b/lldb/include/lldb/Symbol/Symbol.h
index 019c6d4885c..13910da1a76 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -61,7 +61,7 @@ public:
Compare (const ConstString& name, lldb::SymbolType type) const;
void
- Dump (Stream *s, Process *process, uint32_t index) const;
+ Dump (Stream *s, Target *target, uint32_t index) const;
AddressRange *
GetAddressRangePtr ();
@@ -109,7 +109,7 @@ public:
SetFlags (uint32_t flags) { m_flags = flags; }
void
- GetDescription (Stream *s, lldb::DescriptionLevel level, Process *process) const;
+ GetDescription (Stream *s, lldb::DescriptionLevel level, Target *target) const;
Function *
GetFunction ();
diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h
index f9a0542f5e8..17722be18c4 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -140,7 +140,7 @@ public:
/// The stream to which to dump the object descripton.
//------------------------------------------------------------------
void
- Dump (Stream *s, Process *process) const;
+ Dump (Stream *s, Target *target) const;
//------------------------------------------------------------------
/// Dump the stop context in this object to a Stream.
@@ -190,7 +190,7 @@ public:
void
GetDescription(Stream *s,
lldb::DescriptionLevel level,
- Process *process) const;
+ Target *target) const;
uint32_t
GetResolvedMask () const;
@@ -292,7 +292,7 @@ public:
/// The stream to which to dump the object descripton.
//------------------------------------------------------------------
void
- Dump(Stream *s, Process *process) const;
+ Dump(Stream *s, Target *target) const;
//------------------------------------------------------------------
/// Get accessor for a symbol context at index \a idx.
diff --git a/lldb/include/lldb/Symbol/Symtab.h b/lldb/include/lldb/Symbol/Symtab.h
index b036d47e765..7baef34fb86 100644
--- a/lldb/include/lldb/Symbol/Symtab.h
+++ b/lldb/include/lldb/Symbol/Symtab.h
@@ -41,8 +41,8 @@ public:
Symbol * Resize (uint32_t count);
uint32_t AddSymbol(const Symbol& symbol);
size_t GetNumSymbols() const;
- void Dump(Stream *s, Process *process) const;
- void Dump(Stream *s, Process *process, std::vector<uint32_t>& indexes) const;
+ void Dump(Stream *s, Target *target) const;
+ void Dump(Stream *s, Target *target, std::vector<uint32_t>& indexes) const;
uint32_t GetIndexForSymbol (const Symbol *symbol) const;
Symbol * FindSymbolByID (lldb::user_id_t uid) const;
Symbol * SymbolAtIndex (uint32_t idx);
diff --git a/lldb/include/lldb/Symbol/UnwindPlan.h b/lldb/include/lldb/Symbol/UnwindPlan.h
index a678fe09604..c75027dcc82 100644
--- a/lldb/include/lldb/Symbol/UnwindPlan.h
+++ b/lldb/include/lldb/Symbol/UnwindPlan.h
@@ -178,7 +178,7 @@ public:
UnwindPlan () : m_register_kind(-1), m_row_list(), m_plan_valid_address_range() { }
- void Dump (Stream& s, Process* process, Thread* thread) const;
+ void Dump (Stream& s, Thread* thread) const;
void
AppendRow (const Row& row);
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index 8975411aa70..34ea56893b7 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -24,7 +24,6 @@
#include "lldb/Core/Event.h"
#include "lldb/Core/StringList.h"
#include "lldb/Core/ThreadSafeValue.h"
-#include "lldb/Core/ThreadSafeSTLMap.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Breakpoint/BreakpointSiteList.h"
@@ -1459,27 +1458,6 @@ public:
virtual DynamicLoader *
GetDynamicLoader ();
- lldb::addr_t
- GetSectionLoadAddress (const Section *section) const;
-
- bool
- ResolveLoadAddress (lldb::addr_t load_addr, Address &so_addr) const;
-
- bool
- SectionLoaded (const Section *section, lldb::addr_t load_addr);
-
- // The old load address should be specified when unloading to ensure we get
- // the correct instance of the section as a shared library could be loaded
- // at more than one location.
- bool
- SectionUnloaded (const Section *section, lldb::addr_t load_addr);
-
- // Unload all instances of a section. This function can be used on systems
- // that don't support multiple copies of the same shared library to be
- // loaded at the same time.
- size_t
- SectionUnloaded (const Section *section);
-
bool
IsRunning () const;
@@ -1521,12 +1499,10 @@ public:
GetObjCObjectPrinter();
protected:
- typedef ThreadSafeSTLMap<lldb::addr_t, const Section *> SectionLoadColl;
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
Target & m_target; ///< The target that owns this process.
- SectionLoadColl m_section_load_info; ///< A mapping of all currently loaded sections.
ThreadSafeValue<lldb::StateType> m_public_state;
ThreadSafeValue<lldb::StateType> m_private_state; // The actual state of our process
Broadcaster m_private_state_broadcaster; // This broadcaster feeds state changed events into the private state thread's listener.
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index ef584fb1a38..17ce8e496c1 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -25,6 +25,7 @@
#include "lldb/Target/ABI.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/PathMappingList.h"
+#include "lldb/Target/SectionLoadList.h"
#include "lldb/API/SBTarget.h"
@@ -290,6 +291,20 @@ public:
size_t dst_len,
Error &error);
+
+
+ SectionLoadList&
+ GetSectionLoadList()
+ {
+ return m_section_load_list;
+ }
+
+ const SectionLoadList&
+ GetSectionLoadList() const
+ {
+ return m_section_load_list;
+ }
+
//------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
@@ -323,6 +338,7 @@ protected:
Debugger & m_debugger;
ArchSpec m_arch_spec;
ModuleList m_images; ///< The list of images for this process (shared libraries and anything dynamically loaded).
+ SectionLoadList m_section_load_list;
BreakpointList m_breakpoint_list;
BreakpointList m_internal_breakpoint_list;
// We want to tightly control the process destruction process so
diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj
index d3f03b6ce0c..72ca1aa0782 100644
--- a/lldb/lldb.xcodeproj/project.pbxproj
+++ b/lldb/lldb.xcodeproj/project.pbxproj
@@ -14,6 +14,8 @@
2615DBCB1208B5FC0021781D /* StopInfoMachException.h in Headers */ = {isa = PBXBuildFile; fileRef = 2615DBC91208B5FC0021781D /* StopInfoMachException.h */; };
261744781168585B005ADD65 /* SBType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 261744771168585B005ADD65 /* SBType.cpp */; };
2617447A11685869005ADD65 /* SBType.h in Headers */ = {isa = PBXBuildFile; fileRef = 2617447911685869005ADD65 /* SBType.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 2618D7901240115500F2B8FE /* SectionLoadList.h in Headers */ = {isa = PBXBuildFile; fileRef = 2618D78F1240115500F2B8FE /* SectionLoadList.h */; };
+ 2618D7921240116900F2B8FE /* SectionLoadList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2618D7911240116900F2B8FE /* SectionLoadList.cpp */; };
261B5A5411C3F2AD00AABD0A /* SharingPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 261B5A5211C3F2AD00AABD0A /* SharingPtr.cpp */; };
261B5A5511C3F2AD00AABD0A /* SharingPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 261B5A5311C3F2AD00AABD0A /* SharingPtr.h */; settings = {ATTRIBUTES = (Public, ); }; };
262CFC7711A4510000946C6C /* debugserver in Resources */ = {isa = PBXBuildFile; fileRef = 26CE05A0115C31E50022F371 /* debugserver */; };
@@ -530,6 +532,8 @@
2615DBC91208B5FC0021781D /* StopInfoMachException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StopInfoMachException.h; path = Utility/StopInfoMachException.h; sourceTree = "<group>"; };
261744771168585B005ADD65 /* SBType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBType.cpp; path = source/API/SBType.cpp; sourceTree = "<group>"; };
2617447911685869005ADD65 /* SBType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBType.h; path = include/lldb/API/SBType.h; sourceTree = "<group>"; };
+ 2618D78F1240115500F2B8FE /* SectionLoadList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SectionLoadList.h; path = include/lldb/Target/SectionLoadList.h; sourceTree = "<group>"; };
+ 2618D7911240116900F2B8FE /* SectionLoadList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SectionLoadList.cpp; path = source/Target/SectionLoadList.cpp; sourceTree = "<group>"; };
261B5A5211C3F2AD00AABD0A /* SharingPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SharingPtr.cpp; path = source/Utility/SharingPtr.cpp; sourceTree = "<group>"; };
261B5A5311C3F2AD00AABD0A /* SharingPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SharingPtr.h; path = include/lldb/Utility/SharingPtr.h; sourceTree = "<group>"; };
261E18CC1148966100BADCD3 /* GDBRemoteRegisterContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GDBRemoteRegisterContext.h; path = "source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h"; sourceTree = "<group>"; };
@@ -1967,6 +1971,8 @@
26BC7F3610F1B90C00F91463 /* Process.cpp */,
26BC7DF410F1B81A00F91463 /* RegisterContext.h */,
26BC7F3710F1B90C00F91463 /* RegisterContext.cpp */,
+ 2618D78F1240115500F2B8FE /* SectionLoadList.h */,
+ 2618D7911240116900F2B8FE /* SectionLoadList.cpp */,
26BC7DF510F1B81A00F91463 /* StackFrame.h */,
26BC7F3810F1B90C00F91463 /* StackFrame.cpp */,
26BC7DF610F1B81A00F91463 /* StackFrameList.h */,
@@ -2271,6 +2277,7 @@
961FABEB1235F26800F93A47 /* UnwindAssemblyProfiler-x86.h in Headers */,
961FAC1F12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.h in Headers */,
268F9D53123AA15200B91E9B /* SBSymbolContextList.h in Headers */,
+ 2618D7901240115500F2B8FE /* SectionLoadList.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2325,6 +2332,7 @@
isa = PBXProject;
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */;
compatibilityVersion = "Xcode 3.1";
+ developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
@@ -2733,6 +2741,7 @@
69A01E251236C5D400C660B5 /* Symbols.cpp in Sources */,
69A01E261236C5D400C660B5 /* TimeValue.cpp in Sources */,
268F9D55123AA16600B91E9B /* SBSymbolContextList.cpp in Sources */,
+ 2618D7921240116900F2B8FE /* SectionLoadList.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp
index 8b8294c6453..61e1ec1524f 100644
--- a/lldb/source/API/SBAddress.cpp
+++ b/lldb/source/API/SBAddress.cpp
@@ -85,10 +85,10 @@ SBAddress::GetFileAddress () const
}
lldb::addr_t
-SBAddress::GetLoadAddress (const SBProcess &process) const
+SBAddress::GetLoadAddress (const SBTarget &target) const
{
if (m_opaque_ap.get())
- return m_opaque_ap->GetLoadAddress(process.get());
+ return m_opaque_ap->GetLoadAddress(target.get());
else
return LLDB_INVALID_ADDRESS;
}
diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp
index f8c52ef0893..91b159870ca 100644
--- a/lldb/source/API/SBBreakpoint.cpp
+++ b/lldb/source/API/SBBreakpoint.cpp
@@ -134,8 +134,8 @@ SBBreakpoint::FindLocationByAddress (addr_t vm_addr)
if (vm_addr != LLDB_INVALID_ADDRESS)
{
Address address;
- Process *sb_process = m_opaque_sp->GetTarget().GetProcessSP().get();
- if (sb_process == NULL || sb_process->ResolveLoadAddress (vm_addr, address) == false)
+ Target &target = m_opaque_sp->GetTarget();
+ if (target.GetSectionLoadList().ResolveLoadAddress (vm_addr, address) == false)
{
address.SetSection (NULL);
address.SetOffset (vm_addr);
@@ -156,8 +156,8 @@ SBBreakpoint::FindLocationIDByAddress (addr_t vm_addr)
if (vm_addr != LLDB_INVALID_ADDRESS)
{
Address address;
- Process *sb_process = m_opaque_sp->GetTarget().GetProcessSP().get();
- if (sb_process == NULL || sb_process->ResolveLoadAddress (vm_addr, address) == false)
+ Target &target = m_opaque_sp->GetTarget();
+ if (target.GetSectionLoadList().ResolveLoadAddress (vm_addr, address) == false)
{
address.SetSection (NULL);
address.SetOffset (vm_addr);
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index 65846e57f49..5d9bd6e016f 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -132,7 +132,7 @@ lldb::addr_t
SBFrame::GetPC () const
{
if (m_opaque_sp)
- return m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess());
+ return m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget());
return LLDB_INVALID_ADDRESS;
}
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 6c55c684bad..9e5c1ab27d5 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -399,6 +399,7 @@ SBTarget::Disassemble (lldb::addr_t start_addr, lldb::addr_t end_addr, const cha
// Make sure the process object is alive if we have one (it might be
// created but we might not be launched yet).
+
Process *process = m_opaque_sp->GetProcessSP().get();
if (process && !process->IsAlive())
process = NULL;
@@ -410,11 +411,11 @@ SBTarget::Disassemble (lldb::addr_t start_addr, lldb::addr_t end_addr, const cha
if (!module_sp->ResolveFileAddress (start_addr, range.GetBaseAddress()))
range.GetBaseAddress().SetOffset(start_addr);
}
- else if (process)
+ else if (m_opaque_sp->GetSectionLoadList().IsEmpty() == false)
{
// We don't have a module, se we need to figure out if "start_addr"
// resolves to anything in a running process.
- if (!process->ResolveLoadAddress(start_addr, range.GetBaseAddress()))
+ if (!m_opaque_sp->GetSectionLoadList().ResolveLoadAddress (start_addr, range.GetBaseAddress()))
range.GetBaseAddress().SetOffset(start_addr);
}
else
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp
index 9609303e5cb..dc45654a77c 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -35,7 +35,7 @@ BreakpointLocation::BreakpointLocation
lldb::tid_t tid,
bool hardware
) :
- StoppointLocation (loc_id, addr.GetLoadAddress(owner.GetTarget().GetProcessSP().get()), hardware),
+ StoppointLocation (loc_id, addr.GetLoadAddress(&owner.GetTarget()), hardware),
m_address (addr),
m_owner (owner),
m_options_ap (),
@@ -52,7 +52,7 @@ BreakpointLocation::~BreakpointLocation()
lldb::addr_t
BreakpointLocation::GetLoadAddress () const
{
- return m_address.GetLoadAddress(m_owner.GetTarget().GetProcessSP().get());
+ return m_address.GetLoadAddress(&m_owner.GetTarget());
}
Address &
@@ -223,10 +223,13 @@ BreakpointLocation::ResolveBreakpointSite ()
if (m_bp_site_sp)
return true;
- Process* process = m_owner.GetTarget().GetProcessSP().get();
+ Process *process = m_owner.GetTarget().GetProcessSP().get();
if (process == NULL)
return false;
+ if (m_owner.GetTarget().GetSectionLoadList().IsEmpty())
+ return false;
+
BreakpointLocationSP myself_sp(m_owner.GetLocationSP (this));
lldb::break_id_t new_id = process->CreateBreakpointSite (myself_sp, false);
@@ -236,7 +239,7 @@ BreakpointLocation::ResolveBreakpointSite ()
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
if (log)
log->Warning ("Tried to add breakpoint site at 0x%llx but it was already present.\n",
- m_address.GetLoadAddress(process));
+ m_address.GetLoadAddress(&m_owner.GetTarget()));
return false;
}
@@ -384,7 +387,7 @@ BreakpointLocation::Dump(Stream *s) const
"hw_index = %i hit_count = %-4u ignore_count = %-4u",
GetID(),
GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID(),
- (uint64_t) m_address.GetLoadAddress(m_owner.GetTarget().GetProcessSP().get()),
+ (uint64_t) m_address.GetLoadAddress (&m_owner.GetTarget()),
(m_options_ap.get() ? m_options_ap->IsEnabled() : m_owner.IsEnabled()) ? "enabled " : "disabled",
IsHardware() ? "hardware" : "software",
GetHardwareIndex(),
diff --git a/lldb/source/Commands/CommandObjectImage.cpp b/lldb/source/Commands/CommandObjectImage.cpp
index 8953490034f..414e0315fde 100644
--- a/lldb/source/Commands/CommandObjectImage.cpp
+++ b/lldb/source/Commands/CommandObjectImage.cpp
@@ -87,7 +87,7 @@ DumpCompileUnitLineTable
LineTable *line_table = sc.comp_unit->GetLineTable();
if (line_table)
line_table->GetDescription (&strm,
- interpreter.GetDebugger().GetExecutionContext().process,
+ interpreter.GetDebugger().GetExecutionContext().target,
lldb::eDescriptionLevelBrief);
else
strm << "No line table";
@@ -165,7 +165,7 @@ DumpModuleSymtab (CommandInterpreter &interpreter, Stream &strm, Module *module)
{
Symtab *symtab = objfile->GetSymtab();
if (symtab)
- symtab->Dump(&strm, interpreter.GetDebugger().GetExecutionContext().process);
+ symtab->Dump(&strm, interpreter.GetDebugger().GetExecutionContext().target);
}
}
}
@@ -180,7 +180,7 @@ DumpModuleSections (CommandInterpreter &interpreter, Stream &strm, Module *modul
{
SectionList *section_list = objfile->GetSectionList();
if (section_list)
- section_list->Dump(&strm, interpreter.GetDebugger().GetExecutionContext().process, true);
+ section_list->Dump(&strm, interpreter.GetDebugger().GetExecutionContext().target, true);
}
}
}
@@ -217,10 +217,10 @@ LookupAddressInModule
lldb::addr_t addr = raw_addr - offset;
Address so_addr;
SymbolContext sc;
- Process *process = interpreter.GetDebugger().GetExecutionContext().process;
- if (process && process->IsAlive())
+ Target *target = interpreter.GetDebugger().GetExecutionContext().target;
+ if (target && !target->GetSectionLoadList().IsEmpty())
{
- if (!process->ResolveLoadAddress (addr, so_addr))
+ if (!target->GetSectionLoadList().ResolveLoadAddress (addr, so_addr))
return false;
else if (so_addr.GetModule() != module)
return false;
@@ -299,7 +299,7 @@ LookupSymbolInModule (CommandInterpreter &interpreter, Stream &strm, Module *mod
{
Symbol *symbol = symtab->SymbolAtIndex(match_indexes[i]);
strm.Indent ();
- symbol->Dump (&strm, interpreter.GetDebugger().GetExecutionContext().process, i);
+ symbol->Dump (&strm, interpreter.GetDebugger().GetExecutionContext().target, i);
}
strm.IndentLess ();
return num_matches;
@@ -328,8 +328,7 @@ DumpSymbolContextList (CommandInterpreter &interpreter, Stream &strm, SymbolCont
{
if (sc.line_entry.range.GetBaseAddress().IsValid())
{
- lldb::addr_t vm_addr =
- sc.line_entry.range.GetBaseAddress().GetLoadAddress(interpreter.GetDebugger().GetExecutionContext().process);
+ lldb::addr_t vm_addr = sc.line_entry.range.GetBaseAddress().GetLoadAddress(interpreter.GetDebugger().GetExecutionContext().target);
int addr_size = sizeof (addr_t);
Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process)
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index b7af449ec64..8c5e968a67a 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -1067,7 +1067,8 @@ public:
{
bool synchronous_execution = interpreter.GetSynchronous ();
- if (!interpreter.GetDebugger().GetSelectedTarget().get())
+ Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+ if (target == NULL)
{
result.AppendError ("invalid target, set executable file using 'file' command");
result.SetStatus (eReturnStatusFailed);
@@ -1166,7 +1167,7 @@ public:
if (index_ptr == UINT32_MAX)
break;
- addr_t address = line_entry.range.GetBaseAddress().GetLoadAddress(process);
+ addr_t address = line_entry.range.GetBaseAddress().GetLoadAddress(target);
if (address != LLDB_INVALID_ADDRESS)
address_list.push_back (address);
index_ptr++;
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index 98b56355517..df5a646fa91 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -11,6 +11,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
@@ -138,27 +139,30 @@ ReadAddress (ExecutionContextScope *exe_scope, const Address &address, uint32_t
addr_t deref_addr = ReadUIntMax64 (exe_scope, address, pointer_size, success);
if (success)
{
- Process *process = exe_scope->CalculateProcess();
- if (process && process->IsAlive())
+ ExecutionContext exe_ctx;
+ exe_scope->Calculate(exe_ctx);
+ // If we have any sections that are loaded, try and resolve using the
+ // section load list
+ if (exe_ctx.target && !exe_ctx.target->GetSectionLoadList().IsEmpty())
{
- if (!process->ResolveLoadAddress (deref_addr, deref_so_addr))
- {
- deref_so_addr.SetSection(NULL);
- deref_so_addr.SetOffset(deref_addr);
- }
+ if (exe_ctx.target->GetSectionLoadList().ResolveLoadAddress (deref_addr, deref_so_addr))
+ return true;
}
else
{
- Target *target = exe_scope->CalculateTarget();
- if (target == NULL)
- return false;
-
- if (!target->GetImages().ResolveFileAddress(deref_addr, deref_so_addr))
- {
- deref_so_addr.SetSection(NULL);
- deref_so_addr.SetOffset(deref_addr);
- }
+ // If we were not running, yet able to read an integer, we must
+ // have a module
+ Module *module = address.GetModule();
+ assert (module);
+ if (module->ResolveFileAddress(deref_addr, deref_so_addr))
+ return true;
}
+
+ // We couldn't make "deref_addr" into a section offset value, but we were
+ // able to read the address, so we return a section offset address with
+ // no section and "deref_addr" as the offset (address).
+ deref_so_addr.SetSection(NULL);
+ deref_so_addr.SetOffset(deref_addr);
return true;
}
return false;
@@ -334,27 +338,28 @@ Address::GetFileAddress () const
}
addr_t
-Address::GetLoadAddress (Process *process) const
+Address::GetLoadAddress (Target *target) const
{
- if (m_section != NULL)
+ if (m_section == NULL)
{
- if (process)
- {
- addr_t sect_load_addr = m_section->GetLoadBaseAddress (process);
+ // No section, we just return the offset since it is the value in this case
+ return m_offset;
+ }
+
+ if (target)
+ {
+ addr_t sect_load_addr = m_section->GetLoadBaseAddress (target);
- if (sect_load_addr != LLDB_INVALID_ADDRESS)
- {
- // We have a valid file range, so we can return the file based
- // address by adding the file base address to our offset
- return sect_load_addr + m_offset;
- }
+ if (sect_load_addr != LLDB_INVALID_ADDRESS)
+ {
+ // We have a valid file range, so we can return the file based
+ // address by adding the file base address to our offset
+ return sect_load_addr + m_offset;
}
- // The section isn't resolved or no process was supplied so we can't
- // return a valid file address.
- return LLDB_INVALID_ADDRESS;
}
- // No section, we just return the offset since it is the value in this case
- return m_offset;
+ // The section isn't resolved or no process was supplied so we can't
+ // return a valid file address.
+ return LLDB_INVALID_ADDRESS;
}
bool
@@ -424,7 +429,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
case DumpStyleLoadAddress:
{
- addr_t load_addr = GetLoadAddress (process);
+ addr_t load_addr = GetLoadAddress (target);
if (load_addr == LLDB_INVALID_ADDRESS)
{
if (fallback_style != DumpStyleInvalid)
@@ -440,7 +445,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
if (IsSectionOffset())
{
lldb::AddressType addr_type = eAddressTypeLoad;
- addr_t addr = GetLoadAddress (process);
+ addr_t addr = GetLoadAddress (target);
if (addr == LLDB_INVALID_ADDRESS)
{
addr = GetFileAddress();
@@ -670,7 +675,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
if (sc.symbol->GetAddressRangePtr() && sc.symbol->GetAddressRangePtr()->GetBaseAddress().GetSection() != GetSection())
sc.symbol = NULL;
}
- sc.GetDescription(s, eDescriptionLevelBrief, process);
+ sc.GetDescription(s, eDescriptionLevelBrief, target);
}
}
if (fallback_style != DumpStyleInvalid)
@@ -733,11 +738,11 @@ Address::CompareFileAddress (const Address& a, const Address& b)
int
-Address::CompareLoadAddress (const Address& a, const Address& b, Process *process)
+Address::CompareLoadAddress (const Address& a, const Address& b, Target *target)
{
- assert (process != NULL);
- addr_t a_load_addr = a.GetLoadAddress (process);
- addr_t b_load_addr = b.GetLoadAddress (process);
+ assert (target != NULL);
+ addr_t a_load_addr = a.GetLoadAddress (target);
+ addr_t b_load_addr = b.GetLoadAddress (target);
if (a_load_addr < b_load_addr)
return -1;
if (a_load_addr > b_load_addr)
diff --git a/lldb/source/Core/AddressRange.cpp b/lldb/source/Core/AddressRange.cpp
index d84a4e8dfa3..b5ed92defd5 100644
--- a/lldb/source/Core/AddressRange.cpp
+++ b/lldb/source/Core/AddressRange.cpp
@@ -11,6 +11,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/Stream.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
@@ -96,15 +97,15 @@ AddressRange::ContainsFileAddress (addr_t file_addr) const
bool
-AddressRange::ContainsLoadAddress (const Address &addr, Process *process) const
+AddressRange::ContainsLoadAddress (const Address &addr, Target *target) const
{
if (addr.GetSection() == m_base_addr.GetSection())
return (addr.GetOffset() - m_base_addr.GetOffset()) < GetByteSize();
- addr_t load_base_addr = GetBaseAddress().GetLoadAddress(process);
+ addr_t load_base_addr = GetBaseAddress().GetLoadAddress(target);
if (load_base_addr == LLDB_INVALID_ADDRESS)
return false;
- addr_t load_addr = addr.GetLoadAddress(process);
+ addr_t load_addr = addr.GetLoadAddress(target);
if (load_addr == LLDB_INVALID_ADDRESS)
return false;
@@ -115,12 +116,12 @@ AddressRange::ContainsLoadAddress (const Address &addr, Process *process) const
}
bool
-AddressRange::ContainsLoadAddress (addr_t load_addr, Process *process) const
+AddressRange::ContainsLoadAddress (addr_t load_addr, Target *target) const
{
if (load_addr == LLDB_INVALID_ADDRESS)
return false;
- addr_t load_base_addr = GetBaseAddress().GetLoadAddress(process);
+ addr_t load_base_addr = GetBaseAddress().GetLoadAddress(target);
if (load_base_addr == LLDB_INVALID_ADDRESS)
return false;
@@ -138,12 +139,12 @@ AddressRange::Clear()
}
bool
-AddressRange::Dump(Stream *s, Process *process, Address::DumpStyle style, Address::DumpStyle fallback_style) const
+AddressRange::Dump(Stream *s, Target *target, Address::DumpStyle style, Address::DumpStyle fallback_style) const
{
addr_t vmaddr = LLDB_INVALID_ADDRESS;
int addr_size = sizeof (addr_t);
- if (process)
- addr_size = process->GetAddressByteSize ();
+ if (target && target->GetProcessSP())
+ addr_size = target->GetProcessSP()->GetAddressByteSize ();
bool show_module = false;
switch (style)
@@ -153,7 +154,7 @@ AddressRange::Dump(Stream *s, Process *process, Address::DumpStyle style, Addres
case Address::DumpStyleSectionNameOffset:
case Address::DumpStyleSectionPointerOffset:
s->PutChar ('[');
- m_base_addr.Dump(s, process, style, fallback_style);
+ m_base_addr.Dump(s, target, style, fallback_style);
s->PutChar ('-');
s->Address (m_base_addr.GetOffset() + GetByteSize(), addr_size);
s->PutChar (')');
@@ -168,7 +169,7 @@ AddressRange::Dump(Stream *s, Process *process, Address::DumpStyle style, Addres
break;
case Address::DumpStyleLoadAddress:
- vmaddr = m_base_addr.GetLoadAddress(process);
+ vmaddr = m_base_addr.GetLoadAddress(target);
break;
}
@@ -185,7 +186,7 @@ AddressRange::Dump(Stream *s, Process *process, Address::DumpStyle style, Addres
}
else if (fallback_style != Address::DumpStyleInvalid)
{
- return Dump(s, process, fallback_style, Address::DumpStyleInvalid);
+ return Dump(s, target, fallback_style, Address::DumpStyleInvalid);
}
return false;
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index 18786bd05ed..40d8d300682 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -155,17 +155,19 @@ Disassembler::Disassemble
// try and resolve it to something
if (range.GetBaseAddress().IsSectionOffset() == false)
{
- if (process && process->IsAlive())
+ if (exe_ctx.target)
{
- process->ResolveLoadAddress (range.GetBaseAddress().GetOffset(), range.GetBaseAddress());
- }
- else if (exe_ctx.target)
- {
- exe_ctx.target->GetImages().ResolveFileAddress (range.GetBaseAddress().GetOffset(), range.GetBaseAddress());
+ if (exe_ctx.target->GetSectionLoadList().IsEmpty())
+ {
+ exe_ctx.target->GetImages().ResolveFileAddress (range.GetBaseAddress().GetOffset(), range.GetBaseAddress());
+ }
+ else
+ {
+ exe_ctx.target->GetSectionLoadList().ResolveLoadAddress (range.GetBaseAddress().GetOffset(), range.GetBaseAddress());
+ }
}
}
-
DataExtractor data;
size_t bytes_disassembled = disassembler->ParseInstructions (&exe_ctx, range, data);
if (bytes_disassembled == 0)
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index b506879d50a..f4e8800222c 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -10,7 +10,7 @@
#include "lldb/Core/Section.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
@@ -112,23 +112,23 @@ Section::GetLinkedFileAddress () const
addr_t
-Section::GetLoadBaseAddress (Process *process) const
+Section::GetLoadBaseAddress (Target *target) const
{
addr_t load_base_addr = LLDB_INVALID_ADDRESS;
if (m_linked_section)
{
- load_base_addr = m_linked_section->GetLoadBaseAddress(process) + m_linked_offset;
+ load_base_addr = m_linked_section->GetLoadBaseAddress(target) + m_linked_offset;
}
else
if (m_parent)
{
- load_base_addr = m_parent->GetLoadBaseAddress (process);
+ load_base_addr = m_parent->GetLoadBaseAddress (target);
if (load_base_addr != LLDB_INVALID_ADDRESS)
load_base_addr += GetOffset();
}
else
{
- load_base_addr = process->GetSectionLoadAddress(this);
+ load_base_addr = target->GetSectionLoadList().GetSectionLoadAddress (this);
}
return load_base_addr;
@@ -222,7 +222,7 @@ Section::Compare (const Section& a, const Section& b)
void
-Section::Dump(Stream *s, Process *process) const
+Section::Dump(Stream *s, Target *target) const
{
s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
s->Indent();
@@ -234,12 +234,12 @@ Section::Dump(Stream *s, Process *process) const
s->Printf("%39s", "");
else
{
- if (process)
- addr = GetLoadBaseAddress (process);
+ if (target)
+ addr = GetLoadBaseAddress (target);
if (addr == LLDB_INVALID_ADDRESS)
{
- if (process)
+ if (target)
resolved = false;
addr = GetFileAddress();
}
@@ -258,16 +258,16 @@ Section::Dump(Stream *s, Process *process) const
{
addr = LLDB_INVALID_ADDRESS;
- if (process)
+ if (target)
{
- addr = m_linked_section->GetLoadBaseAddress(process);
+ addr = m_linked_section->GetLoadBaseAddress(target);
if (addr != LLDB_INVALID_ADDRESS)
addr += m_linked_offset;
}
if (addr == LLDB_INVALID_ADDRESS)
{
- if (process)
+ if (target)
resolved = false;
addr = m_linked_section->GetFileAddress() + m_linked_offset;
}
@@ -283,7 +283,7 @@ Section::Dump(Stream *s, Process *process) const
s->Printf(" + 0x%llx\n", m_linked_offset);
}
- m_children.Dump(s, process, false);
+ m_children.Dump(s, target, false);
}
void
@@ -668,7 +668,7 @@ SectionList::ContainsSection(user_id_t sect_id) const
}
void
-SectionList::Dump (Stream *s, Process *process, bool show_header) const
+SectionList::Dump (Stream *s, Target *target, bool show_header) const
{
if (show_header && !m_sections.empty())
{
@@ -678,7 +678,7 @@ SectionList::Dump (Stream *s, Process *process, bool show_header) const
s->IndentMore();
s->Printf("%*s", 2*(sizeof(void *) + 2), "");
s->Indent();
- s->Printf("SectID %s Address File Off. File Size Flags Section Name\n", process ? "Load" : "File");
+ s->Printf("SectID %s Address File Off. File Size Flags Section Name\n", (target && target->GetSectionLoadList().IsEmpty() == false) ? "Load" : "File");
s->Printf("%*s", 2*(sizeof(void *) + 2), "");
s->Indent();
s->PutCString("---------- --------------------------------------- ---------- ---------- ---------- ----------------------------\n");
@@ -689,7 +689,7 @@ SectionList::Dump (Stream *s, Process *process, bool show_header) const
const_iterator end = m_sections.end();
for (sect_iter = m_sections.begin(); sect_iter != end; ++sect_iter)
{
- (*sect_iter)->Dump(s, process);
+ (*sect_iter)->Dump(s, target);
}
if (show_header && !m_sections.empty())
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index 77b1d50e06d..6105080e27c 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -558,7 +558,7 @@ Value::GetValueAsData (ExecutionContext *exe_ctx, clang::ASTContext *ast_context
if (objfile)
{
Address so_addr(file_addr, objfile->GetSectionList());
- address = so_addr.GetLoadAddress (exe_ctx->process);
+ address = so_addr.GetLoadAddress (exe_ctx->target);
if (address != LLDB_INVALID_ADDRESS)
{
address_type = eAddressTypeLoad;
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 83206912ba3..cd087f8b90d 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -10,6 +10,8 @@
#include "lldb/Core/ValueObject.h"
// C Includes
+#include <stdlib.h>
+
// C++ Includes
// Other libraries and framework includes
#include "llvm/Support/raw_ostream.h"
@@ -27,8 +29,8 @@
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
-#include <stdlib.h>
using namespace lldb;
using namespace lldb_private;
@@ -495,10 +497,10 @@ ValueObject::GetSummaryAsCString (ExecutionContextScope *exe_scope)
case eAddressTypeLoad:
{
Address so_addr;
- Process *process = exe_scope->CalculateProcess();
- if (process != NULL)
+ Target *target = exe_scope->CalculateTarget();
+ if (target && target->GetSectionLoadList().IsEmpty() == false)
{
- if (process->ResolveLoadAddress(func_ptr_address, so_addr))
+ if (target->GetSectionLoadList().ResolveLoadAddress(func_ptr_address, so_addr))
{
so_addr.Dump (&sstr,
exe_scope,
diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp
index 9a432ab381c..86cc46d207b 100644
--- a/lldb/source/Core/ValueObjectVariable.cpp
+++ b/lldb/source/Core/ValueObjectVariable.cpp
@@ -110,7 +110,7 @@ ValueObjectVariable::UpdateValue (ExecutionContextScope *exe_scope)
SymbolContext sc;
variable->CalculateSymbolContext (&sc);
if (sc.function)
- loclist_base_load_addr = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (exe_ctx.process);
+ loclist_base_load_addr = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (exe_ctx.target);
}
Value old_value(m_value);
if (expr.Evaluate (&exe_ctx, GetClangAST(), loclist_base_load_addr, NULL, m_value, &m_error))
@@ -156,7 +156,7 @@ ValueObjectVariable::UpdateValue (ExecutionContextScope *exe_scope)
if (objfile)
{
Address so_addr(file_addr, objfile->GetSectionList());
- lldb::addr_t load_addr = so_addr.GetLoadAddress (exe_ctx.process);
+ lldb::addr_t load_addr = so_addr.GetLoadAddress (exe_ctx.target);
if (load_addr != LLDB_INVALID_ADDRESS)
{
m_value.SetValueType(Value::eValueTypeLoadAddress);
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 3846a7f7392..f685dd66da4 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -279,7 +279,7 @@ ClangExpressionDeclMap::GetFunctionAddress (const char *name,
else
return false;
- ptr = fun_address->GetLoadAddress(m_exe_ctx->process);
+ ptr = fun_address->GetLoadAddress(m_exe_ctx->target);
return true;
}
@@ -886,7 +886,7 @@ ClangExpressionDeclMap::GetVariableValue(ExecutionContext &exe_ctx,
{
SymbolContext var_sc;
var->CalculateSymbolContext (&var_sc);
- loclist_base_load_addr = var_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (exe_ctx.process);
+ loclist_base_load_addr = var_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (exe_ctx.target);
}
Error err;
@@ -929,7 +929,7 @@ ClangExpressionDeclMap::GetVariableValue(ExecutionContext &exe_ctx,
Address so_addr(var_location->GetScalar().ULongLong(), object_file->GetSectionList());
- lldb::addr_t load_addr = so_addr.GetLoadAddress(m_exe_ctx->process);
+ lldb::addr_t load_addr = so_addr.GetLoadAddress(m_exe_ctx->target);
var_location->GetScalar() = load_addr;
var_location->SetValueType(Value::eValueTypeLoadAddress);
@@ -1062,7 +1062,7 @@ ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
return;
}
- lldb::addr_t load_addr = fun_address->GetLoadAddress(m_exe_ctx->process);
+ lldb::addr_t load_addr = fun_address->GetLoadAddress(m_exe_ctx->target);
fun_location->SetValueType(Value::eValueTypeLoadAddress);
fun_location->GetScalar() = load_addr;
diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp
index c418fabbbd6..f789f1b6c5b 100644
--- a/lldb/source/Expression/ClangFunction.cpp
+++ b/lldb/source/Expression/ClangFunction.cpp
@@ -294,7 +294,7 @@ ClangFunction::WriteFunctionArguments (ExecutionContext &exe_ctx,
// FIXME: This is fake, and just assumes that it matches that architecture.
// Make a data extractor and put the address into the right byte order & size.
- uint64_t fun_addr = function_address.GetLoadAddress(exe_ctx.process);
+ uint64_t fun_addr = function_address.GetLoadAddress(exe_ctx.target);
int first_offset = m_member_offsets[0];
process->WriteMemory(args_addr_ref + first_offset, &fun_addr, 8, error);
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
index ba98cb5a450..963b1f3ea67 100644
--- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
+++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
@@ -139,14 +139,14 @@ DisassemblerLLVM::Instruction::Dump
int currentOpIndex = -1;
- lldb_private::Process *process = exe_ctx.process;
+ //lldb_private::Process *process = exe_ctx.process;
std::auto_ptr<RegisterReaderArg> rra;
if (!raw)
{
addr_t base_addr = LLDB_INVALID_ADDRESS;
- if (process && process->IsAlive())
- base_addr = inst_addr_ptr->GetLoadAddress (process);
+ if (exe_ctx.target && !exe_ctx.target->GetSectionLoadList().IsEmpty())
+ base_addr = inst_addr_ptr->GetLoadAddress (exe_ctx.target);
if (base_addr == LLDB_INVALID_ADDRESS)
base_addr = inst_addr_ptr->GetFileAddress ();
@@ -246,9 +246,9 @@ DisassemblerLLVM::Instruction::Dump
}
lldb_private::Address so_addr;
- if (process && process->IsAlive())
+ if (exe_ctx.target && !exe_ctx.target->GetSectionLoadList().IsEmpty())
{
- if (process->ResolveLoadAddress (operand_value, so_addr))
+ if (exe_ctx.target->GetSectionLoadList().ResolveLoadAddress (operand_value, so_addr))
so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescriptionNoModule, Address::DumpStyleSectionNameOffset);
}
else if (inst_addr_ptr)
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index 403ec49a3c2..a5956428692 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -218,7 +218,7 @@ DynamicLoaderMacOSXDYLD::ReadDYLDInfoFromMemoryAndSetNotificationCallback(lldb::
static ConstString g_dyld_all_image_infos ("dyld_all_image_infos");
const Symbol *symbol = dyld_module_sp->FindFirstSymbolWithNameAndType (g_dyld_all_image_infos, eSymbolTypeData);
if (symbol)
- m_dyld_all_image_infos_addr = symbol->GetValue().GetLoadAddress(m_process);
+ m_dyld_all_image_infos_addr = symbol->GetValue().GetLoadAddress(&m_process->GetTarget());
}
// Update all image infos
@@ -263,11 +263,11 @@ DynamicLoaderMacOSXDYLD::UpdateCommPageLoadAddress(Module *module)
if (section)
{
const addr_t new_section_load_addr = section->GetFileAddress ();
- const addr_t old_section_load_addr = m_process->GetSectionLoadAddress (section);
+ const addr_t old_section_load_addr = m_process->GetTarget().GetSectionLoadList().GetSectionLoadAddress (section);
if (old_section_load_addr == LLDB_INVALID_ADDRESS ||
old_section_load_addr != new_section_load_addr)
{
- if (m_process->SectionLoaded (section, section->GetFileAddress ()))
+ if (m_process->GetTarget().GetSectionLoadList().SetSectionLoadAddress (section, section->GetFileAddress ()))
changed = true;
}
}
@@ -336,11 +336,11 @@ DynamicLoaderMacOSXDYLD::UpdateImageLoadAddress (Module *module, struct DYLDImag
SectionSP section_sp(section_list->FindSectionByName(info.segments[i].name));
assert (section_sp.get() != NULL);
const addr_t new_section_load_addr = info.segments[i].addr + info.slide;
- const addr_t old_section_load_addr = m_process->GetSectionLoadAddress (section_sp.get());
+ const addr_t old_section_load_addr = m_process->GetTarget().GetSectionLoadList().GetSectionLoadAddress (section_sp.get());
if (old_section_load_addr == LLDB_INVALID_ADDRESS ||
old_section_load_addr != new_section_load_addr)
{
- if (m_process->SectionLoaded (section_sp.get(), new_section_load_addr))
+ if (m_process->GetTarget().GetSectionLoadList().SetSectionLoadAddress (section_sp.get(), new_section_load_addr))
changed = true;
}
}
@@ -372,7 +372,7 @@ DynamicLoaderMacOSXDYLD::UnloadImageLoadAddress (Module *module, struct DYLDImag
SectionSP section_sp(section_list->FindSectionByName(info.segments[i].name));
assert (section_sp.get() != NULL);
const addr_t old_section_load_addr = info.segments[i].addr + info.slide;
- if (m_process->SectionUnloaded (section_sp.get(), old_section_load_addr))
+ if (m_process->GetTarget().GetSectionLoadList().SetSectionUnloaded (section_sp.get(), old_section_load_addr))
changed = true;
}
}
@@ -1008,7 +1008,7 @@ DynamicLoaderMacOSXDYLD::SetNotificationBreakpoint ()
// breakpoint gets hit. We will use this to track when shared
// libraries get loaded/unloaded.
- if (m_process->ResolveLoadAddress(m_dyld_all_image_infos.notification, so_addr))
+ if (m_process->GetTarget().GetSectionLoadList().ResolveLoadAddress(m_dyld_all_image_infos.notification, so_addr))
{
Breakpoint *dyld_break = m_process->GetTarget().CreateBreakpoint (so_addr, true).get();
dyld_break->SetCallback (DynamicLoaderMacOSXDYLD::NotifyBreakpointHit, this, true);
@@ -1109,7 +1109,7 @@ DynamicLoaderMacOSXDYLD::GetStepThroughTrampolinePlan (Thread &thread, bool stop
if (target_symbols.GetContextAtIndex(i, context))
{
context.GetAddressRange (eSymbolContextEverything, addr_range);
- lldb::addr_t load_addr = addr_range.GetBaseAddress().GetLoadAddress(&(thread.GetProcess()));
+ lldb::addr_t load_addr = addr_range.GetBaseAddress().GetLoadAddress(&thread.GetProcess().GetTarget());
addresses[i] = load_addr;
}
}
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.cpp
index a1126488e19..943e8bab890 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.cpp
@@ -84,13 +84,14 @@ ObjCTrampolineHandler::ObjCTrampolineHandler (ProcessSP process_sp, ModuleSP obj
ConstString get_impl_name("class_getMethodImplementation");
ConstString get_impl_stret_name("class_getMethodImplementation_stret");
+ Target *target = m_process_sp ? &m_process_sp->GetTarget() : NULL;
const Symbol *class_getMethodImplementation = m_objc_module_sp->FindFirstSymbolWithNameAndType (get_impl_name, eSymbolTypeCode);
const Symbol *class_getMethodImplementation_stret = m_objc_module_sp->FindFirstSymbolWithNameAndType (get_impl_stret_name, eSymbolTypeCode);
if (class_getMethodImplementation)
- m_impl_fn_addr = class_getMethodImplementation->GetValue().GetLoadAddress(m_process_sp.get());
+ m_impl_fn_addr = class_getMethodImplementation->GetValue().GetLoadAddress(target);
if (class_getMethodImplementation_stret)
- m_impl_stret_fn_addr = class_getMethodImplementation_stret->GetValue().GetLoadAddress(m_process_sp.get());
+ m_impl_stret_fn_addr = class_getMethodImplementation_stret->GetValue().GetLoadAddress(target);
// FIXME: Do some kind of logging here.
if (m_impl_fn_addr == LLDB_INVALID_ADDRESS || m_impl_stret_fn_addr == LLDB_INVALID_ADDRESS)
@@ -111,7 +112,7 @@ ObjCTrampolineHandler::ObjCTrampolineHandler (ProcessSP process_sp, ModuleSP obj
// Problem is we also need to lookup the dispatch function. For now we could have a side table of stret & non-stret
// dispatch functions. If that's as complex as it gets, we're fine.
- lldb::addr_t sym_addr = msgSend_symbol->GetValue().GetLoadAddress(m_process_sp.get());
+ lldb::addr_t sym_addr = msgSend_symbol->GetValue().GetLoadAddress(target);
m_msgSend_map.insert(std::pair<lldb::addr_t, int>(sym_addr, i));
}
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
index a9920bb09a9..1ffe45b07b9 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
@@ -115,7 +115,7 @@ ThreadMacOSX::GetDispatchQueueName()
lldb::addr_t dispatch_queue_offsets_addr = LLDB_INVALID_ADDRESS;
const Symbol *dispatch_queue_offsets_symbol = module_sp->FindFirstSymbolWithNameAndType (ConstString("dispatch_queue_offsets"), eSymbolTypeData);
if (dispatch_queue_offsets_symbol)
- dispatch_queue_offsets_addr = dispatch_queue_offsets_symbol->GetValue().GetLoadAddress(&GetProcess());
+ dispatch_queue_offsets_addr = dispatch_queue_offsets_symbol->GetValue().GetLoadAddress(&m_process.GetTarget());
if (dispatch_queue_offsets_addr == LLDB_INVALID_ADDRESS)
return NULL;
diff --git a/lldb/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp b/lldb/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp
index 902e22c3431..7f6f1759bdb 100644
--- a/lldb/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp
+++ b/lldb/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp
@@ -69,19 +69,20 @@ get_proc_name (lldb_private::unw_addr_space_t as, lldb_private::unw_word_t ip, c
{
if (arg == 0)
return -1;
- Thread *th = (Thread *) arg;
+ Thread *thread = (Thread *) arg;
+ Target &target = thread->GetProcess().GetTarget();
Address addr;
- if (!th->GetProcess().ResolveLoadAddress(ip, addr))
+ if (!target.GetSectionLoadList().ResolveLoadAddress(ip, addr))
return -1;
SymbolContext sc;
- if (!th->GetProcess().GetTarget().GetImages().ResolveSymbolContextForAddress (addr, eSymbolContextFunction, sc))
+ if (!target.GetImages().ResolveSymbolContextForAddress (addr, eSymbolContextFunction, sc))
return -1;
if (!sc.symbol)
return -1;
strlcpy (bufp, sc.symbol->GetMangled().GetMangledName().AsCString(""), buf_len);
if (offp)
- *offp = addr.GetLoadAddress(&th->GetProcess()) - sc.symbol->GetValue().GetLoadAddress(&th->GetProcess());
+ *offp = addr.GetLoadAddress(&target) - sc.symbol->GetValue().GetLoadAddress(&target);
return UNW_ESUCCESS;
}
@@ -93,13 +94,14 @@ find_image_info (lldb_private::unw_addr_space_t as, lldb_private::unw_word_t loa
{
if (arg == 0)
return -1;
- Thread *th = (Thread *) arg;
+ Thread *thread = (Thread *) arg;
+ Target &target = thread->GetProcess().GetTarget();
Address addr;
- if (!th->GetProcess().ResolveLoadAddress(load_addr, addr))
+ if (!target.GetSectionLoadList().ResolveLoadAddress(load_addr, addr))
return -1;
SymbolContext sc;
- if (!th->GetProcess().GetTarget().GetImages().ResolveSymbolContextForAddress (addr, eSymbolContextModule, sc))
+ if (!target.GetImages().ResolveSymbolContextForAddress (addr, eSymbolContextModule, sc))
return -1;
SectionList *sl = sc.module_sp->GetObjectFile()->GetSectionList();
@@ -108,14 +110,14 @@ find_image_info (lldb_private::unw_addr_space_t as, lldb_private::unw_word_t loa
if (!text_segment_sp)
return -1;
- *mh = text_segment_sp->GetLoadBaseAddress (&th->GetProcess());
- *text_start = text_segment_sp->GetLoadBaseAddress (&th->GetProcess());
+ *mh = text_segment_sp->GetLoadBaseAddress (&target);
+ *text_start = text_segment_sp->GetLoadBaseAddress (&target);
*text_end = *text_start + text_segment_sp->GetByteSize();
static ConstString g_section_name_eh_frame ("__eh_frame");
SectionSP eh_frame_section_sp = text_segment_sp->GetChildren().FindSectionByName(g_section_name_eh_frame);
if (eh_frame_section_sp.get()) {
- *eh_frame = eh_frame_section_sp->GetLoadBaseAddress (&th->GetProcess());
+ *eh_frame = eh_frame_section_sp->GetLoadBaseAddress (&target);
*eh_frame_len = eh_frame_section_sp->GetByteSize();
} else {
*eh_frame = 0;
@@ -125,7 +127,7 @@ find_image_info (lldb_private::unw_addr_space_t as, lldb_private::unw_word_t loa
static ConstString g_section_name_unwind_info ("__unwind_info");
SectionSP unwind_info_section_sp = text_segment_sp->GetChildren().FindSectionByName(g_section_name_unwind_info);
if (unwind_info_section_sp.get()) {
- *compact_unwind_start = unwind_info_section_sp->GetLoadBaseAddress (&th->GetProcess());
+ *compact_unwind_start = unwind_info_section_sp->GetLoadBaseAddress (&target);
*compact_unwind_len = unwind_info_section_sp->GetByteSize();
} else {
*compact_unwind_start = 0;
@@ -139,17 +141,18 @@ get_proc_bounds (lldb_private::unw_addr_space_t as, lldb_private::unw_word_t ip,
{
if (arg == 0)
return -1;
- Thread *th = (Thread *) arg;
+ Thread *thread = (Thread *) arg;
+ Target &target = thread->GetProcess().GetTarget();
Address addr;
- if (!th->GetProcess().ResolveLoadAddress(ip, addr))
+ if (!target.GetSectionLoadList().ResolveLoadAddress(ip, addr))
return -1;
SymbolContext sc;
- if (!th->GetProcess().GetTarget().GetImages().ResolveSymbolContextForAddress (addr, eSymbolContextFunction | eSymbolContextSymbol, sc))
+ if (!target.GetImages().ResolveSymbolContextForAddress (addr, eSymbolContextFunction | eSymbolContextSymbol, sc))
return -1;
if (sc.function)
{
lldb::addr_t start, len;
- start = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress(&th->GetProcess());
+ start = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress(&target);
len = sc.function->GetAddressRange().GetByteSize();
if (start == LLDB_INVALID_ADDRESS || len == LLDB_INVALID_ADDRESS)
return -1;
@@ -160,7 +163,7 @@ get_proc_bounds (lldb_private::unw_addr_space_t as, lldb_private::unw_word_t ip,
if (sc.symbol)
{
lldb::addr_t start, len;
- start = sc.symbol->GetAddressRangeRef().GetBaseAddress().GetLoadAddress(&th->GetProcess());
+ start = sc.symbol->GetAddressRangeRef().GetBaseAddress().GetLoadAddress(&target);
len = sc.symbol->GetAddressRangeRef().GetByteSize();
if (start == LLDB_INVALID_ADDRESS)
return -1;
@@ -260,8 +263,9 @@ instruction_length (lldb_private::unw_addr_space_t as, lldb_private::unw_word_t
if (arg == 0)
return -1;
Thread *thread = (Thread *) arg;
-
- const ArchSpec::CPU arch_cpu = thread->GetProcess().GetTarget().GetArchitecture ().GetGenericCPUType();
+ Target &target = thread->GetProcess().GetTarget();
+
+ const ArchSpec::CPU arch_cpu = target.GetArchitecture ().GetGenericCPUType();
if (arch_cpu == ArchSpec::eCPU_i386)
{
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index bbd8f49f240..be8aaf7ccd6 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -398,8 +398,7 @@ GDBRemoteCommunication::SendPacketNoLock (const char *payload, size_t payload_le
ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS, "error: failed to send packet: %s", packet.GetData());
}
return bytes_written;
- }
- //m_error.SetErrorString("Not connected.");
+ }
return 0;
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index c11de4fd8bd..496deba1820 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -2246,7 +2246,7 @@ ProcessGDBRemote::GetDispatchQueueNameForThread
const Symbol *dispatch_queue_offsets_symbol = module_sp->FindFirstSymbolWithNameAndType (ConstString("dispatch_queue_offsets"), eSymbolTypeData);
if (dispatch_queue_offsets_symbol)
- m_dispatch_queue_offsets_addr = dispatch_queue_offsets_symbol->GetValue().GetLoadAddress(this);
+ m_dispatch_queue_offsets_addr = dispatch_queue_offsets_symbol->GetValue().GetLoadAddress(&m_target);
if (m_dispatch_queue_offsets_addr == LLDB_INVALID_ADDRESS)
return NULL;
diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp
index 8ad775f4fed..0096c5312dc 100644
--- a/lldb/source/Symbol/Block.cpp
+++ b/lldb/source/Symbol/Block.cpp
@@ -36,7 +36,7 @@ Block::~Block ()
}
void
-Block::GetDescription(Stream *s, Function *function, lldb::DescriptionLevel level, Process *process) const
+Block::GetDescription(Stream *s, Function *function, lldb::DescriptionLevel level, Target *target) const
{
*s << "id = " << ((const UserID&)*this);
@@ -45,8 +45,8 @@ Block::GetDescription(Stream *s, Function *function, lldb::DescriptionLevel leve
{
addr_t base_addr = LLDB_INVALID_ADDRESS;
- if (process)
- base_addr = function->GetAddressRange().GetBaseAddress().GetLoadAddress(process);
+ if (target)
+ base_addr = function->GetAddressRange().GetBaseAddress().GetLoadAddress(target);
if (base_addr == LLDB_INVALID_ADDRESS)
base_addr = function->GetAddressRange().GetBaseAddress().GetFileAddress();
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index 43a668fc35a..8989f2e354d 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -326,7 +326,7 @@ Function::GetCompileUnit() const
void
-Function::GetDescription(Stream *s, lldb::DescriptionLevel level, Process *process)
+Function::GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target)
{
Type* func_type = GetType();
*s << "id = " << (const UserID&)*this << ", name = \"" << func_type->GetName() << "\", range = ";
@@ -336,7 +336,7 @@ Function::GetDescription(Stream *s, lldb::DescriptionLevel level, Process *proce
fallback_style = Address::DumpStyleModuleWithFileAddress;
else
fallback_style = Address::DumpStyleFileAddress;
- GetAddressRange().Dump(s, process, Address::DumpStyleLoadAddress, fallback_style);
+ GetAddressRange().Dump(s, target, Address::DumpStyleLoadAddress, fallback_style);
}
void
diff --git a/lldb/source/Symbol/LineEntry.cpp b/lldb/source/Symbol/LineEntry.cpp
index 88805924866..d4b56865f12 100644
--- a/lldb/source/Symbol/LineEntry.cpp
+++ b/lldb/source/Symbol/LineEntry.cpp
@@ -10,6 +10,7 @@
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
using namespace lldb_private;
@@ -100,7 +101,7 @@ bool
LineEntry::Dump
(
Stream *s,
- Process *process,
+ Target *target,
bool show_file,
Address::DumpStyle style,
Address::DumpStyle fallback_style,
@@ -110,14 +111,14 @@ LineEntry::Dump
if (show_range)
{
// Show address range
- if (!range.Dump(s, process, style, fallback_style))
+ if (!range.Dump(s, target, style, fallback_style))
return false;
}
else
{
// Show address only
if (!range.GetBaseAddress().Dump(s,
- process,
+ target,
style,
fallback_style))
return false;
@@ -146,18 +147,18 @@ LineEntry::Dump
}
bool
-LineEntry::GetDescription (Stream *s, lldb::DescriptionLevel level, CompileUnit* cu, Process *process, bool show_address_only) const
+LineEntry::GetDescription (Stream *s, lldb::DescriptionLevel level, CompileUnit* cu, Target *target, bool show_address_only) const
{
if (level == lldb::eDescriptionLevelBrief || level == lldb::eDescriptionLevelFull)
{
if (show_address_only)
{
- range.GetBaseAddress().Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
+ range.GetBaseAddress().Dump(s, target, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
}
else
{
- range.Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
+ range.Dump(s, target, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
}
*s << ": " << file;
@@ -195,7 +196,7 @@ LineEntry::GetDescription (Stream *s, lldb::DescriptionLevel level, CompileUnit*
}
else
{
- return Dump (s, process, true, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress, true);
+ return Dump (s, target, true, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress, true);
}
return true;
}
diff --git a/lldb/source/Symbol/LineTable.cpp b/lldb/source/Symbol/LineTable.cpp
index 55c13f3aa10..9600eb84921 100644
--- a/lldb/source/Symbol/LineTable.cpp
+++ b/lldb/source/Symbol/LineTable.cpp
@@ -387,7 +387,7 @@ LineTable::FindLineEntryIndexByFileIndex (uint32_t start_idx, uint32_t file_idx,
}
void
-LineTable::Dump (Stream *s, Process *process, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_line_ranges)
+LineTable::Dump (Stream *s, Target *target, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_line_ranges)
{
const size_t count = m_entries.size();
LineEntry line_entry;
@@ -395,7 +395,7 @@ LineTable::Dump (Stream *s, Process *process, Address::DumpStyle style, Address:
for (size_t idx = 0; idx < count; ++idx)
{
ConvertEntryAtIndexToLineEntry (idx, line_entry);
- line_entry.Dump (s, process, prev_file != line_entry.file, style, fallback_style, show_line_ranges);
+ line_entry.Dump (s, target, prev_file != line_entry.file, style, fallback_style, show_line_ranges);
s->EOL();
prev_file = line_entry.file;
}
@@ -403,14 +403,14 @@ LineTable::Dump (Stream *s, Process *process, Address::DumpStyle style, Address:
void
-LineTable::GetDescription (Stream *s, Process *process, DescriptionLevel level)
+LineTable::GetDescription (Stream *s, Target *target, DescriptionLevel level)
{
const size_t count = m_entries.size();
LineEntry line_entry;
for (size_t idx = 0; idx < count; ++idx)
{
ConvertEntryAtIndexToLineEntry (idx, line_entry);
- line_entry.GetDescription (s, level, m_comp_unit, process, true);
+ line_entry.GetDescription (s, level, m_comp_unit, target, true);
s->EOL();
}
}
diff --git a/lldb/source/Symbol/Symbol.cpp b/lldb/source/Symbol/Symbol.cpp
index e176df6b9e7..bd8246b8b64 100644
--- a/lldb/source/Symbol/Symbol.cpp
+++ b/lldb/source/Symbol/Symbol.cpp
@@ -13,6 +13,7 @@
#include "lldb/Core/Section.h"
#include "lldb/Core/Stream.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
@@ -173,7 +174,7 @@ Symbol::IsTrampoline () const
}
void
-Symbol::GetDescription (Stream *s, lldb::DescriptionLevel level, Process *process) const
+Symbol::GetDescription (Stream *s, lldb::DescriptionLevel level, Target *target) const
{
*s << "id = " << (const UserID&)*this << ", name = \"" << m_mangled.GetName() << '"';
const Section *section = m_addr_range.GetBaseAddress().GetSection();
@@ -184,12 +185,12 @@ Symbol::GetDescription (Stream *s, lldb::DescriptionLevel level, Process *proces
if (m_addr_range.GetByteSize() > 0)
{
s->PutCString (", range = ");
- m_addr_range.Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
+ m_addr_range.Dump(s, target, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
}
else
{
s->PutCString (", address = ");
- m_addr_range.GetBaseAddress().Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
+ m_addr_range.GetBaseAddress().Dump(s, target, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
}
}
else
@@ -203,7 +204,7 @@ Symbol::GetDescription (Stream *s, lldb::DescriptionLevel level, Process *proces
}
void
-Symbol::Dump(Stream *s, Process *process, uint32_t index) const
+Symbol::Dump(Stream *s, Target *target, uint32_t index) const
{
// s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
// s->Indent();
@@ -224,7 +225,7 @@ Symbol::Dump(Stream *s, Process *process, uint32_t index) const
s->PutChar(' ');
- if (!m_addr_range.GetBaseAddress().Dump(s, process, Address::DumpStyleLoadAddress))
+ if (!m_addr_range.GetBaseAddress().Dump(s, target, Address::DumpStyleLoadAddress))
s->Printf("%*s", 18, "");
const char *format = m_size_is_sibling ?
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 7bc54122382..cecfaa5fe08 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -197,7 +197,7 @@ SymbolContext::DumpStopContext
}
void
-SymbolContext::GetDescription(Stream *s, lldb::DescriptionLevel level, Process *process) const
+SymbolContext::GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target) const
{
if (module_sp)
{
@@ -219,7 +219,7 @@ SymbolContext::GetDescription(Stream *s, lldb::DescriptionLevel level, Process *
if (function != NULL)
{
s->Indent(" Function: ");
- function->GetDescription (s, level, process);
+ function->GetDescription (s, level, target);
s->EOL();
Type *func_type = function->GetType();
@@ -251,7 +251,7 @@ SymbolContext::GetDescription(Stream *s, lldb::DescriptionLevel level, Process *
s->Indent(" Blocks: ");
else
s->Indent(" ");
- (*pos)->GetDescription(s, function, level, process);
+ (*pos)->GetDescription(s, function, level, target);
s->EOL();
}
}
@@ -259,14 +259,14 @@ SymbolContext::GetDescription(Stream *s, lldb::DescriptionLevel level, Process *
if (line_entry.IsValid())
{
s->Indent(" LineEntry: ");
- line_entry.GetDescription (s, level, comp_unit, process, false);
+ line_entry.GetDescription (s, level, comp_unit, target, false);
s->EOL();
}
if (symbol != NULL)
{
s->Indent(" Symbol: ");
- symbol->GetDescription(s, level, process);
+ symbol->GetDescription(s, level, target);
s->EOL();
}
}
@@ -287,7 +287,7 @@ SymbolContext::GetResolvedMask () const
void
-SymbolContext::Dump(Stream *s, Process *process) const
+SymbolContext::Dump(Stream *s, Target *target) const
{
*s << (void *)this << ": ";
s->Indent();
@@ -310,7 +310,7 @@ SymbolContext::Dump(Stream *s, Process *process) const
if (function != NULL)
{
*s << " {0x" << function->GetID() << "} " << function->GetType()->GetName() << ", address-range = ";
- function->GetAddressRange().Dump(s, process, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
+ function->GetAddressRange().Dump(s, target, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
s->EOL();
s->Indent();
Type* func_type = function->GetType();
@@ -331,7 +331,7 @@ SymbolContext::Dump(Stream *s, Process *process) const
s->EOL();
s->Indent();
*s << "LineEntry = ";
- line_entry.Dump (s, process, true, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress, true);
+ line_entry.Dump (s, target, true, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress, true);
s->EOL();
s->Indent();
*s << "Symbol = " << (void *)symbol;
@@ -494,7 +494,7 @@ SymbolContextList::Clear()
}
void
-SymbolContextList::Dump(Stream *s, Process *process) const
+SymbolContextList::Dump(Stream *s, Target *target) const
{
*s << (void *)this << ": ";
@@ -506,7 +506,7 @@ SymbolContextList::Dump(Stream *s, Process *process) const
collection::const_iterator pos, end = m_symbol_contexts.end();
for (pos = m_symbol_contexts.begin(); pos != end; ++pos)
{
- pos->Dump(s, process);
+ pos->Dump(s, target);
}
s->IndentLess();
}
diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp
index 25f1d7d4f28..8326a445d13 100644
--- a/lldb/source/Symbol/Symtab.cpp
+++ b/lldb/source/Symbol/Symtab.cpp
@@ -62,7 +62,7 @@ Symtab::GetNumSymbols() const
}
void
-Symtab::Dump(Stream *s, Process *process) const
+Symtab::Dump(Stream *s, Target *target) const
{
const_iterator pos;
s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
@@ -92,14 +92,14 @@ Symtab::Dump(Stream *s, Process *process) const
for (pos = m_symbols.begin(); pos != end; ++pos)
{
s->Indent();
- pos->Dump(s, process, std::distance(begin, pos));
+ pos->Dump(s, target, std::distance(begin, pos));
}
}
s->IndentLess ();
}
void
-Symtab::Dump(Stream *s, Process *process, std::vector<uint32_t>& indexes) const
+Symtab::Dump(Stream *s, Target *target, std::vector<uint32_t>& indexes) const
{
const size_t num_symbols = GetNumSymbols();
s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
@@ -118,7 +118,7 @@ Symtab::Dump(Stream *s, Process *process, std::vector<uint32_t>& indexes) const
if (idx < num_symbols)
{
s->Indent();
- m_symbols[idx].Dump(s, process, idx);
+ m_symbols[idx].Dump(s, target, idx);
}
}
}
diff --git a/lldb/source/Symbol/UnwindPlan.cpp b/lldb/source/Symbol/UnwindPlan.cpp
index 45857d67432..cc4dcf24fc6 100644
--- a/lldb/source/Symbol/UnwindPlan.cpp
+++ b/lldb/source/Symbol/UnwindPlan.cpp
@@ -8,8 +8,9 @@
//===----------------------------------------------------------------------===//
#include "lldb/Symbol/UnwindPlan.h"
-#include "lldb/Target/Thread.h"
+#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/Thread.h"
using namespace lldb;
using namespace lldb_private;
@@ -285,10 +286,10 @@ UnwindPlan::PlanValidAtAddress (Address addr)
}
void
-UnwindPlan::Dump (Stream& s, Process* process, Thread *thread) const
+UnwindPlan::Dump (Stream& s, Thread *thread) const
{
s.Printf ("Address range of this UnwindPlan: ");
- m_plan_valid_address_range.Dump (&s, process, Address::DumpStyleSectionNameOffset);
+ m_plan_valid_address_range.Dump (&s, &thread->GetProcess().GetTarget(), Address::DumpStyleSectionNameOffset);
s.Printf ("\n");
s.Printf ("UnwindPlan register kind %d", m_register_kind);
switch (m_register_kind)
diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index 4ab9fa30bec..27af65ff0be 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -14,9 +14,11 @@
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
@@ -155,14 +157,14 @@ Variable::IsInScope (StackFrame *frame)
// Currently we only support functions that have things with
// locations lists. If this expands, we will need to add support
assert (sc.function);
- Process *process = &frame->GetThread().GetProcess();
- addr_t loclist_base_load_addr = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (process);
+ Target *target = &frame->GetThread().GetProcess().GetTarget();
+ addr_t loclist_base_load_addr = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (target);
if (loclist_base_load_addr == LLDB_INVALID_ADDRESS)
return false;
// It is a location list. We just need to tell if the location
// list contains the current address when converted to a load
// address
- return m_location.LocationListContainsAddress (loclist_base_load_addr, frame->GetFrameCodeAddress().GetLoadAddress (process));
+ return m_location.LocationListContainsAddress (loclist_base_load_addr, frame->GetFrameCodeAddress().GetLoadAddress (target));
}
else
{
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 46b4e27d00b..c86b74cc77f 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -66,7 +66,6 @@ Process::Process(Target &target, Listener &listener) :
Broadcaster ("Process"),
ProcessInstanceSettings (*(Process::GetSettingsController().get())),
m_target (target),
- m_section_load_info (),
m_public_state (eStateUnloaded),
m_private_state (eStateUnloaded),
m_private_state_broadcaster ("lldb.process.internal_state_broadcaster"),
@@ -529,7 +528,7 @@ Process::EnableBreakpointSiteByID (lldb::user_id_t break_id)
lldb::break_id_t
Process::CreateBreakpointSite (BreakpointLocationSP &owner, bool use_hardware)
{
- const addr_t load_addr = owner->GetAddress().GetLoadAddress (this);
+ const addr_t load_addr = owner->GetAddress().GetLoadAddress (&m_target);
if (load_addr != LLDB_INVALID_ADDRESS)
{
BreakpointSiteSP bp_site_sp;
@@ -1575,103 +1574,6 @@ Process::RunPrivateStateThread ()
return NULL;
}
-addr_t
-Process::GetSectionLoadAddress (const Section *section) const
-{
- // TODO: add support for the same section having multiple load addresses
- addr_t section_load_addr = LLDB_INVALID_ADDRESS;
- if (m_section_load_info.GetFirstKeyForValue (section, section_load_addr))
- return section_load_addr;
- return LLDB_INVALID_ADDRESS;
-}
-
-bool
-Process::SectionLoaded (const Section *section, addr_t load_addr)
-{
- Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_SHLIB | LIBLLDB_LOG_VERBOSE);
-
- if (log)
- log->Printf ("Process::%s (section = %p (%s.%s), load_addr = 0x%16.16llx)",
- __FUNCTION__,
- section,
- section->GetModule()->GetFileSpec().GetFilename().AsCString(),
- section->GetName().AsCString(),
- load_addr);
-
-
- const Section *existing_section = NULL;
- Mutex::Locker locker(m_section_load_info.GetMutex());
-
- if (m_section_load_info.GetValueForKeyNoLock (load_addr, existing_section))
- {
- if (existing_section == section)
- return false; // No change
- }
- m_section_load_info.SetValueForKeyNoLock (load_addr, section);
- return true; // Changed
-}
-
-size_t
-Process::SectionUnloaded (const Section *section)
-{
- Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_SHLIB | LIBLLDB_LOG_VERBOSE);
-
- if (log)
- log->Printf ("Process::%s (section = %p (%s.%s))",
- __FUNCTION__,
- section,
- section->GetModule()->GetFileSpec().GetFilename().AsCString(),
- section->GetName().AsCString());
-
- Mutex::Locker locker(m_section_load_info.GetMutex());
-
- size_t unload_count = 0;
- addr_t section_load_addr;
- while (m_section_load_info.GetFirstKeyForValueNoLock (section, section_load_addr))
- {
- unload_count += m_section_load_info.EraseNoLock (section_load_addr);
- }
- return unload_count;
-}
-
-bool
-Process::SectionUnloaded (const Section *section, addr_t load_addr)
-{
- Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_SHLIB | LIBLLDB_LOG_VERBOSE);
-
- if (log)
- log->Printf ("Process::%s (section = %p (%s.%s), load_addr = 0x%16.16llx)",
- __FUNCTION__,
- section,
- section->GetModule()->GetFileSpec().GetFilename().AsCString(),
- section->GetName().AsCString(),
- load_addr);
-
- return m_section_load_info.Erase (load_addr) == 1;
-}
-
-
-bool
-Process::ResolveLoadAddress (addr_t load_addr, Address &so_addr) const
-{
- addr_t section_load_addr = LLDB_INVALID_ADDRESS;
- const Section *section = NULL;
-
- // First find the top level section that this load address exists in
- if (m_section_load_info.LowerBound (load_addr, section_load_addr, section, true))
- {
- addr_t offset = load_addr - section_load_addr;
- if (offset < section->GetByteSize())
- {
- // We have found the top level section, now we need to find the
- // deepest child section.
- return section->ResolveContainedAddress (offset, so_addr);
- }
- }
- so_addr.Clear();
- return false;
-}
-
//------------------------------------------------------------------
// Process Event Data
//------------------------------------------------------------------
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index e90c73895ca..bd9df621e6e 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -115,7 +115,7 @@ StackFrame::StackFrame
m_unwind_frame_index (unwind_frame_index),
m_thread (thread),
m_reg_context_sp (reg_context_sp),
- m_id (pc_addr.GetLoadAddress (&thread.GetProcess()), cfa, NULL),
+ m_id (pc_addr.GetLoadAddress (&thread.GetProcess().GetTarget()), cfa, NULL),
m_frame_code_addr (pc_addr),
m_sc (),
m_flags (),
@@ -213,7 +213,7 @@ StackFrame::GetFrameCodeAddress()
// Resolve the PC into a temporary address because if ResolveLoadAddress
// fails to resolve the address, it will clear the address object...
Address resolved_pc;
- if (m_thread.GetProcess().ResolveLoadAddress(m_frame_code_addr.GetOffset(), resolved_pc))
+ if (m_thread.GetProcess().GetTarget().GetSectionLoadList().ResolveLoadAddress(m_frame_code_addr.GetOffset(), resolved_pc))
{
m_frame_code_addr = resolved_pc;
const Section *section = m_frame_code_addr.GetSection();
@@ -488,7 +488,7 @@ StackFrame::GetFrameBaseValue (Scalar &frame_base, Error *error_ptr)
Value expr_value;
addr_t loclist_base_addr = LLDB_INVALID_ADDRESS;
if (m_sc.function->GetFrameBaseExpression().IsLocationList())
- loclist_base_addr = m_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (&m_thread.GetProcess());
+ loclist_base_addr = m_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (&m_thread.GetProcess().GetTarget());
if (m_sc.function->GetFrameBaseExpression().Evaluate(&exe_ctx, NULL, loclist_base_addr, NULL, expr_value, &m_frame_base_error) == false)
{
@@ -629,7 +629,7 @@ StackFrame::Dump (Stream *strm, bool show_frame_index, bool show_fullpaths)
if (show_frame_index)
strm->Printf("frame #%u: ", m_frame_index);
- strm->Printf("0x%0*llx ", m_thread.GetProcess().GetAddressByteSize() * 2, GetFrameCodeAddress().GetLoadAddress(&m_thread.GetProcess()));
+ strm->Printf("0x%0*llx ", m_thread.GetProcess().GetAddressByteSize() * 2, GetFrameCodeAddress().GetLoadAddress(&m_thread.GetProcess().GetTarget()));
GetSymbolContext(eSymbolContextEverything);
const bool show_module = true;
const bool show_inline = true;
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 3d206ea5d33..7d8eb8b9453 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -37,6 +37,7 @@ Target::Target(Debugger &debugger) :
Broadcaster("Target"),
m_debugger (debugger),
m_images(),
+ m_section_load_list (),
m_breakpoint_list (false),
m_internal_breakpoint_list (true),
m_process_sp(),
@@ -162,10 +163,8 @@ Target::CreateBreakpoint (lldb::addr_t addr, bool internal)
// Attempt to resolve our load address if possible, though it is ok if
// it doesn't resolve to section/offset.
- Process *process = GetProcessSP().get();
// Try and resolve as a load address if possible
- if (process)
- process->ResolveLoadAddress(addr, so_addr);
+ m_section_load_list.ResolveLoadAddress(addr, so_addr);
if (!so_addr.IsValid())
{
// The address didn't resolve, so just set this as an absolute address
@@ -567,7 +566,7 @@ Target::ReadMemory (const Address& addr, void *dst, size_t dst_len, Error &error
{
if (process_is_valid)
{
- m_process_sp->ResolveLoadAddress (addr.GetOffset(), resolved_addr);
+ m_section_load_list.ResolveLoadAddress (addr.GetOffset(), resolved_addr);
}
else
{
@@ -578,7 +577,7 @@ Target::ReadMemory (const Address& addr, void *dst, size_t dst_len, Error &error
if (process_is_valid)
{
- lldb::addr_t load_addr = resolved_addr.GetLoadAddress(m_process_sp.get());
+ lldb::addr_t load_addr = resolved_addr.GetLoadAddress (this);
if (load_addr == LLDB_INVALID_ADDRESS)
{
if (resolved_addr.GetModule() && resolved_addr.GetModule()->GetFileSpec())
diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp
index 7dc304756a1..f8d7f6a6bf6 100644
--- a/lldb/source/Target/ThreadPlanCallFunction.cpp
+++ b/lldb/source/Target/ThreadPlanCallFunction.cpp
@@ -66,13 +66,13 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
contexts.GetContextAtIndex(0, context);
m_start_addr = context.symbol->GetValue();
- lldb::addr_t StartLoadAddr = m_start_addr.GetLoadAddress(&process);
+ lldb::addr_t StartLoadAddr = m_start_addr.GetLoadAddress(&target);
if (!thread.SaveFrameZeroState(m_register_backup))
return;
m_function_addr = function;
- lldb::addr_t FunctionLoadAddr = m_function_addr.GetLoadAddress(&process);
+ lldb::addr_t FunctionLoadAddr = m_function_addr.GetLoadAddress(&target);
if (!abi->PrepareTrivialCall(thread,
spBelowRedZone,
@@ -120,13 +120,13 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
contexts.GetContextAtIndex(0, context);
m_start_addr = context.symbol->GetValue();
- lldb::addr_t StartLoadAddr = m_start_addr.GetLoadAddress(&process);
+ lldb::addr_t StartLoadAddr = m_start_addr.GetLoadAddress(&target);
if(!thread.SaveFrameZeroState(m_register_backup))
return;
m_function_addr = function;
- lldb::addr_t FunctionLoadAddr = m_function_addr.GetLoadAddress(&process);
+ lldb::addr_t FunctionLoadAddr = m_function_addr.GetLoadAddress(&target);
if (!abi->PrepareNormalCall(thread,
spBelowRedZone,
@@ -152,9 +152,9 @@ ThreadPlanCallFunction::GetDescription (Stream *s, lldb::DescriptionLevel level)
else
{
if (m_args)
- s->Printf("Thread plan to call 0x%llx with parsed arguments", m_function_addr.GetLoadAddress(&m_process), m_arg_addr);
+ s->Printf("Thread plan to call 0x%llx with parsed arguments", m_function_addr.GetLoadAddress(&m_process.GetTarget()), m_arg_addr);
else
- s->Printf("Thread plan to call 0x%llx void * argument at: 0x%llx", m_function_addr.GetLoadAddress(&m_process), m_arg_addr);
+ s->Printf("Thread plan to call 0x%llx void * argument at: 0x%llx", m_function_addr.GetLoadAddress(&m_process.GetTarget()), m_arg_addr);
}
}
diff --git a/lldb/source/Target/ThreadPlanRunToAddress.cpp b/lldb/source/Target/ThreadPlanRunToAddress.cpp
index edfe7e5900d..5560f45122e 100644
--- a/lldb/source/Target/ThreadPlanRunToAddress.cpp
+++ b/lldb/source/Target/ThreadPlanRunToAddress.cpp
@@ -39,7 +39,7 @@ ThreadPlanRunToAddress::ThreadPlanRunToAddress
m_addresses (),
m_break_ids ()
{
- m_addresses.push_back (address.GetLoadAddress(&m_thread.GetProcess()));
+ m_addresses.push_back (address.GetLoadAddress(&m_thread.GetProcess().GetTarget()));
SetInitialBreakpoints();
}
diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp
index d6abddd8114..d83e558e716 100644
--- a/lldb/source/Target/ThreadPlanStepInRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepInRange.cpp
@@ -61,7 +61,7 @@ ThreadPlanStepInRange::GetDescription (Stream *s, lldb::DescriptionLevel level)
else
{
s->Printf ("Stepping through range (stepping into functions): ");
- m_address_range.Dump (s, &m_thread.GetProcess(), Address::DumpStyleLoadAddress);
+ m_address_range.Dump (s, &m_thread.GetProcess().GetTarget(), Address::DumpStyleLoadAddress);
}
}
diff --git a/lldb/source/Target/ThreadPlanStepOverRange.cpp b/lldb/source/Target/ThreadPlanStepOverRange.cpp
index bbc51047813..83e9c23a122 100644
--- a/lldb/source/Target/ThreadPlanStepOverRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepOverRange.cpp
@@ -56,7 +56,7 @@ ThreadPlanStepOverRange::GetDescription (Stream *s, lldb::DescriptionLevel level
else
{
s->Printf ("stepping through range (stepping over functions): ");
- m_address_range.Dump (s, &m_thread.GetProcess(), Address::DumpStyleLoadAddress);
+ m_address_range.Dump (s, &m_thread.GetProcess().GetTarget(), Address::DumpStyleLoadAddress);
}
}
diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp
index dd215666082..35384827989 100644
--- a/lldb/source/Target/ThreadPlanStepRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepRange.cpp
@@ -100,7 +100,7 @@ ThreadPlanStepRange::InRange ()
lldb::addr_t pc_load_addr = m_thread.GetRegisterContext()->GetPC();
- ret_value = m_address_range.ContainsLoadAddress(pc_load_addr, &m_thread.GetProcess());
+ ret_value = m_address_range.ContainsLoadAddress(pc_load_addr, &m_thread.GetProcess().GetTarget());
if (!ret_value)
{
@@ -119,7 +119,7 @@ ThreadPlanStepRange::InRange ()
if (log)
{
StreamString s;
- m_address_range.Dump (&s, &m_thread.GetProcess(), Address::DumpStyleLoadAddress);
+ m_address_range.Dump (&s, &m_thread.GetProcess().GetTarget(), Address::DumpStyleLoadAddress);
log->Printf ("Step range plan stepped to another range of same line: %s", s.GetData());
}
@@ -138,15 +138,13 @@ bool
ThreadPlanStepRange::InSymbol()
{
lldb::addr_t cur_pc = m_thread.GetRegisterContext()->GetPC();
- Process *process = m_thread.CalculateProcess();
-
if (m_addr_context.function != NULL)
{
- return m_addr_context.function->GetAddressRange().ContainsLoadAddress (cur_pc, process);
+ return m_addr_context.function->GetAddressRange().ContainsLoadAddress (cur_pc, &m_thread.GetProcess().GetTarget());
}
else if (m_addr_context.symbol != NULL)
{
- return m_addr_context.symbol->GetAddressRangeRef().ContainsLoadAddress (cur_pc, process);
+ return m_addr_context.symbol->GetAddressRangeRef().ContainsLoadAddress (cur_pc, &m_thread.GetProcess().GetTarget());
}
return false;
}
OpenPOWER on IntegriCloud