[Lldb-commits] [lldb] r137462 - in /lldb/trunk: include/lldb/Interpreter/CommandInterpreter.h source/Commands/CommandObjectFrame.cpp source/Commands/CommandObjectTarget.cpp source/Core/ValueObject.cpp

Enrico Granata granata.enrico at gmail.com
Fri Aug 12 09:42:31 PDT 2011


Author: enrico
Date: Fri Aug 12 11:42:31 2011
New Revision: 137462

URL: http://llvm.org/viewvc/llvm-project?rev=137462&view=rev
Log:
Giving a warning to the user the first time children are truncated by the new cap setting

Modified:
    lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
    lldb/trunk/source/Commands/CommandObjectFrame.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Core/ValueObject.cpp

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=137462&r1=137461&r2=137462&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Fri Aug 12 11:42:31 2011
@@ -39,6 +39,13 @@
         eBroadcastBitAsynchronousOutputData = (1 << 3),
         eBroadcastBitAsynchronousErrorData  = (1 << 4)
     };
+    
+    enum ChildrenTruncatedWarningStatus // tristate boolean to manage children truncation warning
+    {
+        eNoTruncation = 0, // never truncated
+        eUnwarnedTruncation = 1, // truncated but did not notify
+        eWarnedTruncation = 2 // truncated and notified
+    };
 
     void
     SourceInitFile (bool in_cwd, 
@@ -385,6 +392,31 @@
     
     void
     SetBatchCommandMode (bool value) { m_batch_command_mode = value; }
+    
+    void
+    ChildrenTruncated()
+    {
+        if (m_truncation_warning == eNoTruncation)
+            m_truncation_warning = eUnwarnedTruncation;
+    }
+    
+    bool
+    TruncationWarningNecessary()
+    {
+        return (m_truncation_warning == eUnwarnedTruncation);
+    }
+    
+    void
+    TruncationWarningGiven()
+    {
+        m_truncation_warning = eWarnedTruncation;
+    }
+    
+    const char *
+    TruncationWarningText()
+    {
+        return "*** Some of your variables have more members than the debugger will show by default. To show all of them, you can either use the --show-all-children option to %s or raise the limit by changing the target.max-children-count setting.\n";
+    }
 
 protected:
     friend class Debugger;
@@ -411,6 +443,7 @@
     char m_comment_char;
     char m_repeat_char;
     bool m_batch_command_mode;
+    ChildrenTruncatedWarningStatus m_truncation_warning;    // Whether we truncated children and whether the user has been told
 };
 
 

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=137462&r1=137461&r2=137462&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Fri Aug 12 11:42:31 2011
@@ -660,6 +660,14 @@
                 result.SetStatus (eReturnStatusSuccessFinishResult);
             }
         }
+        
+        if (m_interpreter.TruncationWarningNecessary())
+        {
+            result.GetOutputStream().Printf(m_interpreter.TruncationWarningText(),
+                                            m_cmd_name.c_str());
+            m_interpreter.TruncationWarningGiven();
+        }
+        
         return result.Succeeded();
     }
 protected:

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=137462&r1=137461&r2=137462&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Fri Aug 12 11:42:31 2011
@@ -717,6 +717,14 @@
             result.SetStatus (eReturnStatusFailed);
             return false;
         }
+        
+        if (m_interpreter.TruncationWarningNecessary())
+        {
+            result.GetOutputStream().Printf(m_interpreter.TruncationWarningText(),
+                                            m_cmd_name.c_str());
+            m_interpreter.TruncationWarningGiven();
+        }
+        
         return result.Succeeded();
     }
     

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=137462&r1=137461&r2=137462&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Fri Aug 12 11:42:31 2011
@@ -31,6 +31,7 @@
 
 #include "lldb/Host/Endian.h"
 
+#include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/ScriptInterpreterPython.h"
 
 #include "lldb/Symbol/ClangASTType.h"
@@ -2915,7 +2916,10 @@
                         if (!flat_output)
                         {
                             if (print_dotdotdot)
+                            {
+                                valobj->GetUpdatePoint().GetTargetSP()->GetDebugger().GetCommandInterpreter().ChildrenTruncated();
                                 s.Indent("...\n");
+                            }
                             s.IndentLess();
                             s.Indent("}\n");
                         }





More information about the lldb-commits mailing list