summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBDebugger.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-09-24 00:52:29 +0000
committerGreg Clayton <gclayton@apple.com>2011-09-24 00:52:29 +0000
commitcac9c5f971eb7fda865982dbb6180d77aa5a45bf (patch)
treeefac05a2f3ad55c656c0c2397c3407e358efc5b1 /lldb/source/API/SBDebugger.cpp
parent6027c94d2f7f31917226e0eaa544d22cdf90a713 (diff)
downloadbcm5719-llvm-cac9c5f971eb7fda865982dbb6180d77aa5a45bf.tar.gz
bcm5719-llvm-cac9c5f971eb7fda865982dbb6180d77aa5a45bf.zip
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. llvm-svn: 140437
Diffstat (limited to 'lldb/source/API/SBDebugger.cpp')
-rw-r--r--lldb/source/API/SBDebugger.cpp79
1 files changed, 69 insertions, 10 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index acb69faad70..0f5472a9be3 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -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 @@ SBDebugger::StateIsStoppedState (StateType state)
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 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
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 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *arch_
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 @@ SBDebugger::CreateTarget (const char *filename)
ArchSpec arch = Target::GetDefaultArchitecture ();
TargetSP target_sp;
Error error;
-
- error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, true, target_sp);
+ const bool add_dependent_modules = true;
+
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp,
+ file,
+ arch,
+ add_dependent_modules,
+ m_opaque_sp->GetPlatformList().GetSelectedPlatform(),
+ target_sp);
if (error.Success())
{
OpenPOWER on IntegriCloud