summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/API/SBStream.h7
-rw-r--r--lldb/include/lldb/API/SBTarget.h5
-rw-r--r--lldb/include/lldb/API/SBType.h13
-rw-r--r--lldb/include/lldb/Symbol/ClangASTContext.h6
-rw-r--r--lldb/include/lldb/Symbol/Type.h5
-rw-r--r--lldb/scripts/Python/interface/SBTarget.i2
-rw-r--r--lldb/scripts/Python/interface/SBType.i7
-rw-r--r--lldb/scripts/Python/python-extensions.swig14
-rw-r--r--lldb/source/API/SBAddress.cpp6
-rw-r--r--lldb/source/API/SBBlock.cpp10
-rw-r--r--lldb/source/API/SBBreakpointLocation.cpp9
-rw-r--r--lldb/source/API/SBCommandReturnObject.cpp16
-rw-r--r--lldb/source/API/SBCompileUnit.cpp7
-rw-r--r--lldb/source/API/SBData.cpp25
-rw-r--r--lldb/source/API/SBDebugger.cpp6
-rw-r--r--lldb/source/API/SBEvent.cpp14
-rw-r--r--lldb/source/API/SBFileSpec.cpp6
-rw-r--r--lldb/source/API/SBFileSpecList.cpp9
-rw-r--r--lldb/source/API/SBFrame.cpp7
-rw-r--r--lldb/source/API/SBLineEntry.cpp8
-rw-r--r--lldb/source/API/SBModule.cpp7
-rw-r--r--lldb/source/API/SBProcess.cpp16
-rw-r--r--lldb/source/API/SBSection.cpp8
-rw-r--r--lldb/source/API/SBSymbol.cpp7
-rw-r--r--lldb/source/API/SBSymbolContext.cpp7
-rw-r--r--lldb/source/API/SBTarget.cpp20
-rw-r--r--lldb/source/API/SBThread.cpp7
-rw-r--r--lldb/source/API/SBType.cpp71
-rw-r--r--lldb/source/API/SBValue.cpp19
-rw-r--r--lldb/source/API/SBWatchpoint.cpp9
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp55
-rw-r--r--lldb/source/Symbol/ClangASTType.cpp80
-rw-r--r--lldb/source/Symbol/Type.cpp18
33 files changed, 324 insertions, 182 deletions
diff --git a/lldb/include/lldb/API/SBStream.h b/lldb/include/lldb/API/SBStream.h
index 44e3a81185d..a3b112e5b88 100644
--- a/lldb/include/lldb/API/SBStream.h
+++ b/lldb/include/lldb/API/SBStream.h
@@ -64,18 +64,25 @@ protected:
friend class SBCommandReturnObject;
friend class SBCompileUnit;
friend class SBData;
+ friend class SBDebugger;
friend class SBEvent;
+ friend class SBFileSpec;
+ friend class SBFileSpecList;
friend class SBFrame;
friend class SBFunction;
friend class SBInstruction;
friend class SBInstructionList;
+ friend class SBLineEntry;
friend class SBModule;
+ friend class SBProcess;
friend class SBSection;
friend class SBSourceManager;
friend class SBSymbol;
friend class SBSymbolContext;
friend class SBTarget;
friend class SBThread;
+ friend class SBType;
+ friend class SBTypeMember;
friend class SBValue;
friend class SBWatchpoint;
diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h
index a06d6a55d56..31a7d6d2bd9 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -496,13 +496,8 @@ public:
#endif
-#ifndef SWIG
bool
GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
-#endif
-
- bool
- GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level) const;
protected:
friend class SBAddress;
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 7aa4252d3ca..ff41d37aa4d 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -40,7 +40,14 @@ public:
GetType ();
uint64_t
- GetOffsetByteSize();
+ GetOffsetInBytes();
+
+ uint64_t
+ GetOffsetInBits();
+
+ bool
+ GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
protected:
friend class SBType;
@@ -127,6 +134,10 @@ public:
static bool
IsPointerType (void * clang_type);
+ bool
+ GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
protected:
#ifndef SWIG
diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h
index 8db018f3d28..522128a2a37 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -513,20 +513,20 @@ public:
GetDirectBaseClassAtIndex (clang::ASTContext *ast,
lldb::clang_type_t clang_type,
uint32_t idx,
- uint32_t *byte_offset_ptr);
+ uint32_t *bit_offset_ptr);
static lldb::clang_type_t
GetVirtualBaseClassAtIndex (clang::ASTContext *ast,
lldb::clang_type_t clang_type,
uint32_t idx,
- uint32_t *byte_offset_ptr);
+ uint32_t *bit_offset_ptr);
static lldb::clang_type_t
GetFieldAtIndex (clang::ASTContext *ast,
lldb::clang_type_t clang_type,
uint32_t idx,
std::string& name,
- uint32_t *byte_offset_ptr);
+ uint32_t *bit_offset_ptr);
static uint32_t
GetNumPointeeChildren (lldb::clang_type_t clang_type);
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 3bbf2261895..9c11ae41f2f 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -355,6 +355,11 @@ public:
lldb::clang_type_t
GetOpaqueQualType();
+ bool
+ GetDescription (lldb_private::Stream &strm,
+ lldb::DescriptionLevel description_level);
+
+
private:
ClangASTType m_clang_ast_type;
lldb::TypeSP m_type_sp;
diff --git a/lldb/scripts/Python/interface/SBTarget.i b/lldb/scripts/Python/interface/SBTarget.i
index d462ed91b18..04dcfbf9d21 100644
--- a/lldb/scripts/Python/interface/SBTarget.i
+++ b/lldb/scripts/Python/interface/SBTarget.i
@@ -472,7 +472,7 @@ public:
GetBroadcaster () const;
bool
- GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level) const;
+ GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
};
} // namespace lldb
diff --git a/lldb/scripts/Python/interface/SBType.i b/lldb/scripts/Python/interface/SBType.i
index 2cc384085b6..949fae174e3 100644
--- a/lldb/scripts/Python/interface/SBType.i
+++ b/lldb/scripts/Python/interface/SBType.i
@@ -32,8 +32,11 @@ public:
GetType ();
uint64_t
- GetOffsetByteSize();
-
+ GetOffsetInBytes();
+
+ uint64_t
+ GetOffsetInBits();
+
protected:
std::auto_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
};
diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig
index 52ec68e46f1..c50e43db9f0 100644
--- a/lldb/scripts/Python/python-extensions.swig
+++ b/lldb/scripts/Python/python-extensions.swig
@@ -146,6 +146,20 @@
return PyString_FromString (description.GetData());
}
}
+%extend lldb::SBType {
+ PyObject *lldb::SBType::__repr__ (){
+ lldb::SBStream description;
+ $self->GetDescription (description, lldb::eDescriptionLevelBrief);
+ return PyString_FromString (description.GetData());
+ }
+}
+%extend lldb::SBTypeMember {
+ PyObject *lldb::SBTypeMember::__repr__ (){
+ lldb::SBStream description;
+ $self->GetDescription (description, lldb::eDescriptionLevelBrief);
+ return PyString_FromString (description.GetData());
+ }
+}
%extend lldb::SBThread {
PyObject *lldb::SBThread::__repr__ (){
lldb::SBStream description;
diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp
index 9066bb448fb..dcd9581d6b5 100644
--- a/lldb/source/API/SBAddress.cpp
+++ b/lldb/source/API/SBAddress.cpp
@@ -277,11 +277,11 @@ SBAddress::GetDescription (SBStream &description)
{
// Call "ref()" on the stream to make sure it creates a backing stream in
// case there isn't one already...
- description.ref();
+ Stream &strm = description.ref();
if (m_opaque_ap.get())
- m_opaque_ap->GetAddress().Dump (description.get(), NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4);
+ m_opaque_ap->GetAddress().Dump (&strm, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4);
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBBlock.cpp b/lldb/source/API/SBBlock.cpp
index 580d2b5a213..eeae1d3b02b 100644
--- a/lldb/source/API/SBBlock.cpp
+++ b/lldb/source/API/SBBlock.cpp
@@ -171,24 +171,26 @@ SBBlock::reset (lldb_private::Block *block)
bool
SBBlock::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_ptr)
{
lldb::user_id_t id = m_opaque_ptr->GetID();
- description.Printf ("Block: {id: %llu} ", id);
+ strm.Printf ("Block: {id: %llu} ", id);
if (IsInlined())
{
- description.Printf (" (inlined, '%s') ", GetInlinedName());
+ strm.Printf (" (inlined, '%s') ", GetInlinedName());
}
lldb_private::SymbolContext sc;
m_opaque_ptr->CalculateSymbolContext (&sc);
if (sc.function)
{
- m_opaque_ptr->DumpAddressRanges (description.get(),
+ m_opaque_ptr->DumpAddressRanges (&strm,
sc.function->GetAddressRange().GetBaseAddress().GetFileAddress());
}
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp
index 20e4ac870d4..619428eb8c8 100644
--- a/lldb/source/API/SBBreakpointLocation.cpp
+++ b/lldb/source/API/SBBreakpointLocation.cpp
@@ -275,15 +275,16 @@ SBBreakpointLocation::SetLocation (const lldb::BreakpointLocationSP &break_loc_s
bool
SBBreakpointLocation::GetDescription (SBStream &description, DescriptionLevel level)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
- description.ref();
- m_opaque_sp->GetDescription (description.get(), level);
- description.get()->EOL();
+ m_opaque_sp->GetDescription (&strm, level);
+ strm.EOL();
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBCommandReturnObject.cpp b/lldb/source/API/SBCommandReturnObject.cpp
index d17de941935..ffff751a10a 100644
--- a/lldb/source/API/SBCommandReturnObject.cpp
+++ b/lldb/source/API/SBCommandReturnObject.cpp
@@ -221,27 +221,29 @@ SBCommandReturnObject::SetLLDBObjectPtr (CommandReturnObject *ptr)
bool
SBCommandReturnObject::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_ap.get())
{
description.Printf ("Status: ");
lldb::ReturnStatus status = m_opaque_ap->GetStatus();
if (status == lldb::eReturnStatusStarted)
- description.Printf ("Started");
+ strm.PutCString ("Started");
else if (status == lldb::eReturnStatusInvalid)
- description.Printf ("Invalid");
+ strm.PutCString ("Invalid");
else if (m_opaque_ap->Succeeded())
- description.Printf ("Success");
+ strm.PutCString ("Success");
else
- description.Printf ("Fail");
+ strm.PutCString ("Fail");
if (GetOutputSize() > 0)
- description.Printf ("\nOutput Message:\n%s", GetOutput());
+ strm.Printf ("\nOutput Message:\n%s", GetOutput());
if (GetErrorSize() > 0)
- description.Printf ("\nError Message:\n%s", GetError());
+ strm.Printf ("\nError Message:\n%s", GetError());
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBCompileUnit.cpp b/lldb/source/API/SBCompileUnit.cpp
index 15903627016..b1bb447753d 100644
--- a/lldb/source/API/SBCompileUnit.cpp
+++ b/lldb/source/API/SBCompileUnit.cpp
@@ -189,13 +189,14 @@ SBCompileUnit::reset (lldb_private::CompileUnit *lldb_object_ptr)
bool
SBCompileUnit::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_ptr)
{
- description.ref();
- m_opaque_ptr->Dump (description.get(), false);
+ m_opaque_ptr->Dump (&strm, false);
}
else
- description.Printf ("No Value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBData.cpp b/lldb/source/API/SBData.cpp
index e5c29a9ea01..f8735266236 100644
--- a/lldb/source/API/SBData.cpp
+++ b/lldb/source/API/SBData.cpp
@@ -13,6 +13,8 @@
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Log.h"
+#include "lldb/Core/Stream.h"
+
using namespace lldb;
using namespace lldb_private;
@@ -414,21 +416,22 @@ SBData::GetString (lldb::SBError& error, uint32_t offset)
bool
SBData::GetDescription (lldb::SBStream &description, lldb::addr_t base_addr)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
- description.ref();
- m_opaque_sp->Dump(description.get(),
- 0,
- lldb::eFormatBytesWithASCII,
- 1,
- m_opaque_sp->GetByteSize(),
- 16,
- base_addr,
- 0,
- 0);
+ m_opaque_sp->Dump (&strm,
+ 0,
+ lldb::eFormatBytesWithASCII,
+ 1,
+ m_opaque_sp->GetByteSize(),
+ 16,
+ base_addr,
+ 0,
+ 0);
}
else
- description.Printf ("No Value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index dfef7eb3178..b15bc3d7611 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -965,14 +965,16 @@ SBDebugger::GetUseExternalEditor ()
bool
SBDebugger::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
const char *name = m_opaque_sp->GetInstanceName().AsCString();
user_id_t id = m_opaque_sp->GetID();
- description.Printf ("Debugger (instance: \"%s\", id: %llu)", name, id);
+ strm.Printf ("Debugger (instance: \"%s\", id: %llu)", name, id);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBEvent.cpp b/lldb/source/API/SBEvent.cpp
index 19073e8c3ec..f9d0e0cc3a8 100644
--- a/lldb/source/API/SBEvent.cpp
+++ b/lldb/source/API/SBEvent.cpp
@@ -205,13 +205,14 @@ SBEvent::GetCStringFromEvent (const SBEvent &event)
bool
SBEvent::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (get())
{
- description.ref();
- m_opaque_ptr->Dump (description.get());
+ m_opaque_ptr->Dump (&strm);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
@@ -219,13 +220,14 @@ SBEvent::GetDescription (SBStream &description)
bool
SBEvent::GetDescription (SBStream &description) const
{
+ Stream &strm = description.ref();
+
if (get())
{
- description.ref();
- m_opaque_ptr->Dump (description.get());
+ m_opaque_ptr->Dump (&strm);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp
index a3a503dd601..a6c753caa00 100644
--- a/lldb/source/API/SBFileSpec.cpp
+++ b/lldb/source/API/SBFileSpec.cpp
@@ -13,6 +13,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Core/Log.h"
+#include "lldb/Core/Stream.h"
using namespace lldb;
using namespace lldb_private;
@@ -200,14 +201,15 @@ SBFileSpec::SetFileSpec (const lldb_private::FileSpec& fs)
bool
SBFileSpec::GetDescription (SBStream &description) const
{
+ Stream &strm = description.ref();
if (m_opaque_ap.get())
{
char path[PATH_MAX];
if (m_opaque_ap->GetPath(path, sizeof(path)))
- description.Printf ("%s", path);
+ strm.PutCString (path);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBFileSpecList.cpp b/lldb/source/API/SBFileSpecList.cpp
index a4250bc4c59..5f65bf51ef1 100644
--- a/lldb/source/API/SBFileSpecList.cpp
+++ b/lldb/source/API/SBFileSpecList.cpp
@@ -14,6 +14,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/Log.h"
+#include "lldb/Core/Stream.h"
#include "lldb/Host/FileSpec.h"
using namespace lldb;
@@ -121,19 +122,21 @@ SBFileSpecList::ref() const
bool
SBFileSpecList::GetDescription (SBStream &description) const
{
+ Stream &strm = description.ref();
+
if (m_opaque_ap.get())
{
uint32_t num_files = m_opaque_ap->GetSize();
- description.Printf ("%d files: ", num_files);
+ strm.Printf ("%d files: ", num_files);
for (uint32_t i = 0; i < num_files; i++)
{
char path[PATH_MAX];
if (m_opaque_ap->GetFileSpecAtIndex(i).GetPath(path, sizeof(path)))
- description.Printf ("\n %s", path);
+ strm.Printf ("\n %s", path);
}
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index 300ae2edd0c..a541047e9ad 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -708,14 +708,15 @@ SBFrame::GetRegisters ()
bool
SBFrame::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
- Stream &s = description.ref();
- m_opaque_sp->DumpUsingSettingsFormat (&s);
+ m_opaque_sp->DumpUsingSettingsFormat (&strm);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBLineEntry.cpp b/lldb/source/API/SBLineEntry.cpp
index 6915f58b24d..db288bc6f0c 100644
--- a/lldb/source/API/SBLineEntry.cpp
+++ b/lldb/source/API/SBLineEntry.cpp
@@ -225,16 +225,18 @@ SBLineEntry::ref() const
bool
SBLineEntry::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_ap.get())
{
char file_path[PATH_MAX*2];
m_opaque_ap->file.GetPath (file_path, sizeof (file_path));
- description.Printf ("%s:%u", file_path, GetLine());
+ strm.Printf ("%s:%u", file_path, GetLine());
if (GetColumn() > 0)
- description.Printf (":%u", GetColumn());
+ strm.Printf (":%u", GetColumn());
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp
index 98bb195ca72..a42989757e1 100644
--- a/lldb/source/API/SBModule.cpp
+++ b/lldb/source/API/SBModule.cpp
@@ -255,13 +255,14 @@ SBModule::ResolveSymbolContextForAddress (const SBAddress& addr, uint32_t resolv
bool
SBModule::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
- description.ref();
- m_opaque_sp->GetDescription (description.get());
+ m_opaque_sp->GetDescription (&strm);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index d6bdfe162c7..66abd086c40 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -814,6 +814,8 @@ SBProcess::get() const
bool
SBProcess::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
char path[PATH_MAX];
@@ -823,15 +825,15 @@ SBProcess::GetDescription (SBStream &description)
if (exe_module)
exe_name = exe_module->GetFileSpec().GetFilename().AsCString();
- description.Printf ("SBProcess: pid = %llu, state = %s, threads = %d%s%s",
- m_opaque_sp->GetID(),
- lldb_private::StateAsCString (GetState()),
- GetNumThreads(),
- exe_name ? ", executable = " : "",
- exe_name ? exe_name : "");
+ strm.Printf ("SBProcess: pid = %llu, state = %s, threads = %d%s%s",
+ m_opaque_sp->GetID(),
+ lldb_private::StateAsCString (GetState()),
+ GetNumThreads(),
+ exe_name ? ", executable = " : "",
+ exe_name ? exe_name : "");
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBSection.cpp b/lldb/source/API/SBSection.cpp
index 3a6efb4d5f1..bdcf422e333 100644
--- a/lldb/source/API/SBSection.cpp
+++ b/lldb/source/API/SBSection.cpp
@@ -326,16 +326,18 @@ SBSection::operator != (const SBSection &rhs)
bool
SBSection::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (IsValid())
{
const Section *section = m_opaque_ap->GetSection();
const addr_t file_addr = section->GetFileAddress();
- description.Printf ("[0x%16.16llx-0x%16.16llx) ", file_addr, file_addr + section->GetByteSize());
- section->DumpName(description.get());
+ strm.Printf ("[0x%16.16llx-0x%16.16llx) ", file_addr, file_addr + section->GetByteSize());
+ section->DumpName(&strm);
}
else
{
- description.Printf ("No value");
+ strm.PutCString ("No value");
}
return true;
diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp
index ce232bf3f6a..1765dbddd8e 100644
--- a/lldb/source/API/SBSymbol.cpp
+++ b/lldb/source/API/SBSymbol.cpp
@@ -100,14 +100,15 @@ SBSymbol::operator != (const SBSymbol &rhs) const
bool
SBSymbol::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_ptr)
{
- description.ref();
- m_opaque_ptr->GetDescription (description.get(),
+ m_opaque_ptr->GetDescription (&strm,
lldb::eDescriptionLevelFull, NULL);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBSymbolContext.cpp b/lldb/source/API/SBSymbolContext.cpp
index 01118c86483..1ec79df1ac0 100644
--- a/lldb/source/API/SBSymbolContext.cpp
+++ b/lldb/source/API/SBSymbolContext.cpp
@@ -254,13 +254,14 @@ SBSymbolContext::get() const
bool
SBSymbolContext::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_ap.get())
{
- description.ref();
- m_opaque_ap->GetDescription (description.get(), lldb::eDescriptionLevelFull, NULL);
+ m_opaque_ap->GetDescription (&strm, lldb::eDescriptionLevelFull, NULL);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index f79d4f3c01c..58d89b197ae 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1152,32 +1152,18 @@ SBTarget::GetBroadcaster () const
bool
SBTarget::GetDescription (SBStream &description, lldb::DescriptionLevel description_level)
{
- if (m_opaque_sp)
- {
- description.ref();
- m_opaque_sp->Dump (description.get(), description_level);
- }
- else
- description.Printf ("No value");
-
- return true;
-}
+ Stream &strm = description.ref();
-bool
-SBTarget::GetDescription (SBStream &description, lldb::DescriptionLevel description_level) const
-{
if (m_opaque_sp)
{
- description.ref();
- m_opaque_sp->Dump (description.get(), description_level);
+ m_opaque_sp->Dump (&strm, description_level);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
-
uint32_t
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask,
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index cc3b84171c1..5fcd6379d0b 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -951,13 +951,14 @@ SBThread::operator*()
bool
SBThread::GetDescription (SBStream &description) const
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
- StreamString strm;
- description.Printf("SBThread: tid = 0x%4.4llx", m_opaque_sp->GetID());
+ strm.Printf("SBThread: tid = 0x%4.4llx", m_opaque_sp->GetID());
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index 3064398e574..36fcfa7792f 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -18,6 +18,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Log.h"
+#include "lldb/Core/Stream.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/Type.h"
@@ -342,6 +343,23 @@ SBType::GetNumberOfFields ()
return 0;
}
+bool
+SBType::GetDescription (SBStream &description, lldb::DescriptionLevel description_level)
+{
+ Stream &strm = description.ref();
+
+ if (m_opaque_sp)
+ {
+ m_opaque_sp->GetDescription (strm, description_level);
+ }
+ else
+ strm.PutCString ("No value");
+
+ return true;
+}
+
+
+
SBTypeMember
SBType::GetDirectBaseClassAtIndex (uint32_t idx)
{
@@ -349,12 +367,12 @@ SBType::GetDirectBaseClassAtIndex (uint32_t idx)
if (IsValid())
{
clang::ASTContext* ast = m_opaque_sp->GetASTContext();
- uint32_t byte_offset = 0;
- clang_type_t clang_type = ClangASTContext::GetDirectBaseClassAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, &byte_offset);
+ uint32_t bit_offset = 0;
+ clang_type_t clang_type = ClangASTContext::GetDirectBaseClassAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, &bit_offset);
if (clang_type)
{
TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
- sb_type_member.reset (new TypeMemberImpl (type_impl_sp, byte_offset));
+ sb_type_member.reset (new TypeMemberImpl (type_impl_sp, bit_offset));
}
}
return sb_type_member;
@@ -367,13 +385,13 @@ SBType::GetVirtualBaseClassAtIndex (uint32_t idx)
SBTypeMember sb_type_member;
if (IsValid())
{
- uint32_t byte_offset = 0;
+ uint32_t bit_offset = 0;
clang::ASTContext* ast = m_opaque_sp->GetASTContext();
- clang_type_t clang_type = ClangASTContext::GetVirtualBaseClassAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, &byte_offset);
+ clang_type_t clang_type = ClangASTContext::GetVirtualBaseClassAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, &bit_offset);
if (clang_type)
{
TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
- sb_type_member.reset (new TypeMemberImpl (type_impl_sp, byte_offset));
+ sb_type_member.reset (new TypeMemberImpl (type_impl_sp, bit_offset));
}
}
return sb_type_member;
@@ -385,17 +403,17 @@ SBType::GetFieldAtIndex (uint32_t idx)
SBTypeMember sb_type_member;
if (IsValid())
{
- uint32_t byte_offset = 0;
+ uint32_t bit_offset = 0;
clang::ASTContext* ast = m_opaque_sp->GetASTContext();
std::string name_sstr;
- clang_type_t clang_type = ClangASTContext::GetFieldAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, name_sstr, &byte_offset);
+ clang_type_t clang_type = ClangASTContext::GetFieldAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, name_sstr, &bit_offset);
if (clang_type)
{
ConstString name;
if (!name_sstr.empty())
name.SetCString(name_sstr.c_str());
TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
- sb_type_member.reset (new TypeMemberImpl (type_impl_sp, byte_offset, name));
+ sb_type_member.reset (new TypeMemberImpl (type_impl_sp, bit_offset, name));
}
}
return sb_type_member;
@@ -545,13 +563,46 @@ SBTypeMember::GetType ()
}
uint64_t
-SBTypeMember::GetOffsetByteSize()
+SBTypeMember::GetOffsetInBytes()
{
if (m_opaque_ap.get())
return (m_opaque_ap->GetBitOffset() + 7) / 8u;
return 0;
}
+uint64_t
+SBTypeMember::GetOffsetInBits()
+{
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetBitOffset();
+ return 0;
+}
+
+bool
+SBTypeMember::GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level)
+{
+ Stream &strm = description.ref();
+
+ if (m_opaque_ap.get())
+ {
+ const uint32_t byte_offset = (m_opaque_ap->GetBitOffset() + 7) / 8u;
+ const char *name = m_opaque_ap->GetName().GetCString();
+ strm.Printf ("+%u: (", byte_offset);
+
+ TypeImplSP type_impl_sp (m_opaque_ap->GetTypeImpl());
+ if (type_impl_sp)
+ type_impl_sp->GetDescription(strm, description_level);
+
+ strm.Printf (") %s", name);
+ }
+ else
+ {
+ strm.PutCString ("No value");
+ }
+ return true;
+}
+
+
void
SBTypeMember::reset(TypeMemberImpl *type_member_impl)
{
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index dc594cbfcba..6ef4c387258 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -917,25 +917,14 @@ SBValue::GetExpressionPath (SBStream &description, bool qualify_cxx_base_classes
bool
SBValue::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
- /*uint32_t ptr_depth = 0;
- uint32_t curr_depth = 0;
- uint32_t max_depth = UINT32_MAX;
- bool show_types = false;
- bool show_location = false;
- bool use_objc = false;
- lldb::DynamicValueType use_dynamic = eNoDynamicValues;
- bool scope_already_checked = false;
- bool flat_output = false;
- bool use_synthetic = true;
- uint32_t no_summary_depth = 0;
- bool ignore_cap = false;*/
- ValueObject::DumpValueObject (description.ref(),
- m_opaque_sp.get());
+ ValueObject::DumpValueObject (strm, m_opaque_sp.get());
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/API/SBWatchpoint.cpp b/lldb/source/API/SBWatchpoint.cpp
index ec2dc128f15..f7885753641 100644
--- a/lldb/source/API/SBWatchpoint.cpp
+++ b/lldb/source/API/SBWatchpoint.cpp
@@ -229,15 +229,16 @@ SBWatchpoint::SetCondition (const char *condition)
bool
SBWatchpoint::GetDescription (SBStream &description, DescriptionLevel level)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- description.ref();
- m_opaque_sp->GetDescription (description.get(), level);
- description.get()->EOL();
+ m_opaque_sp->GetDescription (&strm, level);
+ strm.EOL();
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index a476b33e261..d7e1ddff8c6 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -2844,6 +2844,21 @@ ClangASTContext::GetNumFields (clang::ASTContext *ast, clang_type_t clang_type)
count = ClangASTContext::GetNumFields (ast, cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
break;
+ case clang::Type::ObjCObject:
+ case clang::Type::ObjCInterface:
+ if (GetCompleteQualType (ast, qual_type))
+ {
+ const ObjCObjectType *objc_class_type = dyn_cast<ObjCObjectType>(qual_type.getTypePtr());
+ if (objc_class_type)
+ {
+ ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
+
+ if (class_interface_decl)
+ count = class_interface_decl->ivar_size();
+ }
+ }
+ break;
+
default:
break;
}
@@ -2854,7 +2869,7 @@ clang_type_t
ClangASTContext::GetDirectBaseClassAtIndex (clang::ASTContext *ast,
clang_type_t clang_type,
uint32_t idx,
- uint32_t *byte_offset_ptr)
+ uint32_t *bit_offset_ptr)
{
if (clang_type == NULL)
return 0;
@@ -2877,14 +2892,14 @@ ClangASTContext::GetDirectBaseClassAtIndex (clang::ASTContext *ast,
{
if (curr_idx == idx)
{
- if (byte_offset_ptr)
+ if (bit_offset_ptr)
{
const ASTRecordLayout &record_layout = ast->getASTRecordLayout(cxx_record_decl);
const CXXRecordDecl *base_class_decl = cast<CXXRecordDecl>(base_class->getType()->getAs<RecordType>()->getDecl());
// if (base_class->isVirtual())
-// *byte_offset_ptr = record_layout.getVBaseClassOffset(base_class_decl).getQuantity() * 8;
+// *bit_offset_ptr = record_layout.getVBaseClassOffset(base_class_decl).getQuantity() * 8;
// else
- *byte_offset_ptr = record_layout.getBaseClassOffset(base_class_decl).getQuantity() * 8;
+ *bit_offset_ptr = record_layout.getBaseClassOffset(base_class_decl).getQuantity() * 8;
}
return base_class->getType().getAsOpaquePtr();
}
@@ -2907,8 +2922,8 @@ ClangASTContext::GetDirectBaseClassAtIndex (clang::ASTContext *ast,
ObjCInterfaceDecl *superclass_interface_decl = class_interface_decl->getSuperClass();
if (superclass_interface_decl)
{
- if (byte_offset_ptr)
- *byte_offset_ptr = 0;
+ if (bit_offset_ptr)
+ *bit_offset_ptr = 0;
return ast->getObjCInterfaceType(superclass_interface_decl).getAsOpaquePtr();
}
}
@@ -2921,13 +2936,13 @@ ClangASTContext::GetDirectBaseClassAtIndex (clang::ASTContext *ast,
return ClangASTContext::GetDirectBaseClassAtIndex (ast,
cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(),
idx,
- byte_offset_ptr);
+ bit_offset_ptr);
case clang::Type::Elaborated:
return ClangASTContext::GetDirectBaseClassAtIndex (ast,
cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(),
idx,
- byte_offset_ptr);
+ bit_offset_ptr);
default:
break;
@@ -2939,7 +2954,7 @@ clang_type_t
ClangASTContext::GetVirtualBaseClassAtIndex (clang::ASTContext *ast,
clang_type_t clang_type,
uint32_t idx,
- uint32_t *byte_offset_ptr)
+ uint32_t *bit_offset_ptr)
{
if (clang_type == NULL)
return 0;
@@ -2962,11 +2977,11 @@ ClangASTContext::GetVirtualBaseClassAtIndex (clang::ASTContext *ast,
{
if (curr_idx == idx)
{
- if (byte_offset_ptr)
+ if (bit_offset_ptr)
{
const ASTRecordLayout &record_layout = ast->getASTRecordLayout(cxx_record_decl);
const CXXRecordDecl *base_class_decl = cast<CXXRecordDecl>(base_class->getType()->getAs<RecordType>()->getDecl());
- *byte_offset_ptr = record_layout.getVBaseClassOffset(base_class_decl).getQuantity() * 8;
+ *bit_offset_ptr = record_layout.getVBaseClassOffset(base_class_decl).getQuantity() * 8;
}
return base_class->getType().getAsOpaquePtr();
@@ -2980,13 +2995,13 @@ ClangASTContext::GetVirtualBaseClassAtIndex (clang::ASTContext *ast,
return ClangASTContext::GetVirtualBaseClassAtIndex (ast,
cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(),
idx,
- byte_offset_ptr);
+ bit_offset_ptr);
case clang::Type::Elaborated:
return ClangASTContext::GetVirtualBaseClassAtIndex (ast,
cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(),
idx,
- byte_offset_ptr);
+ bit_offset_ptr);
default:
break;
@@ -2999,7 +3014,7 @@ ClangASTContext::GetFieldAtIndex (clang::ASTContext *ast,
clang_type_t clang_type,
uint32_t idx,
std::string& name,
- uint32_t *byte_offset_ptr)
+ uint32_t *bit_offset_ptr)
{
if (clang_type == NULL)
return 0;
@@ -3025,10 +3040,10 @@ ClangASTContext::GetFieldAtIndex (clang::ASTContext *ast,
// Figure out the type byte size (field_type_info.first) and
// alignment (field_type_info.second) from the AST context.
- if (byte_offset_ptr)
+ if (bit_offset_ptr)
{
const ASTRecordLayout &record_layout = ast->getASTRecordLayout(record_decl);
- *byte_offset_ptr = (record_layout.getFieldOffset (field_idx) + 7) / 8;
+ *bit_offset_ptr = record_layout.getFieldOffset (field_idx);
}
return field->getType().getAsOpaquePtr();
@@ -3064,10 +3079,10 @@ ClangASTContext::GetFieldAtIndex (clang::ASTContext *ast,
name.assign(ivar_decl->getNameAsString());
- if (byte_offset_ptr)
+ if (bit_offset_ptr)
{
const ASTRecordLayout &interface_layout = ast->getASTObjCInterfaceLayout(class_interface_decl);
- *byte_offset_ptr = (interface_layout.getFieldOffset (ivar_idx) + 7)/8;
+ *bit_offset_ptr = interface_layout.getFieldOffset (ivar_idx);
}
return ivar_qual_type.getAsOpaquePtr();
@@ -3085,14 +3100,14 @@ ClangASTContext::GetFieldAtIndex (clang::ASTContext *ast,
cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(),
idx,
name,
- byte_offset_ptr);
+ bit_offset_ptr);
case clang::Type::Elaborated:
return ClangASTContext::GetFieldAtIndex (ast,
cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(),
idx,
name,
- byte_offset_ptr);
+ bit_offset_ptr);
default:
break;
diff --git a/lldb/source/Symbol/ClangASTType.cpp b/lldb/source/Symbol/ClangASTType.cpp
index 04edef1484f..398884b799b 100644
--- a/lldb/source/Symbol/ClangASTType.cpp
+++ b/lldb/source/Symbol/ClangASTType.cpp
@@ -1272,46 +1272,64 @@ ClangASTType::DumpTypeDescription (clang::ASTContext *ast_context, clang_type_t
llvm::SmallVector<char, 1024> buf;
llvm::raw_svector_ostream llvm_ostrm (buf);
- const clang::TagType *tag_type = llvm::dyn_cast<clang::TagType>(qual_type.getTypePtr());
- if (tag_type)
- {
- clang::TagDecl *tag_decl = tag_type->getDecl();
- if (tag_decl)
- tag_decl->print(llvm_ostrm, 0);
- }
- else
+ const clang::Type::TypeClass type_class = qual_type->getTypeClass();
+ switch (type_class)
{
- const clang::Type::TypeClass type_class = qual_type->getTypeClass();
- switch (type_class)
+ case clang::Type::ObjCObject:
+ case clang::Type::ObjCInterface:
+ if (ClangASTContext::GetCompleteType (ast_context, clang_type))
{
- case clang::Type::ObjCObject:
- case clang::Type::ObjCInterface:
+ const clang::ObjCObjectType *objc_class_type = llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
+ assert (objc_class_type);
+ if (objc_class_type)
{
- const clang::ObjCObjectType *objc_class_type = llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
- assert (objc_class_type);
- if (objc_class_type)
- {
- clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
- if (class_interface_decl)
- class_interface_decl->print(llvm_ostrm, ast_context->getPrintingPolicy(), s->GetIndentLevel());
- }
+ clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
+ if (class_interface_decl)
+ class_interface_decl->print(llvm_ostrm, ast_context->getPrintingPolicy(), s->GetIndentLevel());
}
- break;
-
- case clang::Type::Typedef:
+ }
+ break;
+
+ case clang::Type::Typedef:
+ {
+ const clang::TypedefType *typedef_type = qual_type->getAs<clang::TypedefType>();
+ if (typedef_type)
{
- const clang::TypedefType *typedef_type = qual_type->getAs<clang::TypedefType>();
- if (typedef_type)
+ const clang::TypedefNameDecl *typedef_decl = typedef_type->getDecl();
+ std::string clang_typedef_name (typedef_decl->getQualifiedNameAsString());
+ if (!clang_typedef_name.empty())
{
- const clang::TypedefNameDecl *typedef_decl = typedef_type->getDecl();
- std::string clang_typedef_name (typedef_decl->getQualifiedNameAsString());
- if (!clang_typedef_name.empty())
- s->PutCString (clang_typedef_name.c_str());
+ s->PutCString ("typedef ");
+ s->PutCString (clang_typedef_name.c_str());
}
}
- break;
+ }
+ break;
- default:
+ case clang::Type::Record:
+ if (ClangASTContext::GetCompleteType (ast_context, clang_type))
+ {
+ const clang::RecordType *record_type = llvm::cast<clang::RecordType>(qual_type.getTypePtr());
+ const clang::RecordDecl *record_decl = record_type->getDecl();
+ const clang::CXXRecordDecl *cxx_record_decl = llvm::dyn_cast<clang::CXXRecordDecl>(record_decl);
+
+ if (cxx_record_decl)
+ cxx_record_decl->print(llvm_ostrm, ast_context->getPrintingPolicy(), s->GetIndentLevel());
+ else
+ record_decl->print(llvm_ostrm, ast_context->getPrintingPolicy(), s->GetIndentLevel());
+ }
+ break;
+
+ default:
+ {
+ const clang::TagType *tag_type = llvm::dyn_cast<clang::TagType>(qual_type.getTypePtr());
+ if (tag_type)
+ {
+ clang::TagDecl *tag_decl = tag_type->getDecl();
+ if (tag_decl)
+ tag_decl->print(llvm_ostrm, 0);
+ }
+ else
{
std::string clang_type_name(qual_type.getAsString());
if (!clang_type_name.empty())
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index d54d4c30559..abb7e738c49 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -777,3 +777,21 @@ TypeImpl::GetOpaqueQualType()
return m_clang_ast_type.GetOpaqueQualType();
}
+
+bool
+TypeImpl::GetDescription (lldb_private::Stream &strm,
+ lldb::DescriptionLevel description_level)
+{
+ if (m_clang_ast_type.IsValid())
+ {
+ ClangASTType::DumpTypeDescription (m_clang_ast_type.GetASTContext(),
+ m_clang_ast_type.GetOpaqueQualType(),
+ &strm);
+ }
+ else
+ {
+ strm.PutCString ("No value");
+ }
+ return true;
+}
+
OpenPOWER on IntegriCloud