[Lldb-commits] [lldb] r227120 - Add an overload of SetValueFromCString() to ValueObjectSynthetic that is just a passthrough to the parent object
Enrico Granata
egranata at apple.com
Mon Jan 26 11:33:52 PST 2015
Author: enrico
Date: Mon Jan 26 13:33:52 2015
New Revision: 227120
URL: http://llvm.org/viewvc/llvm-project?rev=227120&view=rev
Log:
Add an overload of SetValueFromCString() to ValueObjectSynthetic that is just a passthrough to the parent object
Without this overload, attempts to edit the value of a variable with synthetic children enabled would change the value inside the synthetic ValueObject, but not propagate the changes to the underlying storage, hence resulting in no write for any meaningful purpose
Comes with a test case, and fixes rdar://19586311
Added:
lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/
lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/Makefile
lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py
lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/main.m
Modified:
lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
Modified: lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h?rev=227120&r1=227119&r2=227120&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h Mon Jan 26 13:33:52 2015
@@ -140,6 +140,9 @@ public:
return (UpdateValueIfNeeded(), m_provides_value == eLazyBoolYes);
}
+ virtual bool
+ SetValueFromCString (const char *value_str, Error& error);
+
protected:
virtual bool
UpdateValue ();
Modified: lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp?rev=227120&r1=227119&r2=227120&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp Mon Jan 26 13:33:52 2015
@@ -298,3 +298,9 @@ ValueObjectSynthetic::CanProvideValue ()
return true;
return m_parent->CanProvideValue();
}
+
+bool
+ValueObjectSynthetic::SetValueFromCString (const char *value_str, Error& error)
+{
+ return m_parent->SetValueFromCString(value_str, error);
+}
Added: lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/Makefile?rev=227120&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/Makefile (added)
+++ lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/Makefile Mon Jan 26 13:33:52 2015
@@ -0,0 +1,4 @@
+LEVEL = ../../../make
+OBJC_SOURCES := main.m
+include $(LEVEL)/Makefile.rules
+LDFLAGS += -framework Foundation
Added: lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py?rev=227120&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py (added)
+++ lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py Mon Jan 26 13:33:52 2015
@@ -0,0 +1,3 @@
+import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())
Added: lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/main.m?rev=227120&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/main.m (added)
+++ lldb/trunk/test/functionalities/data-formatter/setvaluefromcstring/main.m Mon Jan 26 13:33:52 2015
@@ -0,0 +1,19 @@
+//===-- main.m ---------------------------------------------------*- ObjC -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#import <Foundation/Foundation.h>
+
+int main() {
+ NSDictionary* dic = @{@1 : @2};
+ NSLog(@"hello world"); //% dic = self.frame().FindVariable("dic")
+ //% dic.SetPreferSyntheticValue(True)
+ //% dic.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
+ //% dic.SetValueFromCString("12")
+ return 0; //% dic = self.frame().FindVariable("dic")
+ //% self.assertTrue(dic.GetValueAsUnsigned() == 0xC, "failed to read what I wrote")
+}
More information about the lldb-commits
mailing list