From 50bed5e86f749103bc59d5ac1e78555596a4d571 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Wed, 22 Oct 2014 20:14:09 +0000 Subject: [PATCH] Fix a problem where summary strings could not use a synthetically generated value as part of themselves llvm-svn: 220414 --- lldb/source/Core/Debugger.cpp | 1 + .../data-formatter-synthval/TestDataFormatterSynthVal.py | 5 +++++ .../data-formatter/data-formatter-synthval/main.cpp | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index cfc7b2c..506afe2 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1802,6 +1802,7 @@ FormatPromptRecurse log->Printf("[Debugger::FormatPrompt] ALL RIGHT: unparsed portion = %s, why stopping = %d," " final_value_type %d", first_unparsed, reason_to_stop, final_value_type); + target = target->GetQualifiedRepresentationIfAvailable(target->GetDynamicValueType(), true).get(); } } else diff --git a/lldb/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py b/lldb/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py index 1fd0d8b..165a322 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py +++ b/lldb/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py @@ -90,6 +90,11 @@ class DataFormatterSynthValueTestCase(TestBase): # check that an aptly defined synthetic provider does not affect one-lining self.expect("expression struct S { myInt theInt{12}; }; S()", substrs = ['(theInt = 12)']) + + # check that we can use a synthetic value in a summary + self.runCmd("type summary add hasAnInt -s ${var.theInt}") + hi = self.frame().FindVariable("hi") + self.assertEqual(hi.GetSummary(), "42") if __name__ == '__main__': import atexit diff --git a/lldb/test/functionalities/data-formatter/data-formatter-synthval/main.cpp b/lldb/test/functionalities/data-formatter/data-formatter-synthval/main.cpp index fef128c..a77d438 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-synthval/main.cpp +++ b/lldb/test/functionalities/data-formatter/data-formatter-synthval/main.cpp @@ -5,11 +5,18 @@ class myInt { int val() { return theValue; } }; +class hasAnInt { + public: + myInt theInt; + hasAnInt() : theInt(42) {} +}; + myInt operator + (myInt x, myInt y) { return myInt(x.val() + y.val()); } int main() { myInt x{3}; myInt y{4}; myInt z {x+y}; + hasAnInt hi; return z.val(); // break here } -- 2.7.4