[Lldb-commits] [lldb] r140437 - in /lldb/trunk: include/lldb/ include/lldb/API/ include/lldb/Core/ include/lldb/Interpreter/ include/lldb/Target/ lldb.xcodeproj/ scripts/ scripts/Python/interface/ source/API/ source/Commands/ source/Core/ source/Interpreter/ source/Plugins/Platform/MacOSX/ source/Plugins/Platform/gdb-server/ source/Target/ test/python_api/default-constructor/ test/python_api/function_symbol/
Greg Clayton
gclayton at apple.com
Fri Sep 23 17:52:29 PDT 2011
Author: gclayton
Date: Fri Sep 23 19:52:29 2011
New Revision: 140437
URL: http://llvm.org/viewvc/llvm-project?rev=140437&view=rev
Log:
Added to the public API to allow symbolication:
- New SBSection objects that are object file sections which can be accessed
through the SBModule classes. You can get the number of sections, get a
section at index, and find a section by name.
- SBSections can contain subsections (first find "__TEXT" on darwin, then
us the resulting SBSection to find "__text" sub section).
- Set load addresses for a SBSection in the SBTarget interface
- Set the load addresses of all SBSection in a SBModule in the SBTarget interface
- Add a new module the an existing target in the SBTarget interface
- Get a SBSection from a SBAddress object
This should get us a lot closer to being able to symbolicate using LLDB through
the public API.
Added:
lldb/trunk/include/lldb/API/SBSection.h
lldb/trunk/source/API/SBSection.cpp
Modified:
lldb/trunk/include/lldb/API/SBAddress.h
lldb/trunk/include/lldb/API/SBData.h
lldb/trunk/include/lldb/API/SBDebugger.h
lldb/trunk/include/lldb/API/SBModule.h
lldb/trunk/include/lldb/API/SBTarget.h
lldb/trunk/include/lldb/Core/ModuleList.h
lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/Target/TargetList.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/scripts/Python/interface/SBAddress.i
lldb/trunk/scripts/Python/interface/SBDebugger.i
lldb/trunk/scripts/Python/interface/SBModule.i
lldb/trunk/scripts/Python/interface/SBTarget.i
lldb/trunk/scripts/lldb.swig
lldb/trunk/source/API/SBAddress.cpp
lldb/trunk/source/API/SBDebugger.cpp
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/ModuleList.cpp
lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/TargetList.cpp
lldb/trunk/test/python_api/default-constructor/sb_address.py
lldb/trunk/test/python_api/default-constructor/sb_module.py
lldb/trunk/test/python_api/function_symbol/TestSymbolAPI.py
Modified: lldb/trunk/include/lldb/API/SBAddress.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBAddress.h (original)
+++ lldb/trunk/include/lldb/API/SBAddress.h Fri Sep 23 19:52:29 2011
@@ -54,9 +54,6 @@
bool
GetDescription (lldb::SBStream &description);
- SectionType
- GetSectionType ();
-
// The following queries can lookup symbol information for a given address.
// An address might refer to code or data from an existing module, or it
// might refer to something on the stack or heap. The following functions
@@ -76,6 +73,9 @@
// One or more bits from the SymbolContextItem enumerations can be logically
// OR'ed together to more efficiently retrieve multiple symbol objects.
+ lldb::SBSection
+ GetSection ();
+
lldb::SBModule
GetModule ();
@@ -102,6 +102,7 @@
friend class SBLineEntry;
friend class SBInstruction;
friend class SBModule;
+ friend class SBSection;
friend class SBSymbol;
friend class SBSymbolContext;
friend class SBTarget;
@@ -135,7 +136,7 @@
private:
- std::auto_ptr<lldb_private::Address> m_opaque_ap;
+ std::auto_ptr<lldb_private::AddressImpl> m_opaque_ap;
};
Modified: lldb/trunk/include/lldb/API/SBData.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBData.h?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBData.h (original)
+++ lldb/trunk/include/lldb/API/SBData.h Fri Sep 23 19:52:29 2011
@@ -126,7 +126,8 @@
private:
friend class SBValue;
-
+ friend class SBSection;
+
lldb::DataExtractorSP m_opaque_sp;
};
Modified: lldb/trunk/include/lldb/API/SBDebugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDebugger.h (original)
+++ lldb/trunk/include/lldb/API/SBDebugger.h Fri Sep 23 19:52:29 2011
@@ -100,6 +100,13 @@
FILE *err);
lldb::SBTarget
+ CreateTarget (const char *filename,
+ const char *target_triple,
+ const char *platform_name,
+ bool add_dependent_modules,
+ lldb::SBError& error);
+
+ lldb::SBTarget
CreateTargetWithFileAndTargetTriple (const char *filename,
const char *target_triple);
Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Fri Sep 23 19:52:29 2011
@@ -11,6 +11,8 @@
#define LLDB_SBModule_h_
#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBError.h"
+#include "lldb/API/SBSection.h"
#include "lldb/API/SBSymbolContext.h"
#include "lldb/API/SBValueList.h"
@@ -84,10 +86,11 @@
operator != (const lldb::SBModule &rhs) const;
#endif
+ lldb::SBSection
+ FindSection (const char *sect_name);
- bool
- ResolveFileAddress (lldb::addr_t vm_addr,
- lldb::SBAddress& addr);
+ lldb::SBAddress
+ ResolveFileAddress (lldb::addr_t vm_addr);
lldb::SBSymbolContext
ResolveSymbolContextForAddress (const lldb::SBAddress& addr,
@@ -102,6 +105,11 @@
lldb::SBSymbol
GetSymbolAtIndex (size_t idx);
+ size_t
+ GetNumSections ();
+
+ lldb::SBSection
+ GetSectionAtIndex (size_t idx);
//------------------------------------------------------------------
/// Find functions by name.
///
@@ -162,6 +170,7 @@
private:
friend class SBAddress;
friend class SBFrame;
+ friend class SBSection;
friend class SBSymbolContext;
friend class SBTarget;
@@ -187,6 +196,10 @@
const lldb_private::Module *
get() const;
+ const lldb::ModuleSP &
+ get_sp() const;
+
+
#endif
lldb::ModuleSP m_opaque_sp;
Added: lldb/trunk/include/lldb/API/SBSection.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSection.h?rev=140437&view=auto
==============================================================================
--- lldb/trunk/include/lldb/API/SBSection.h (added)
+++ lldb/trunk/include/lldb/API/SBSection.h Fri Sep 23 19:52:29 2011
@@ -0,0 +1,97 @@
+//===-- SBSection.h ---------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBSection_h_
+#define LLDB_SBSection_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBData.h"
+
+namespace lldb {
+
+class SBSection
+{
+public:
+
+ SBSection ();
+
+ SBSection (const lldb::SBSection &rhs);
+
+ ~SBSection ();
+
+#ifndef SWIG
+ const lldb::SBSection &
+ operator = (const lldb::SBSection &rhs);
+#endif
+ bool
+ IsValid () const;
+
+ lldb::SBSection
+ FindSubSection (const char *sect_name);
+
+ size_t
+ GetNumSubSections ();
+
+ lldb::SBSection
+ GetSubSectionAtIndex (size_t idx);
+
+ lldb::addr_t
+ GetFileAddress ();
+
+ lldb::addr_t
+ GetByteSize ();
+
+ uint64_t
+ GetFileOffset ();
+
+ uint64_t
+ GetFileByteSize ();
+
+ lldb::SBData
+ GetSectionData (uint64_t offset = 0,
+ uint64_t size = UINT64_MAX);
+
+ SectionType
+ GetSectionType ();
+
+#ifndef SWIG
+ bool
+ operator == (const lldb::SBSection &rhs);
+
+ bool
+ operator != (const lldb::SBSection &rhs);
+
+#endif
+
+ bool
+ GetDescription (lldb::SBStream &description);
+
+private:
+
+#ifndef SWIG
+ friend class SBAddress;
+ friend class SBModule;
+ friend class SBTarget;
+
+ SBSection (const lldb_private::Section *section);
+
+ const lldb_private::Section *
+ GetSection();
+
+ void
+ SetSection (const lldb_private::Section *section);
+#endif
+
+ std::auto_ptr<lldb_private::SectionImpl> m_opaque_ap;
+};
+
+
+} // namespace lldb
+
+#endif // LLDB_SBSection_h_
Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Fri Sep 23 19:52:29 2011
@@ -237,12 +237,23 @@
lldb::SBFileSpec
GetExecutable ();
+ bool
+ AddModule (lldb::SBModule &module);
+
+ lldb::SBModule
+ AddModule (const char *path,
+ const char *triple,
+ const char *uuid);
+
uint32_t
GetNumModules () const;
lldb::SBModule
GetModuleAtIndex (uint32_t idx);
+ bool
+ RemoveModule (lldb::SBModule module);
+
lldb::SBDebugger
GetDebugger() const;
@@ -250,6 +261,76 @@
FindModule (const lldb::SBFileSpec &file_spec);
//------------------------------------------------------------------
+ /// Set the base load address for a module section.
+ ///
+ /// @param[in] section
+ /// The section whose base load address will be set within this
+ /// target.
+ ///
+ /// @param[in] section_base_addr
+ /// The base address for the section.
+ ///
+ /// @return
+ /// An error to indicate success, fail, and any reason for
+ /// failure.
+ //------------------------------------------------------------------
+ lldb::SBError
+ SetSectionLoadAddress (lldb::SBSection section,
+ lldb::addr_t section_base_addr);
+
+ //------------------------------------------------------------------
+ /// Clear the base load address for a module section.
+ ///
+ /// @param[in] section
+ /// The section whose base load address will be cleared within
+ /// this target.
+ ///
+ /// @return
+ /// An error to indicate success, fail, and any reason for
+ /// failure.
+ //------------------------------------------------------------------
+ lldb::SBError
+ ClearSectionLoadAddress (lldb::SBSection section);
+
+ //------------------------------------------------------------------
+ /// Slide all file addresses for all module sections so that \a module
+ /// appears to loaded at these slide addresses.
+ ///
+ /// When you need all sections within a module to be loaded at a
+ /// rigid slide from the addresses found in the module object file,
+ /// this function will allow you to easily and quickly slide all
+ /// module sections.
+ ///
+ /// @param[in] module
+ /// The module to load.
+ ///
+ /// @param[in] sections_offset
+ /// An offset that will be applied to all section file addresses
+ /// (the virtual addresses found in the object file itself).
+ ///
+ /// @return
+ /// An error to indicate success, fail, and any reason for
+ /// failure.
+ //------------------------------------------------------------------
+ lldb::SBError
+ SetModuleLoadAddress (lldb::SBModule module,
+ int64_t sections_offset);
+
+
+ //------------------------------------------------------------------
+ /// The the section base load addresses for all sections in a module.
+ ///
+ /// @param[in] module
+ /// The module to unload.
+ ///
+ /// @return
+ /// An error to indicate success, fail, and any reason for
+ /// failure.
+ //------------------------------------------------------------------
+ lldb::SBError
+ ClearModuleLoadAddress (lldb::SBModule module);
+
+ //------------------------------------------------------------------
/// Find functions by name.
///
/// @param[in] name
Modified: lldb/trunk/include/lldb/Core/ModuleList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleList.h?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ModuleList.h (original)
+++ lldb/trunk/include/lldb/Core/ModuleList.h Fri Sep 23 19:52:29 2011
@@ -73,10 +73,10 @@
/// A shared pointer to a module to add to this collection.
//------------------------------------------------------------------
void
- Append (lldb::ModuleSP &module_sp);
+ Append (const lldb::ModuleSP &module_sp);
bool
- AppendIfNeeded (lldb::ModuleSP &module_sp);
+ AppendIfNeeded (const lldb::ModuleSP &module_sp);
//------------------------------------------------------------------
/// Clear the object's state.
@@ -358,7 +358,7 @@
TypeList& types);
bool
- Remove (lldb::ModuleSP &module_sp);
+ Remove (const lldb::ModuleSP &module_sp);
size_t
Remove (ModuleList &module_list);
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h Fri Sep 23 19:52:29 2011
@@ -61,7 +61,7 @@
lldb::PlatformSP
CreatePlatformWithOptions (CommandInterpreter &interpreter,
bool make_selected,
- Error& error);
+ Error& error) const;
bool
PlatformWasSpecified () const
Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Fri Sep 23 19:52:29 2011
@@ -32,8 +32,6 @@
#include "lldb/Target/PathMappingList.h"
#include "lldb/Target/SectionLoadList.h"
-#include "lldb/API/SBTarget.h"
-
namespace lldb_private {
//----------------------------------------------------------------------
@@ -854,9 +852,7 @@
};
-protected:
- friend class lldb::SBTarget;
-
+protected:
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
Modified: lldb/trunk/include/lldb/Target/TargetList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/TargetList.h?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/TargetList.h (original)
+++ lldb/trunk/include/lldb/Target/TargetList.h Fri Sep 23 19:52:29 2011
@@ -58,31 +58,55 @@
/// locate an appropriate target to deliver asynchronous information
/// to.
///
+ /// @param[in] debugger
+ /// The debugger to associate this target with
+ ///
/// @param[in] file_spec
/// The main executable file for a debug target. This value
/// can be NULL and the file can be set later using:
/// Target::SetExecutableModule (ModuleSP&)
///
- /// @param[in] arch
- /// The architecture to use when launching the \a file_spec for
- /// debugging. This can be NULL if the architecture is not known
- /// or when attaching to a process.
- ///
- /// @param[in] uuid_ptr
- /// An optional UUID to use when loading a target. When this is
- /// specified, plug-ins might be able to track down a different
- /// executable than the one on disk specified by "file_spec" in
- /// an alternate SDK or build location (such as when doing
- /// symbolication on non-native OS builds).
+ /// @param[in] triple_cstr
+ /// A target triple string to be used for the target. This can
+ /// be NULL if the triple is not known or when attaching to a
+ /// process.
+ ///
+ /// @param[in] get_dependent_modules
+ /// Track down the dependent modules for an executable and
+ /// load those into the module list.
+ ///
+ /// @param[in] platform_options
+ /// A pointer to the platform options to use when creating this
+ /// target. If this value is NULL, then the currently selected
+ /// platform will be used.
+ ///
+ /// @param[out] target_sp
+ /// A shared pointer to a target that will be filled in if
+ /// this call is successful.
///
/// @return
- /// A shared pointer to a target object.
+ /// An error object that indicates success or failure
+ //------------------------------------------------------------------
+ Error
+ CreateTarget (Debugger &debugger,
+ const FileSpec& file_spec,
+ const char *triple_cstr,
+ bool get_dependent_modules,
+ const OptionGroupPlatform *platform_options,
+ lldb::TargetSP &target_sp);
+
+ //------------------------------------------------------------------
+ /// Create a new Target.
+ ///
+ /// Same as the function above, but used when you already know the
+ /// platform you will be using
//------------------------------------------------------------------
Error
CreateTarget (Debugger &debugger,
const FileSpec& file_spec,
const ArchSpec& arch,
- bool get_dependent_files,
+ bool get_dependent_modules,
+ const lldb::PlatformSP &platform_sp,
lldb::TargetSP &target_sp);
//------------------------------------------------------------------
Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Fri Sep 23 19:52:29 2011
@@ -19,6 +19,7 @@
class ABI;
class Address;
+class AddressImpl;
class AddressRange;
class AddressResolver;
class ArchSpec;
@@ -100,6 +101,8 @@
class NameSearchContext;
class ObjCLanguageRuntime;
class ObjectContainer;
+class OptionGroup;
+class OptionGroupPlatform;
class ObjectFile;
class OperatingSystem;
class Options;
@@ -125,6 +128,7 @@
class ScriptInterpreterPython;
class SearchFilter;
class Section;
+class SectionImpl;
class SectionList;
class SourceManager;
class StackFrame;
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Sep 23 19:52:29 2011
@@ -350,6 +350,8 @@
26B1FCBD13381071002886E2 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C74CB6212288704006A8171 /* Carbon.framework */; };
26B1FCC21338115F002886E2 /* Host.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7EE810F1B88F00F91463 /* Host.mm */; };
26B42C4D1187ABA50079C8C8 /* LLDB.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B42C4C1187ABA50079C8C8 /* LLDB.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 26B8283D142D01E9002DBC64 /* SBSection.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B8283C142D01E9002DBC64 /* SBSection.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 26B82840142D020F002DBC64 /* SBSection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26B8283F142D020F002DBC64 /* SBSection.cpp */; };
26BCFC521368AE38006DC050 /* OptionGroupFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BCFC511368AE38006DC050 /* OptionGroupFormat.cpp */; };
26BD407F135D2AE000237D80 /* FileLineResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BD407E135D2ADF00237D80 /* FileLineResolver.cpp */; };
26C72C94124322890068DC16 /* SBStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 26C72C93124322890068DC16 /* SBStream.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -753,6 +755,8 @@
26B167A41123BF5500DC7B4F /* ThreadSafeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSafeValue.h; path = include/lldb/Core/ThreadSafeValue.h; sourceTree = "<group>"; };
26B42C4C1187ABA50079C8C8 /* LLDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLDB.h; path = include/lldb/API/LLDB.h; sourceTree = "<group>"; };
26B4E26E112F35F700AB3F64 /* TimeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TimeValue.h; path = include/lldb/Host/TimeValue.h; sourceTree = "<group>"; };
+ 26B8283C142D01E9002DBC64 /* SBSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBSection.h; path = include/lldb/API/SBSection.h; sourceTree = "<group>"; };
+ 26B8283F142D020F002DBC64 /* SBSection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBSection.cpp; path = source/API/SBSection.cpp; sourceTree = "<group>"; };
26B8B42212EEC52A00A831B2 /* UniqueDWARFASTType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UniqueDWARFASTType.h; sourceTree = "<group>"; };
26B8B42312EEC52A00A831B2 /* UniqueDWARFASTType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UniqueDWARFASTType.cpp; sourceTree = "<group>"; };
26BC7C2510F1B3BC00F91463 /* lldb-defines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "lldb-defines.h"; path = "include/lldb/lldb-defines.h"; sourceTree = "<group>"; };
@@ -1718,6 +1722,8 @@
26DE204C11618E7A00A093E2 /* SBModule.cpp */,
9A9831041125FC5800A56CB0 /* SBProcess.h */,
9A9831031125FC5800A56CB0 /* SBProcess.cpp */,
+ 26B8283C142D01E9002DBC64 /* SBSection.h */,
+ 26B8283F142D020F002DBC64 /* SBSection.cpp */,
9A9831061125FC5800A56CB0 /* SBSourceManager.h */,
9A9831051125FC5800A56CB0 /* SBSourceManager.cpp */,
26C72C93124322890068DC16 /* SBStream.h */,
@@ -2773,6 +2779,7 @@
26D265BC136B4269002EEE45 /* lldb-public.h in Headers */,
4CAA56131422D96A001FFA01 /* BreakpointResolverFileRegex.h in Headers */,
4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */,
+ 26B8283D142D01E9002DBC64 /* SBSection.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3058,6 +3065,7 @@
9443B122140C18C40013457C /* SBData.cpp in Sources */,
4CAA56151422D986001FFA01 /* BreakpointResolverFileRegex.cpp in Sources */,
4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */,
+ 26B82840142D020F002DBC64 /* SBSection.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: lldb/trunk/scripts/Python/interface/SBAddress.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBAddress.i?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBAddress.i (original)
+++ lldb/trunk/scripts/Python/interface/SBAddress.i Fri Sep 23 19:52:29 2011
@@ -79,8 +79,8 @@
bool
GetDescription (lldb::SBStream &description);
- SectionType
- GetSectionType ();
+ lldb::SBSection
+ GetSection ();
%feature("docstring", "
//------------------------------------------------------------------
Modified: lldb/trunk/scripts/Python/interface/SBDebugger.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBDebugger.i?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBDebugger.i (original)
+++ lldb/trunk/scripts/Python/interface/SBDebugger.i Fri Sep 23 19:52:29 2011
@@ -177,6 +177,13 @@
FILE *err);
lldb::SBTarget
+ CreateTarget (const char *filename,
+ const char *target_triple,
+ const char *platform_name,
+ bool add_dependent_modules,
+ lldb::SBError& sb_error);
+
+ lldb::SBTarget
CreateTargetWithFileAndTargetTriple (const char *filename,
const char *target_triple);
Modified: lldb/trunk/scripts/Python/interface/SBModule.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBModule.i?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBModule.i (original)
+++ lldb/trunk/scripts/Python/interface/SBModule.i Fri Sep 23 19:52:29 2011
@@ -89,9 +89,11 @@
const char *
GetUUIDString () const;
- bool
- ResolveFileAddress (lldb::addr_t vm_addr,
- lldb::SBAddress& addr);
+ lldb::SBSection
+ FindSection (const char *sect_name);
+
+ lldb::SBAddress
+ ResolveFileAddress (lldb::addr_t vm_addr);
lldb::SBSymbolContext
ResolveSymbolContextForAddress (const lldb::SBAddress& addr,
@@ -106,6 +108,13 @@
lldb::SBSymbol
GetSymbolAtIndex (size_t idx);
+ size_t
+ GetNumSections ();
+
+ lldb::SBSection
+ GetSectionAtIndex (size_t idx);
+
+
%feature("docstring", "
//------------------------------------------------------------------
/// Find functions by name.
Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTarget.i Fri Sep 23 19:52:29 2011
@@ -277,18 +277,43 @@
lldb::SBFileSpec
GetExecutable ();
+ bool
+ AddModule (lldb::SBModule &module);
+
+ lldb::SBModule
+ AddModule (const char *path,
+ const char *triple,
+ const char *uuid);
+
uint32_t
GetNumModules () const;
lldb::SBModule
GetModuleAtIndex (uint32_t idx);
+ bool
+ RemoveModule (lldb::SBModule module);
+
lldb::SBDebugger
GetDebugger() const;
lldb::SBModule
FindModule (const lldb::SBFileSpec &file_spec);
+ lldb::SBError
+ SetSectionLoadAddress (lldb::SBSection section,
+ lldb::addr_t section_base_addr);
+
+ lldb::SBError
+ ClearSectionLoadAddress (lldb::SBSection section);
+
+ lldb::SBError
+ SetModuleLoadAddress (lldb::SBModule module,
+ int64_t sections_offset);
+
+ lldb::SBError
+ ClearModuleLoadAddress (lldb::SBModule module);
+
%feature("docstring", "
//------------------------------------------------------------------
/// Find functions by name.
Modified: lldb/trunk/scripts/lldb.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/lldb.swig?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/scripts/lldb.swig (original)
+++ lldb/trunk/scripts/lldb.swig Fri Sep 23 19:52:29 2011
@@ -67,6 +67,7 @@
#include "lldb/API/SBListener.h"
#include "lldb/API/SBModule.h"
#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBSection.h"
#include "lldb/API/SBSourceManager.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h"
@@ -118,6 +119,7 @@
%include "./Python/interface/SBListener.i"
%include "./Python/interface/SBModule.i"
%include "./Python/interface/SBProcess.i"
+%include "./Python/interface/SBSection.i"
%include "./Python/interface/SBSourceManager.i"
%include "./Python/interface/SBStream.i"
%include "./Python/interface/SBStringList.i"
Modified: lldb/trunk/source/API/SBAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/source/API/SBAddress.cpp (original)
+++ lldb/trunk/source/API/SBAddress.cpp Fri Sep 23 19:52:29 2011
@@ -9,6 +9,7 @@
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBSection.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/Log.h"
@@ -16,6 +17,69 @@
#include "lldb/Host/Mutex.h"
#include "lldb/Target/Target.h"
+namespace lldb_private
+{
+ // We need a address implementation to hold onto a reference to the module
+ // since if the module goes away and we have anyone still holding onto a
+ // SBAddress object, we could crash.
+ class AddressImpl
+ {
+ public:
+ AddressImpl () :
+ m_module_sp(),
+ m_address()
+ {
+ }
+
+ AddressImpl (const Address &addr) :
+ m_module_sp (addr.GetModule()),
+ m_address (addr)
+ {
+ }
+
+ AddressImpl (const AddressImpl &rhs) :
+ m_module_sp (rhs.m_module_sp),
+ m_address (rhs.m_address)
+ {
+ }
+
+ bool
+ IsValid () const
+ {
+ return m_address.IsValid();
+ }
+
+ void
+ operator = (const AddressImpl &rhs)
+ {
+ m_module_sp = rhs.m_module_sp;
+ m_address = rhs.m_address;
+ }
+
+ Address &
+ GetAddress ()
+ {
+ return m_address;
+ }
+
+ Module *
+ GetModule()
+ {
+ return m_module_sp.get();
+ }
+
+ const lldb::ModuleSP &
+ GetModuleSP() const
+ {
+ return m_module_sp;
+ }
+ protected:
+ lldb::ModuleSP m_module_sp;
+ Address m_address;
+ };
+}
+
+
using namespace lldb;
using namespace lldb_private;
@@ -25,18 +89,18 @@
{
}
-SBAddress::SBAddress (const lldb_private::Address *lldb_object_ptr) :
+SBAddress::SBAddress (const Address *lldb_object_ptr) :
m_opaque_ap ()
{
if (lldb_object_ptr)
- m_opaque_ap.reset (new lldb_private::Address(*lldb_object_ptr));
+ m_opaque_ap.reset (new AddressImpl(*lldb_object_ptr));
}
SBAddress::SBAddress (const SBAddress &rhs) :
m_opaque_ap ()
{
if (rhs.IsValid())
- m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get()));
+ m_opaque_ap.reset (new AddressImpl(*rhs.m_opaque_ap.get()));
}
// Create an address by resolving a load address using the supplied target
@@ -55,8 +119,13 @@
const SBAddress &
SBAddress::operator = (const SBAddress &rhs)
{
- if (this != &rhs && rhs.IsValid())
- m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get()));
+ if (this != &rhs)
+ {
+ if (rhs.IsValid())
+ m_opaque_ap.reset(new AddressImpl(*rhs.m_opaque_ap.get()));
+ else
+ m_opaque_ap.reset();
+ }
return *this;
}
@@ -73,25 +142,24 @@
}
void
-SBAddress::SetAddress (const lldb_private::Address *lldb_object_ptr)
+SBAddress::SetAddress (const Address *lldb_object_ptr)
{
if (lldb_object_ptr)
{
if (m_opaque_ap.get())
*m_opaque_ap = *lldb_object_ptr;
else
- m_opaque_ap.reset (new lldb_private::Address(*lldb_object_ptr));
- return;
+ m_opaque_ap.reset (new AddressImpl(*lldb_object_ptr));
}
- if (m_opaque_ap.get())
- m_opaque_ap->Clear();
+ else
+ m_opaque_ap.reset();
}
lldb::addr_t
SBAddress::GetFileAddress () const
{
if (m_opaque_ap.get())
- return m_opaque_ap->GetFileAddress();
+ return m_opaque_ap->GetAddress().GetFileAddress();
else
return LLDB_INVALID_ADDRESS;
}
@@ -99,13 +167,13 @@
lldb::addr_t
SBAddress::GetLoadAddress (const SBTarget &target) const
{
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
lldb::addr_t addr = LLDB_INVALID_ADDRESS;
if (m_opaque_ap.get())
{
Mutex::Locker api_locker (target->GetAPIMutex());
- addr = m_opaque_ap->GetLoadAddress (target.get());
+ addr = m_opaque_ap->GetAddress().GetLoadAddress (target.get());
}
if (log)
@@ -127,14 +195,14 @@
if (target.IsValid())
*this = target.ResolveLoadAddress(load_addr);
else
- m_opaque_ap->Clear();
+ m_opaque_ap->GetAddress().Clear();
// Check if we weren't were able to resolve a section offset address.
// If we weren't it is ok, the load address might be a location on the
// stack or heap, so we should just have an address with no section and
// a valid offset
if (!m_opaque_ap->IsValid())
- m_opaque_ap->SetOffset(load_addr);
+ m_opaque_ap->GetAddress().SetOffset(load_addr);
}
bool
@@ -142,50 +210,66 @@
{
if (m_opaque_ap.get())
{
- addr_t addr_offset = m_opaque_ap->GetOffset();
+ addr_t addr_offset = m_opaque_ap->GetAddress().GetOffset();
if (addr_offset != LLDB_INVALID_ADDRESS)
{
- m_opaque_ap->SetOffset(addr_offset + offset);
+ m_opaque_ap->GetAddress().SetOffset(addr_offset + offset);
return true;
}
}
return false;
}
-lldb_private::Address *
+lldb::SBSection
+SBAddress::GetSection ()
+{
+ lldb::SBSection sb_section;
+ if (m_opaque_ap.get())
+ sb_section.SetSection(m_opaque_ap->GetAddress().GetSection());
+ return sb_section;
+}
+
+
+Address *
SBAddress::operator->()
{
- return m_opaque_ap.get();
+ if (m_opaque_ap.get())
+ return &m_opaque_ap->GetAddress();
+ return NULL;
}
-const lldb_private::Address *
+const Address *
SBAddress::operator->() const
{
- return m_opaque_ap.get();
+ if (m_opaque_ap.get())
+ return &m_opaque_ap->GetAddress();
+ return NULL;
}
-lldb_private::Address &
+Address &
SBAddress::ref ()
{
if (m_opaque_ap.get() == NULL)
- m_opaque_ap.reset (new lldb_private::Address);
- return *m_opaque_ap;
+ m_opaque_ap.reset (new AddressImpl());
+ return m_opaque_ap->GetAddress();
}
-const lldb_private::Address &
+const Address &
SBAddress::ref () const
{
// "const SBAddress &addr" should already have checked "addr.IsValid()"
// prior to calling this function. In case you didn't we will assert
// and die to let you know.
assert (m_opaque_ap.get());
- return *m_opaque_ap;
+ return m_opaque_ap->GetAddress();
}
-lldb_private::Address *
+Address *
SBAddress::get ()
{
- return m_opaque_ap.get();
+ if (m_opaque_ap.get())
+ return &m_opaque_ap->GetAddress();
+ return NULL;
}
bool
@@ -195,26 +279,13 @@
// case there isn't one already...
description.ref();
if (m_opaque_ap.get())
- m_opaque_ap->Dump (description.get(), NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4);
+ m_opaque_ap->GetAddress().Dump (description.get(), NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4);
else
description.Printf ("No value");
return true;
}
-SectionType
-SBAddress::GetSectionType ()
-{
- if (m_opaque_ap.get())
- {
- const Section *section = m_opaque_ap->GetSection();
- if (section)
- return section->GetType();
- }
- return eSectionTypeInvalid;
-}
-
-
SBModule
SBAddress::GetModule ()
{
@@ -233,7 +304,7 @@
{
SBSymbolContext sb_sc;
if (m_opaque_ap.get())
- m_opaque_ap->CalculateSymbolContext (&sb_sc.ref(), resolve_scope);
+ m_opaque_ap->GetAddress().CalculateSymbolContext (&sb_sc.ref(), resolve_scope);
return sb_sc;
}
@@ -242,7 +313,7 @@
{
SBCompileUnit sb_comp_unit;
if (m_opaque_ap.get())
- sb_comp_unit.reset(m_opaque_ap->CalculateSymbolContextCompileUnit());
+ sb_comp_unit.reset(m_opaque_ap->GetAddress().CalculateSymbolContextCompileUnit());
return sb_comp_unit;
}
@@ -251,7 +322,7 @@
{
SBFunction sb_function;
if (m_opaque_ap.get())
- sb_function.reset(m_opaque_ap->CalculateSymbolContextFunction());
+ sb_function.reset(m_opaque_ap->GetAddress().CalculateSymbolContextFunction());
return sb_function;
}
@@ -260,7 +331,7 @@
{
SBBlock sb_block;
if (m_opaque_ap.get())
- sb_block.reset(m_opaque_ap->CalculateSymbolContextBlock());
+ sb_block.reset(m_opaque_ap->GetAddress().CalculateSymbolContextBlock());
return sb_block;
}
@@ -269,7 +340,7 @@
{
SBSymbol sb_symbol;
if (m_opaque_ap.get())
- sb_symbol.reset(m_opaque_ap->CalculateSymbolContextSymbol());
+ sb_symbol.reset(m_opaque_ap->GetAddress().CalculateSymbolContextSymbol());
return sb_symbol;
}
@@ -280,7 +351,7 @@
if (m_opaque_ap.get())
{
LineEntry line_entry;
- if (m_opaque_ap->CalculateSymbolContextLineEntry (line_entry))
+ if (m_opaque_ap->GetAddress().CalculateSymbolContextLineEntry (line_entry))
sb_line_entry.SetLineEntry (line_entry);
}
return sb_line_entry;
Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Fri Sep 23 19:52:29 2011
@@ -29,6 +29,7 @@
#include "lldb/Core/State.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/OptionGroupPlatform.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/TargetList.h"
@@ -459,6 +460,52 @@
return result;
}
+lldb::SBTarget
+SBDebugger::CreateTarget (const char *filename,
+ const char *target_triple,
+ const char *platform_name,
+ bool add_dependent_modules,
+ lldb::SBError& sb_error)
+{
+ SBTarget sb_target;
+ if (m_opaque_sp)
+ {
+ sb_error.Clear();
+ FileSpec filename_spec (filename, true);
+ OptionGroupPlatform platform_options (false);
+ platform_options.SetPlatformName (platform_name);
+
+ TargetSP target_sp;
+ sb_error.ref() = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp,
+ filename_spec,
+ target_triple,
+ add_dependent_modules,
+ &platform_options,
+ target_sp);
+
+ if (sb_error.Success())
+ sb_target.reset (target_sp);
+ }
+ else
+ {
+ sb_error.SetErrorString("invalid target");
+ }
+
+ LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ {
+ log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, platform_name=%s, add_dependent_modules=%u, error=%s) => SBTarget(%p)",
+ m_opaque_sp.get(),
+ filename,
+ target_triple,
+ platform_name,
+ add_dependent_modules,
+ sb_error.GetCString(),
+ sb_target.get());
+ }
+
+ return sb_target;
+}
SBTarget
SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
@@ -467,11 +514,15 @@
SBTarget target;
if (m_opaque_sp)
{
- ArchSpec arch;
FileSpec file_spec (filename, true);
- arch.SetTriple (target_triple, m_opaque_sp->GetPlatformList().GetSelectedPlatform().get());
TargetSP target_sp;
- Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, true, target_sp));
+ const bool add_dependent_modules = true;
+ Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp,
+ file_spec,
+ target_triple,
+ add_dependent_modules,
+ NULL,
+ target_sp));
target.reset (target_sp);
}
@@ -494,14 +545,16 @@
if (m_opaque_sp)
{
FileSpec file (filename, true);
- ArchSpec arch;
TargetSP target_sp;
Error error;
+ const bool add_dependent_modules = true;
- if (arch_cstr)
- arch.SetTriple (arch_cstr, m_opaque_sp->GetPlatformList().GetSelectedPlatform().get());
-
- error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, true, target_sp);
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp,
+ file,
+ arch_cstr,
+ add_dependent_modules,
+ NULL,
+ target_sp);
if (error.Success())
{
@@ -529,8 +582,14 @@
ArchSpec arch = Target::GetDefaultArchitecture ();
TargetSP target_sp;
Error error;
+ const bool add_dependent_modules = true;
- error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, true, target_sp);
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp,
+ file,
+ arch,
+ add_dependent_modules,
+ m_opaque_sp->GetPlatformList().GetSelectedPlatform(),
+ target_sp);
if (error.Success())
{
Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Fri Sep 23 19:52:29 2011
@@ -217,6 +217,11 @@
return m_opaque_sp.get();
}
+const lldb::ModuleSP &
+SBModule::get_sp() const
+{
+ return m_opaque_sp;
+}
void
SBModule::SetModule (const lldb::ModuleSP& module_sp)
@@ -225,15 +230,17 @@
}
-bool
-SBModule::ResolveFileAddress (lldb::addr_t vm_addr, SBAddress& addr)
+SBAddress
+SBModule::ResolveFileAddress (lldb::addr_t vm_addr)
{
- if (m_opaque_sp && addr.IsValid())
- return m_opaque_sp->ResolveFileAddress (vm_addr, addr.ref());
-
- if (addr.IsValid())
- addr->Clear();
- return false;
+ lldb::SBAddress sb_addr;
+ if (m_opaque_sp)
+ {
+ Address addr;
+ if (m_opaque_sp->ResolveFileAddress (vm_addr, addr))
+ sb_addr.ref() = addr;
+ }
+ return sb_addr;
}
SBSymbolContext
@@ -292,6 +299,40 @@
return sb_symbol;
}
+size_t
+SBModule::GetNumSections ()
+{
+ if (m_opaque_sp)
+ {
+ ObjectFile *obj_file = m_opaque_sp->GetObjectFile();
+ if (obj_file)
+ {
+ SectionList *section_list = obj_file->GetSectionList ();
+ if (section_list)
+ return section_list->GetSize();
+ }
+ }
+ return 0;
+}
+
+SBSection
+SBModule::GetSectionAtIndex (size_t idx)
+{
+ SBSection sb_section;
+ if (m_opaque_sp)
+ {
+ ObjectFile *obj_file = m_opaque_sp->GetObjectFile();
+ if (obj_file)
+ {
+ SectionList *section_list = obj_file->GetSectionList ();
+
+ if (section_list)
+ sb_section.SetSection(section_list->GetSectionAtIndex (idx).get());
+ }
+ }
+ return sb_section;
+}
+
uint32_t
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask,
@@ -396,3 +437,30 @@
return retval;
}
+
+
+SBSection
+SBModule::FindSection (const char *sect_name)
+{
+ SBSection sb_section;
+
+ if (IsValid())
+ {
+ ObjectFile *objfile = m_opaque_sp->GetObjectFile();
+ if (objfile)
+ {
+ SectionList *section_list = objfile->GetSectionList();
+ if (section_list)
+ {
+ ConstString const_sect_name(sect_name);
+ SectionSP section_sp (section_list->FindSectionByName(const_sect_name));
+ if (section_sp)
+ {
+ sb_section.SetSection(section_sp.get());
+ }
+ }
+ }
+ }
+ return sb_section;
+}
+
Added: lldb/trunk/source/API/SBSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSection.cpp?rev=140437&view=auto
==============================================================================
--- lldb/trunk/source/API/SBSection.cpp (added)
+++ lldb/trunk/source/API/SBSection.cpp Fri Sep 23 19:52:29 2011
@@ -0,0 +1,324 @@
+//===-- SBSection.cpp -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBSection.h"
+#include "lldb/API/SBStream.h"
+#include "lldb/Core/DataBuffer.h"
+#include "lldb/Core/DataExtractor.h"
+#include "lldb/Core/Log.h"
+#include "lldb/Core/Section.h"
+#include "lldb/Core/Module.h"
+
+namespace lldb_private
+{
+ // We need a section implementation to hold onto a reference to the module
+ // since if the module goes away and we have anyone still holding onto a
+ // SBSection object, we could crash.
+ class SectionImpl
+ {
+ public:
+ SectionImpl (const lldb_private::Section *section = NULL) :
+ m_module_sp (),
+ m_section (section)
+ {
+ if (section)
+ m_module_sp = section->GetModule();
+ }
+
+ SectionImpl (const SectionImpl &rhs) :
+ m_module_sp (rhs.m_module_sp),
+ m_section (rhs.m_section)
+ {
+ }
+
+ bool
+ IsValid () const
+ {
+ return m_section != NULL;
+ }
+
+ void
+ operator = (const SectionImpl &rhs)
+ {
+ m_module_sp = rhs.m_module_sp;
+ m_section = rhs.m_section;
+ }
+
+ void
+ operator =(const lldb_private::Section *section)
+ {
+ m_section = section;
+ if (section)
+ m_module_sp.reset(section->GetModule());
+ else
+ m_module_sp.reset();
+ }
+
+ const lldb_private::Section *
+ GetSection () const
+ {
+ return m_section;
+ }
+
+ Module *
+ GetModule()
+ {
+ return m_module_sp.get();
+ }
+
+ const lldb::ModuleSP &
+ GetModuleSP() const
+ {
+ return m_module_sp;
+ }
+ protected:
+ lldb::ModuleSP m_module_sp;
+ const lldb_private::Section *m_section;
+ };
+}
+
+using namespace lldb;
+using namespace lldb_private;
+
+
+SBSection::SBSection () :
+ m_opaque_ap ()
+{
+}
+
+SBSection::SBSection (const SBSection &rhs) :
+ m_opaque_ap ()
+{
+ if (rhs.IsValid())
+ m_opaque_ap.reset (new SectionImpl (*rhs.m_opaque_ap));
+}
+
+
+
+SBSection::SBSection (const lldb_private::Section *section) :
+ m_opaque_ap ()
+{
+ if (section)
+ m_opaque_ap.reset (new SectionImpl(section));
+}
+
+const SBSection &
+SBSection::operator = (const SBSection &rhs)
+{
+ if (this != &rhs && rhs.IsValid())
+ m_opaque_ap.reset (new SectionImpl(*rhs.m_opaque_ap));
+ else
+ m_opaque_ap.reset ();
+ return *this;
+}
+
+SBSection::~SBSection ()
+{
+}
+
+bool
+SBSection::IsValid () const
+{
+ return m_opaque_ap.get() != NULL && m_opaque_ap->IsValid();
+}
+
+lldb::SBSection
+SBSection::FindSubSection (const char *sect_name)
+{
+ lldb::SBSection sb_section;
+ if (IsValid())
+ {
+ ConstString const_sect_name(sect_name);
+ sb_section.SetSection(m_opaque_ap->GetSection()->GetChildren ().FindSectionByName(const_sect_name).get());
+ }
+ return sb_section;
+}
+
+size_t
+SBSection::GetNumSubSections ()
+{
+ if (IsValid())
+ return m_opaque_ap->GetSection()->GetChildren ().GetSize();
+ return 0;
+}
+
+lldb::SBSection
+SBSection::GetSubSectionAtIndex (size_t idx)
+{
+ lldb::SBSection sb_section;
+ if (IsValid())
+ sb_section.SetSection(m_opaque_ap->GetSection()->GetChildren ().GetSectionAtIndex(idx).get());
+ return sb_section;
+}
+
+const lldb_private::Section *
+SBSection::GetSection()
+{
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetSection();
+ return NULL;
+}
+
+void
+SBSection::SetSection (const lldb_private::Section *section)
+{
+ m_opaque_ap.reset (new SectionImpl(section));
+}
+
+
+
+
+lldb::addr_t
+SBSection::GetFileAddress ()
+{
+ lldb::addr_t file_addr = LLDB_INVALID_ADDRESS;
+ if (IsValid())
+ return m_opaque_ap->GetSection()->GetFileAddress();
+ return file_addr;
+}
+
+lldb::addr_t
+SBSection::GetByteSize ()
+{
+ if (IsValid())
+ {
+ const Section *section = m_opaque_ap->GetSection();
+ if (section)
+ return section->GetByteSize();
+ }
+ return 0;
+}
+
+uint64_t
+SBSection::GetFileOffset ()
+{
+ if (IsValid())
+ {
+ const Section *section = m_opaque_ap->GetSection();
+ if (section)
+ {
+ Module *module = m_opaque_ap->GetModule();
+ if (module)
+ {
+ ObjectFile *objfile = module->GetObjectFile();
+ if (objfile)
+ return objfile->GetOffset() + section->GetFileOffset();
+ }
+ return section->GetFileOffset();
+ }
+ }
+ return 0;
+}
+
+uint64_t
+SBSection::GetFileByteSize ()
+{
+ if (IsValid())
+ {
+ const Section *section = m_opaque_ap->GetSection();
+ if (section)
+ return section->GetFileSize();
+ }
+ return 0;
+}
+
+SBData
+SBSection::GetSectionData (uint64_t offset, uint64_t size)
+{
+ SBData sb_data;
+ if (IsValid())
+ {
+ const Section *section = m_opaque_ap->GetSection();
+ if (section)
+ {
+ const uint64_t sect_file_size = section->GetFileSize();
+ if (sect_file_size > 0)
+ {
+ Module *module = m_opaque_ap->GetModule();
+ if (module)
+ {
+ ObjectFile *objfile = module->GetObjectFile();
+ if (objfile)
+ {
+ const uint64_t sect_file_offset = objfile->GetOffset() + section->GetFileOffset();
+ const uint64_t file_offset = sect_file_offset + offset;
+ uint64_t file_size = size;
+ if (file_size == UINT64_MAX)
+ {
+ file_size = section->GetByteSize();
+ if (file_size > offset)
+ file_size -= offset;
+ else
+ file_size = 0;
+ }
+ DataBufferSP data_buffer_sp (objfile->GetFileSpec().ReadFileContents (file_offset, file_size));
+ if (data_buffer_sp && data_buffer_sp->GetByteSize() > 0)
+ {
+ DataExtractorSP data_extractor_sp (new DataExtractor (data_buffer_sp,
+ objfile->GetByteOrder(),
+ objfile->GetAddressByteSize()));
+
+ sb_data.SetOpaque (data_extractor_sp);
+ }
+ }
+ }
+ }
+ }
+ }
+ return sb_data;
+}
+
+SectionType
+SBSection::GetSectionType ()
+{
+ if (m_opaque_ap.get())
+ {
+ const Section *section = m_opaque_ap->GetSection();
+ if (section)
+ return section->GetType();
+ }
+ return eSectionTypeInvalid;
+}
+
+
+bool
+SBSection::operator == (const SBSection &rhs)
+{
+ SectionImpl *lhs_ptr = m_opaque_ap.get();
+ SectionImpl *rhs_ptr = rhs.m_opaque_ap.get();
+ if (lhs_ptr && rhs_ptr)
+ return lhs_ptr->GetSection() == rhs_ptr->GetSection();
+ return false;
+}
+
+bool
+SBSection::operator != (const SBSection &rhs)
+{
+ SectionImpl *lhs_ptr = m_opaque_ap.get();
+ SectionImpl *rhs_ptr = rhs.m_opaque_ap.get();
+ if (lhs_ptr && rhs_ptr)
+ return lhs_ptr->GetSection() != rhs_ptr->GetSection();
+ return false;
+}
+
+bool
+SBSection::GetDescription (SBStream &description)
+{
+ if (m_opaque_ap.get())
+ {
+ description.Printf ("SBSection");
+ }
+ else
+ {
+ description.Printf ("No value");
+ }
+
+ return true;
+}
+
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Fri Sep 23 19:52:29 2011
@@ -867,6 +867,52 @@
}
+lldb::SBModule
+SBTarget::AddModule (const char *path,
+ const char *triple,
+ const char *uuid_cstr)
+{
+ lldb::SBModule sb_module;
+ if (m_opaque_sp)
+ {
+ FileSpec module_file_spec;
+ UUID module_uuid;
+ ArchSpec module_arch;
+
+ if (path)
+ module_file_spec.SetFile(path, false);
+
+ if (uuid_cstr)
+ module_uuid.SetfromCString(uuid_cstr);
+
+ if (triple)
+ module_arch.SetTriple (triple, m_opaque_sp->GetPlatform ().get());
+
+ sb_module.SetModule(m_opaque_sp->GetSharedModule (module_file_spec,
+ module_arch,
+ uuid_cstr ? &module_uuid : NULL));
+ }
+ return sb_module;
+}
+
+bool
+SBTarget::AddModule (lldb::SBModule &module)
+{
+ if (m_opaque_sp)
+ {
+ m_opaque_sp->GetImages().AppendIfNeeded (module.get_sp());
+ return true;
+ }
+ return false;
+}
+
+lldb::SBModule
+AddModule (const char *path,
+ const char *triple,
+ const char *uuid);
+
+
+
uint32_t
SBTarget::GetNumModules () const
{
@@ -930,6 +976,14 @@
return sb_module;
}
+bool
+SBTarget::RemoveModule (lldb::SBModule module)
+{
+ if (m_opaque_sp)
+ return m_opaque_sp->GetImages().Remove(module.get_sp());
+ return false;
+}
+
SBBroadcaster
SBTarget::GetBroadcaster () const
@@ -1079,3 +1133,149 @@
SBSourceManager source_manager (*this);
return source_manager;
}
+
+
+SBError
+SBTarget::SetSectionLoadAddress (lldb::SBSection section,
+ lldb::addr_t section_base_addr)
+{
+ SBError sb_error;
+
+ if (IsValid())
+ {
+ if (!section.IsValid())
+ {
+ sb_error.SetErrorStringWithFormat ("invalid section");
+ }
+ else
+ {
+ m_opaque_sp->GetSectionLoadList().SetSectionLoadAddress (section.GetSection(), section_base_addr);
+ }
+ }
+ else
+ {
+ sb_error.SetErrorStringWithFormat ("invalid target");
+ }
+ return sb_error;
+}
+
+SBError
+SBTarget::ClearSectionLoadAddress (lldb::SBSection section)
+{
+ SBError sb_error;
+
+ if (IsValid())
+ {
+ if (!section.IsValid())
+ {
+ sb_error.SetErrorStringWithFormat ("invalid section");
+ }
+ else
+ {
+ m_opaque_sp->GetSectionLoadList().SetSectionUnloaded (section.GetSection());
+ }
+ }
+ else
+ {
+ sb_error.SetErrorStringWithFormat ("invalid target");
+ }
+ return sb_error;
+}
+
+SBError
+SBTarget::SetModuleLoadAddress (lldb::SBModule module, int64_t slide_offset)
+{
+ SBError sb_error;
+
+ char path[PATH_MAX];
+ if (IsValid())
+ {
+ if (!module.IsValid())
+ {
+ sb_error.SetErrorStringWithFormat ("invalid module");
+ }
+ else
+ {
+ ObjectFile *objfile = module->GetObjectFile();
+ if (objfile)
+ {
+ SectionList *section_list = objfile->GetSectionList();
+ if (section_list)
+ {
+ const size_t num_sections = section_list->GetSize();
+ for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx)
+ {
+ SectionSP section_sp (section_list->GetSectionAtIndex(sect_idx));
+ if (section_sp)
+ m_opaque_sp->GetSectionLoadList().SetSectionLoadAddress (section_sp.get(), section_sp->GetFileAddress() + slide_offset);
+ }
+ }
+ else
+ {
+ module->GetFileSpec().GetPath (path, sizeof(path));
+ sb_error.SetErrorStringWithFormat ("no sections in object file '%s'", path);
+ }
+ }
+ else
+ {
+ module->GetFileSpec().GetPath (path, sizeof(path));
+ sb_error.SetErrorStringWithFormat ("no object file for module '%s'", path);
+ }
+ }
+ }
+ else
+ {
+ sb_error.SetErrorStringWithFormat ("invalid target");
+ }
+ return sb_error;
+}
+
+SBError
+SBTarget::ClearModuleLoadAddress (lldb::SBModule module)
+{
+ SBError sb_error;
+
+ char path[PATH_MAX];
+ if (IsValid())
+ {
+ if (!module.IsValid())
+ {
+ sb_error.SetErrorStringWithFormat ("invalid module");
+ }
+ else
+ {
+ ObjectFile *objfile = module->GetObjectFile();
+ if (objfile)
+ {
+ SectionList *section_list = objfile->GetSectionList();
+ if (section_list)
+ {
+ const size_t num_sections = section_list->GetSize();
+ for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx)
+ {
+ SectionSP section_sp (section_list->GetSectionAtIndex(sect_idx));
+ if (section_sp)
+ m_opaque_sp->GetSectionLoadList().SetSectionUnloaded (section_sp.get());
+ }
+ }
+ else
+ {
+ module->GetFileSpec().GetPath (path, sizeof(path));
+ sb_error.SetErrorStringWithFormat ("no sections in object file '%s'", path);
+ }
+ }
+ else
+ {
+ module->GetFileSpec().GetPath (path, sizeof(path));
+ sb_error.SetErrorStringWithFormat ("no object file for module '%s'", path);
+ }
+ }
+ }
+ else
+ {
+ sb_error.SetErrorStringWithFormat ("invalid target");
+ }
+ return sb_error;
+}
+
+
Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Fri Sep 23 19:52:29 2011
@@ -585,13 +585,13 @@
// If there isn't a current target create one.
TargetSP new_target_sp;
FileSpec emptyFileSpec;
- ArchSpec emptyArchSpec;
Error error;
error = m_interpreter.GetDebugger().GetTargetList().CreateTarget (m_interpreter.GetDebugger(),
emptyFileSpec,
- emptyArchSpec,
+ NULL,
false,
+ NULL, // No platform options
new_target_sp);
target = new_target_sp.get();
if (target == NULL || error.Fail())
@@ -1041,12 +1041,12 @@
{
// If there isn't a current target create one.
FileSpec emptyFileSpec;
- ArchSpec emptyArchSpec;
error = m_interpreter.GetDebugger().GetTargetList().CreateTarget (m_interpreter.GetDebugger(),
emptyFileSpec,
- emptyArchSpec,
+ NULL,
false,
+ NULL, // No platform options
target_sp);
if (!target_sp || error.Fail())
{
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Fri Sep 23 19:52:29 2011
@@ -186,48 +186,18 @@
const char *file_path = command.GetArgumentAtIndex(0);
Timer scoped_timer(__PRETTY_FUNCTION__, "(lldb) target create '%s'", file_path);
FileSpec file_spec (file_path, true);
-
- bool select = true;
- PlatformSP platform_sp;
-
- Error error;
-
- if (m_platform_options.PlatformWasSpecified ())
- {
- platform_sp = m_platform_options.CreatePlatformWithOptions(m_interpreter, select, error);
- if (!platform_sp)
- {
- result.AppendError(error.AsCString());
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
- }
- ArchSpec file_arch;
-
- const char *arch_cstr = m_arch_option.GetArchitectureName();
- if (arch_cstr)
- {
- if (!platform_sp)
- platform_sp = m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
- if (!m_arch_option.GetArchitecture(platform_sp.get(), file_arch))
- {
- result.AppendErrorWithFormat("invalid architecture '%s'\n", arch_cstr);
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
- }
-
- if (! file_spec.Exists() && !file_spec.ResolveExecutableLocation())
- {
- result.AppendErrorWithFormat ("File '%s' does not exist.\n", file_path);
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
-
+
TargetSP target_sp;
Debugger &debugger = m_interpreter.GetDebugger();
- error = debugger.GetTargetList().CreateTarget (debugger, file_spec, file_arch, true, target_sp);
-
+ const char *arch_cstr = m_arch_option.GetArchitectureName();
+ const bool get_dependent_files = true;
+ Error error (debugger.GetTargetList().CreateTarget (debugger,
+ file_spec,
+ arch_cstr,
+ get_dependent_files,
+ &m_platform_options,
+ target_sp));
+
if (target_sp)
{
debugger.GetTargetList().SetSelectedTarget(target_sp.get());
Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Fri Sep 23 19:52:29 2011
@@ -61,7 +61,7 @@
}
void
-ModuleList::Append (ModuleSP &module_sp)
+ModuleList::Append (const ModuleSP &module_sp)
{
if (module_sp)
{
@@ -71,7 +71,7 @@
}
bool
-ModuleList::AppendIfNeeded (ModuleSP &module_sp)
+ModuleList::AppendIfNeeded (const ModuleSP &module_sp)
{
if (module_sp)
{
@@ -90,7 +90,7 @@
}
bool
-ModuleList::Remove (ModuleSP &module_sp)
+ModuleList::Remove (const ModuleSP &module_sp)
{
if (module_sp)
{
Modified: lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp Fri Sep 23 19:52:29 2011
@@ -21,7 +21,7 @@
using namespace lldb_private;
PlatformSP
-OptionGroupPlatform::CreatePlatformWithOptions (CommandInterpreter &interpreter, bool make_selected, Error& error)
+OptionGroupPlatform::CreatePlatformWithOptions (CommandInterpreter &interpreter, bool make_selected, Error& error) const
{
PlatformSP platform_sp;
if (!m_platform_name.empty())
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Fri Sep 23 19:52:29 2011
@@ -423,12 +423,12 @@
{
TargetSP new_target_sp;
FileSpec emptyFileSpec;
- ArchSpec emptyArchSpec;
error = debugger.GetTargetList().CreateTarget (debugger,
emptyFileSpec,
- emptyArchSpec,
+ NULL,
false,
+ NULL,
new_target_sp);
target = new_target_sp.get();
}
Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Fri Sep 23 19:52:29 2011
@@ -360,12 +360,12 @@
{
TargetSP new_target_sp;
FileSpec emptyFileSpec;
- ArchSpec emptyArchSpec;
error = debugger.GetTargetList().CreateTarget (debugger,
emptyFileSpec,
- emptyArchSpec,
+ NULL,
false,
+ NULL,
new_target_sp);
target = new_target_sp.get();
}
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Fri Sep 23 19:52:29 2011
@@ -782,7 +782,7 @@
}
}
- if (executable_objfile)
+ if (executable_objfile && get_dependent_files)
{
executable_objfile->GetDependentModules(dependent_files);
for (uint32_t i=0; i<dependent_files.GetSize(); i++)
Modified: lldb/trunk/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/source/Target/TargetList.cpp (original)
+++ lldb/trunk/source/Target/TargetList.cpp Fri Sep 23 19:52:29 2011
@@ -17,6 +17,7 @@
#include "lldb/Core/State.h"
#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
+#include "lldb/Interpreter/OptionGroupPlatform.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/TargetList.h"
@@ -46,12 +47,59 @@
}
Error
+TargetList::CreateTarget (Debugger &debugger,
+ const FileSpec& file,
+ const char *triple_cstr,
+ bool get_dependent_files,
+ const OptionGroupPlatform *platform_options,
+ TargetSP &target_sp)
+{
+ Error error;
+ PlatformSP platform_sp;
+ if (platform_options)
+ {
+ if (platform_options->PlatformWasSpecified ())
+ {
+ const bool select_platform = true;
+ platform_sp = platform_options->CreatePlatformWithOptions (debugger.GetCommandInterpreter(),
+ select_platform,
+ error);
+ if (!platform_sp)
+ return error;
+ }
+ }
+
+ if (!platform_sp)
+ platform_sp = debugger.GetPlatformList().GetSelectedPlatform ();
+
+ ArchSpec arch;
+
+ if (triple_cstr)
+ {
+ arch.SetTriple(triple_cstr, platform_sp.get());
+ if (!arch.IsValid())
+ {
+ error.SetErrorStringWithFormat("invalid triple '%s'\n", triple_cstr);
+ return error;
+ }
+ }
+ error = TargetList::CreateTarget (debugger,
+ file,
+ arch,
+ get_dependent_files,
+ platform_sp,
+ target_sp);
+ return error;
+}
+
+Error
TargetList::CreateTarget
(
Debugger &debugger,
const FileSpec& file,
const ArchSpec& arch,
bool get_dependent_files,
+ const PlatformSP &platform_sp,
TargetSP &target_sp
)
{
@@ -62,7 +110,6 @@
arch.GetArchitectureName());
Error error;
- PlatformSP platform_sp (debugger.GetPlatformList().GetSelectedPlatform ());
if (file)
{
Modified: lldb/trunk/test/python_api/default-constructor/sb_address.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_address.py?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_address.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_address.py Fri Sep 23 19:52:29 2011
@@ -11,7 +11,7 @@
obj.SetLoadAddress(0xffff, lldb.SBTarget())
obj.OffsetAddress(sys.maxint)
obj.GetDescription(lldb.SBStream())
- obj.GetSectionType()
+ obj.GetSection()
obj.GetSymbolContext(lldb.eSymbolContextEverything)
obj.GetModule()
obj.GetCompileUnit()
Modified: lldb/trunk/test/python_api/default-constructor/sb_module.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_module.py?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_module.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_module.py Fri Sep 23 19:52:29 2011
@@ -10,7 +10,7 @@
obj.GetPlatformFileSpec()
obj.SetPlatformFileSpec(lldb.SBFileSpec())
obj.GetUUIDString()
- obj.ResolveFileAddress(sys.maxint, lldb.SBAddress())
+ obj.ResolveFileAddress(sys.maxint)
obj.ResolveSymbolContextForAddress(lldb.SBAddress(), 0)
obj.GetDescription(lldb.SBStream())
obj.GetNumSymbols()
Modified: lldb/trunk/test/python_api/function_symbol/TestSymbolAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/function_symbol/TestSymbolAPI.py?rev=140437&r1=140436&r2=140437&view=diff
==============================================================================
--- lldb/trunk/test/python_api/function_symbol/TestSymbolAPI.py (original)
+++ lldb/trunk/test/python_api/function_symbol/TestSymbolAPI.py Fri Sep 23 19:52:29 2011
@@ -66,7 +66,7 @@
self.assertTrue(symbol_line1.GetType() == lldb.eSymbolTypeCode)
addr_line1 = symbol_line1.GetStartAddress()
# And a section type of code, too.
- self.assertTrue(addr_line1.GetSectionType() == lldb.eSectionTypeCode)
+ self.assertTrue(addr_line1.GetSection().GetSectionType() == lldb.eSectionTypeCode)
# Continue the inferior, the breakpoint 2 should be hit.
process.Continue()
@@ -79,7 +79,7 @@
self.assertTrue(symbol_line2.GetType() == lldb.eSymbolTypeCode)
addr_line2 = symbol_line2.GetStartAddress()
# And a section type of code, too.
- self.assertTrue(addr_line2.GetSectionType() == lldb.eSectionTypeCode)
+ self.assertTrue(addr_line2.GetSection().GetSectionType() == lldb.eSectionTypeCode)
# Now verify that both addresses point to the same module.
if self.TraceOn():
More information about the lldb-commits
mailing list