aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-09-07 04:20:48 +0000
committerGreg Clayton <gclayton@apple.com>2010-09-07 04:20:48 +0000
commit95897c6a3a7e7b9a8ee085948e019df14edb6be6 (patch)
tree7a1fcf9577ef3aff52d5e73841044a506c5f3853 /lldb/source/API
parent71972d45dc31f59bc79af53489a873a8f721a539 (diff)
downloadllvm-95897c6a3a7e7b9a8ee085948e019df14edb6be6.tar.gz
llvm-95897c6a3a7e7b9a8ee085948e019df14edb6be6.tar.bz2
llvm-95897c6a3a7e7b9a8ee085948e019df14edb6be6.zip
Added more API to lldb::SBBlock to allow getting the block
parent, sibling and first child block, and access to the inline function information. Added an accessor the StackFrame: Block * lldb_private::StackFrame::GetFrameBlock(); LLDB represents inline functions as lexical blocks that have inlined function information in them. The function above allows us to easily get the top most lexical block that defines a stack frame. When there are no inline functions in function, the block returned ends up being the top most block for the function. When the PC is in an inlined funciton for a frame, this will return the first parent block that has inlined function information. The other accessor: StackFrame::GetBlock() will return the deepest block that matches the frame's PC value. Since most debuggers want to display all variables in the current frame, the Block returned by StackFrame::GetFrameBlock can be used to retrieve all variables for the current frame. Fixed the lldb_private::Block::DumpStopContext(...) to properly display inline frames a block should display all of its inlined functions. Prior to this fix, one of the call sites was being skipped. This is a separate code path from the current default where inlined functions get their own frames. Fixed an issue where a block would always grab variables for any child inline function blocks. llvm-svn: 113195
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBBlock.cpp87
-rw-r--r--lldb/source/API/SBFrame.cpp7
2 files changed, 94 insertions, 0 deletions
diff --git a/lldb/source/API/SBBlock.cpp b/lldb/source/API/SBBlock.cpp
index e7485cc1d4e2..961e8d84663d 100644
--- a/lldb/source/API/SBBlock.cpp
+++ b/lldb/source/API/SBBlock.cpp
@@ -8,9 +8,12 @@
//===----------------------------------------------------------------------===//
#include "lldb/API/SBBlock.h"
+#include "lldb/API/SBFileSpec.h"
#include "lldb/Symbol/Block.h"
+#include "lldb/Symbol/Function.h"
using namespace lldb;
+using namespace lldb_private;
SBBlock::SBBlock () :
@@ -34,6 +37,63 @@ SBBlock::IsValid () const
return m_opaque_ptr != NULL;
}
+bool
+SBBlock::IsInlined () const
+{
+ if (m_opaque_ptr)
+ return m_opaque_ptr->GetInlinedFunctionInfo () != NULL;
+ return false;
+}
+
+const char *
+SBBlock::GetInlinedName () const
+{
+ if (m_opaque_ptr)
+ {
+ const InlineFunctionInfo* inlined_info = m_opaque_ptr->GetInlinedFunctionInfo ();
+ if (inlined_info)
+ return inlined_info->GetName().AsCString (NULL);
+ }
+ return NULL;
+}
+
+SBFileSpec
+SBBlock::GetInlinedCallSiteFile () const
+{
+ SBFileSpec sb_file;
+ if (m_opaque_ptr)
+ {
+ const InlineFunctionInfo* inlined_info = m_opaque_ptr->GetInlinedFunctionInfo ();
+ if (inlined_info)
+ sb_file.SetFileSpec (inlined_info->GetCallSite().GetFile());
+ }
+ return sb_file;
+}
+
+uint32_t
+SBBlock::GetInlinedCallSiteLine () const
+{
+ if (m_opaque_ptr)
+ {
+ const InlineFunctionInfo* inlined_info = m_opaque_ptr->GetInlinedFunctionInfo ();
+ if (inlined_info)
+ return inlined_info->GetCallSite().GetLine();
+ }
+ return 0;
+}
+
+uint32_t
+SBBlock::GetInlinedCallSiteColumn () const
+{
+ if (m_opaque_ptr)
+ {
+ const InlineFunctionInfo* inlined_info = m_opaque_ptr->GetInlinedFunctionInfo ();
+ if (inlined_info)
+ return inlined_info->GetCallSite().GetColumn();
+ }
+ return 0;
+}
+
void
SBBlock::AppendVariables (bool can_create, bool get_parent_variables, lldb_private::VariableList *var_list)
{
@@ -44,5 +104,32 @@ SBBlock::AppendVariables (bool can_create, bool get_parent_variables, lldb_priva
}
}
+SBBlock
+SBBlock::GetParent ()
+{
+ SBBlock sb_block;
+ if (m_opaque_ptr)
+ sb_block.m_opaque_ptr = m_opaque_ptr->GetParent();
+ return sb_block;
+}
+
+SBBlock
+SBBlock::GetSibling ()
+{
+ SBBlock sb_block;
+ if (m_opaque_ptr)
+ sb_block.m_opaque_ptr = m_opaque_ptr->GetSibling();
+ return sb_block;
+}
+
+SBBlock
+SBBlock::GetFirstChild ()
+{
+ SBBlock sb_block;
+ if (m_opaque_ptr)
+ sb_block.m_opaque_ptr = m_opaque_ptr->GetFirstChild();
+ return sb_block;
+}
+
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index ce294cafa7b4..65846e57f49c 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -105,6 +105,13 @@ SBFrame::GetBlock () const
return sb_block;
}
+SBBlock
+SBFrame::GetFrameBlock () const
+{
+ SBBlock sb_block(m_opaque_sp->GetFrameBlock ());
+ return sb_block;
+}
+
SBLineEntry
SBFrame::GetLineEntry () const
{