[Lldb-commits] [lldb] r163432 - in /lldb/trunk: include/lldb/Target/StackFrameList.h source/Target/StackFrameList.cpp

Jim Ingham jingham at apple.com
Fri Sep 7 16:35:54 PDT 2012


Author: jingham
Date: Fri Sep  7 18:35:54 2012
New Revision: 163432

URL: http://llvm.org/viewvc/llvm-project?rev=163432&view=rev
Log:
Add SetCurrentInlinedDepth API.
In GetFramesUpTo, don't adjust the number of frames for the inlined depth if the number of frames in UINT32_MAX.

Modified:
    lldb/trunk/include/lldb/Target/StackFrameList.h
    lldb/trunk/source/Target/StackFrameList.cpp

Modified: lldb/trunk/include/lldb/Target/StackFrameList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrameList.h?rev=163432&r1=163431&r2=163432&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrameList.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrameList.h Fri Sep  7 18:35:54 2012
@@ -125,6 +125,9 @@
     uint32_t
     GetCurrentInlinedDepth ();
     
+    void
+    SetCurrentInlinedDepth (uint32_t new_depth);
+    
     //------------------------------------------------------------------
     // Classes that inherit from StackFrameList can see and modify these
     //------------------------------------------------------------------

Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=163432&r1=163431&r2=163432&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Fri Sep  7 18:35:54 2012
@@ -13,6 +13,7 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Core/Log.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Core/SourceManager.h"
 #include "lldb/Symbol/Block.h"
@@ -77,13 +78,16 @@
 uint32_t
 StackFrameList::GetCurrentInlinedDepth ()
 {
-    if (m_show_inlined_frames)
+    if (m_show_inlined_frames && m_current_inlined_pc != LLDB_INVALID_ADDRESS)
     {
         lldb::addr_t cur_pc = m_thread.GetRegisterContext()->GetPC();
         if (cur_pc != m_current_inlined_pc)
         {
             m_current_inlined_pc = LLDB_INVALID_ADDRESS;
             m_current_inlined_depth = UINT32_MAX;
+            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+            if (log && log->GetVerbose())
+                log->Printf ("GetCurrentInlinedDepth: invalidating current inlined depth.\n");
         }
         return m_current_inlined_depth;
     }
@@ -103,6 +107,9 @@
         {
             m_current_inlined_depth = UINT32_MAX;
             m_current_inlined_pc = LLDB_INVALID_ADDRESS;
+            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+            if (log && log->GetVerbose())
+                log->Printf ("ResetCurrentInlinedDepth: Invalidating current inlined depth.\n");
         }
         else
         {
@@ -169,6 +176,9 @@
                                     }
                                     m_current_inlined_pc = curr_pc;
                                     m_current_inlined_depth = num_inlined_functions + 1;
+                                    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+                                    if (log && log->GetVerbose())
+                                        log->Printf ("ResetCurrentInlinedDepth: setting inlined depth: %d 0x%llx.\n", m_current_inlined_depth, curr_pc);
                                     
                                 }
                                 break;
@@ -200,6 +210,16 @@
 }
 
 void
+StackFrameList::SetCurrentInlinedDepth (uint32_t new_depth)
+{
+    m_current_inlined_depth = new_depth;
+    if (new_depth == UINT32_MAX)
+        m_current_inlined_pc = LLDB_INVALID_ADDRESS;
+    else
+        m_current_inlined_pc = m_thread.GetRegisterContext()->GetPC();
+}
+
+void
 StackFrameList::GetFramesUpTo(uint32_t end_idx)
 {
     // We've already gotten more frames than asked for, or we've already finished unwinding, return.
@@ -215,10 +235,11 @@
 #endif
         // If we are hiding some frames from the outside world, we need to add those onto the total count of
         // frames to fetch.  However, we don't need ot do that if end_idx is 0 since in that case we always
-        // get the first concrete frame and all the inlined frames below it...
+        // get the first concrete frame and all the inlined frames below it...  And of course, if end_idx is
+        // UINT32_MAX that means get all, so just do that...
         
         uint32_t inlined_depth = 0;
-        if (end_idx > 0)
+        if (end_idx > 0 && end_idx != UINT32_MAX)
         {
             inlined_depth = GetCurrentInlinedDepth();
             if (inlined_depth != UINT32_MAX)
@@ -322,8 +343,9 @@
             StackFrameList *prev_frames = m_prev_frames_sp.get();
             StackFrameList *curr_frames = this;
             
-            curr_frames->m_current_inlined_depth = prev_frames->m_current_inlined_depth;
-            curr_frames->m_current_inlined_pc = prev_frames->m_current_inlined_pc;
+            //curr_frames->m_current_inlined_depth = prev_frames->m_current_inlined_depth;
+            //curr_frames->m_current_inlined_pc = prev_frames->m_current_inlined_pc;
+            //printf ("GetFramesUpTo: Copying current inlined depth: %d 0x%llx.\n", curr_frames->m_current_inlined_depth, curr_frames->m_current_inlined_pc);
 
 #if defined (DEBUG_STACK_FRAMES)
             s.PutCString("\nprev_frames:\n");





More information about the lldb-commits mailing list