summaryrefslogtreecommitdiffstats
path: root/source/API/SBModule.cpp
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2015-07-03 16:57:06 +0000
committeremaste <emaste@FreeBSD.org>2015-07-03 16:57:06 +0000
commit8037fa4ee916fa20b3c63cbf531f4ee7e1c76138 (patch)
tree3c2e41c3be19b7fc7666ed45a5f91ec3b6e35f2a /source/API/SBModule.cpp
parentd61b076ede88b56f3372a55e7d1eac6a9d717120 (diff)
downloadFreeBSD-src-8037fa4ee916fa20b3c63cbf531f4ee7e1c76138.zip
FreeBSD-src-8037fa4ee916fa20b3c63cbf531f4ee7e1c76138.tar.gz
Import LLDB as of upstream SVN 241361 (git 612c075f)
Diffstat (limited to 'source/API/SBModule.cpp')
-rw-r--r--source/API/SBModule.cpp64
1 files changed, 43 insertions, 21 deletions
diff --git a/source/API/SBModule.cpp b/source/API/SBModule.cpp
index 0d7dda1..0249a7e 100644
--- a/source/API/SBModule.cpp
+++ b/source/API/SBModule.cpp
@@ -20,6 +20,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Core/ValueObjectVariable.h"
+#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/Symtab.h"
@@ -211,34 +212,28 @@ SBModule::GetUUIDString () const
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- static char uuid_string_buffer[80];
- const char *uuid_c_string = NULL;
- std::string uuid_string;
+ const char *uuid_cstr = NULL;
ModuleSP module_sp (GetSP ());
if (module_sp)
- uuid_string = module_sp->GetUUID().GetAsString();
-
- if (!uuid_string.empty())
{
- strncpy (uuid_string_buffer, uuid_string.c_str(), sizeof (uuid_string_buffer));
- uuid_string_buffer[sizeof (uuid_string_buffer) - 1] = '\0';
- uuid_c_string = uuid_string_buffer;
+ // We are going to return a "const char *" value through the public
+ // API, so we need to constify it so it gets added permanently the
+ // string pool and then we don't need to worry about the lifetime of the
+ // string as it will never go away once it has been put into the ConstString
+ // string pool
+ uuid_cstr = ConstString(module_sp->GetUUID().GetAsString()).GetCString();
}
- if (log)
+ if (uuid_cstr && uuid_cstr[0])
{
- if (!uuid_string.empty())
- {
- StreamString s;
- module_sp->GetUUID().Dump (&s);
- log->Printf ("SBModule(%p)::GetUUIDString () => %s",
- static_cast<void*>(module_sp.get()), s.GetData());
- }
- else
- log->Printf ("SBModule(%p)::GetUUIDString () => NULL",
- static_cast<void*>(module_sp.get()));
+ if (log)
+ log->Printf ("SBModule(%p)::GetUUIDString () => %s", static_cast<void*>(module_sp.get()), uuid_cstr);
+ return uuid_cstr;
}
- return uuid_c_string;
+
+ if (log)
+ log->Printf ("SBModule(%p)::GetUUIDString () => NULL", static_cast<void*>(module_sp.get()));
+ return NULL;
}
@@ -690,3 +685,30 @@ SBModule::GetVersion (uint32_t *versions, uint32_t num_versions)
}
}
+lldb::SBFileSpec
+SBModule::GetSymbolFileSpec() const
+{
+ lldb::SBFileSpec sb_file_spec;
+ ModuleSP module_sp(GetSP());
+ if (module_sp)
+ {
+ SymbolVendor *symbol_vendor_ptr = module_sp->GetSymbolVendor();
+ if (symbol_vendor_ptr)
+ sb_file_spec.SetFileSpec(symbol_vendor_ptr->GetMainFileSpec());
+ }
+ return sb_file_spec;
+}
+
+lldb::SBAddress
+SBModule::GetObjectFileHeaderAddress() const
+{
+ lldb::SBAddress sb_addr;
+ ModuleSP module_sp (GetSP ());
+ if (module_sp)
+ {
+ ObjectFile *objfile_ptr = module_sp->GetObjectFile();
+ if (objfile_ptr)
+ sb_addr.ref() = objfile_ptr->GetHeaderAddress();
+ }
+ return sb_addr;
+}
OpenPOWER on IntegriCloud