diff options
author | Enrico Granata <granata.enrico@gmail.com> | 2011-08-12 16:42:31 +0000 |
---|---|---|
committer | Enrico Granata <granata.enrico@gmail.com> | 2011-08-12 16:42:31 +0000 |
commit | 61a80ba6c3dc8dbc64bb25ae4036b52e42ada0a8 (patch) | |
tree | ae03f865ca6d143b38c161222a890311ea2cfa69 | |
parent | b4d3733fca1bdf87e79025fb299f3d459b2c4256 (diff) | |
download | bcm5719-llvm-61a80ba6c3dc8dbc64bb25ae4036b52e42ada0a8.tar.gz bcm5719-llvm-61a80ba6c3dc8dbc64bb25ae4036b52e42ada0a8.zip |
Giving a warning to the user the first time children are truncated by the new cap setting
llvm-svn: 137462
-rw-r--r-- | lldb/include/lldb/Interpreter/CommandInterpreter.h | 33 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectFrame.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 4 |
4 files changed, 53 insertions, 0 deletions
diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h index 7381f1efcef..c7f9643db01 100644 --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -39,6 +39,13 @@ public: 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 @@ public: 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 @@ private: 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 }; diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index d03d3bb18a0..a05663805b8 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -660,6 +660,14 @@ public: 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: diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 1da39a5f4cc..6bf136b00ef 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -717,6 +717,14 @@ public: 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(); } diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 6d157be9775..07adaed7d82 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -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 @@ ValueObject::DumpValueObject if (!flat_output) { if (print_dotdotdot) + { + valobj->GetUpdatePoint().GetTargetSP()->GetDebugger().GetCommandInterpreter().ChildrenTruncated(); s.Indent("...\n"); + } s.IndentLess(); s.Indent("}\n"); } |