[Lldb-commits] [lldb] r160179 - in /lldb/trunk: examples/summaries/cocoa/NSNumber.py test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py test/functionalities/data-formatter/data-formatter-objc/main.m
Enrico Granata
egranata at apple.com
Fri Jul 13 11:53:15 PDT 2012
Author: enrico
Date: Fri Jul 13 13:53:14 2012
New Revision: 160179
URL: http://llvm.org/viewvc/llvm-project?rev=160179&view=rev
Log:
<rdar://problem/11753405> Making sure we deal correctly with signed NSNumber values
Modified:
lldb/trunk/examples/summaries/cocoa/NSNumber.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m
Modified: lldb/trunk/examples/summaries/cocoa/NSNumber.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/NSNumber.py?rev=160179&r1=160178&r2=160179&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/NSNumber.py (original)
+++ lldb/trunk/examples/summaries/cocoa/NSNumber.py Fri Jul 13 13:53:14 2012
@@ -45,13 +45,13 @@
# unfortunately, the original type information appears to be lost
# so we try to at least recover the proper magnitude of the data
if self.info_bits == 0:
- return '(char)' + str(self.data % 256)
+ return '(char)' + str(ord(ctypes.c_char(chr(self.data % 256)).value))
if self.info_bits == 4:
- return '(short)' + str(self.data % (256*256))
+ return '(short)' + str(ctypes.c_short(self.data % (256*256)).value)
if self.info_bits == 8:
- return '(int)' + str(self.data % (256*256*256*256))
+ return '(int)' + str(ctypes.c_int(self.data % (256*256*256*256)).value)
if self.info_bits == 12:
- return '(long)' + str(self.data)
+ return '(long)' + str(ctypes.c_long(self.data).value)
else:
return 'absurd value:(info=' + str(self.info_bits) + ", value = " + str(self.data) + ')'
@@ -106,13 +106,13 @@
data_offset,
self.sys_params.types_cache.char)
statistics.metric_hit('code_notrun',self.valobj)
- return '(char)' + str(data_vo.GetValueAsUnsigned(0))
+ return '(char)' + str(ord(ctypes.c_char(chr(data_vo.GetValueAsUnsigned(0))).value))
elif data_type == 0B0010:
data_vo = self.valobj.CreateChildAtOffset("data",
data_offset,
self.sys_params.types_cache.short)
statistics.metric_hit('code_notrun',self.valobj)
- return '(short)' + str(data_vo.GetValueAsUnsigned(0) % (256*256))
+ return '(short)' + str(ctypes.c_short(data_vo.GetValueAsUnsigned(0) % (256*256)).value)
# IF tagged pointers are possible on 32bit+v2 runtime
# (of which the only existing instance should be iOS)
# then values of this type might be tagged
@@ -121,7 +121,7 @@
data_offset,
self.sys_params.types_cache.int)
statistics.metric_hit('code_notrun',self.valobj)
- return '(int)' + str(data_vo.GetValueAsUnsigned(0) % (256*256*256*256))
+ return '(int)' + str(ctypes.c_int(data_vo.GetValueAsUnsigned(0)% (256*256*256*256)).value)
# apparently, on is_64_bit architectures, these are the only values that will ever
# be represented by a non tagged pointers
elif data_type == 0B10001:
@@ -130,7 +130,7 @@
data_offset,
self.sys_params.types_cache.longlong)
statistics.metric_hit('code_notrun',self.valobj)
- return '(long)' + str(data_vo.GetValueAsUnsigned(0))
+ return '(long)' + str(ctypes.c_long(data_vo.GetValueAsUnsigned(0)).value)
elif data_type == 0B0100:
if self.sys_params.is_64_bit:
data_offset = data_offset + self.sys_params.pointer_size
@@ -138,7 +138,7 @@
data_offset,
self.sys_params.types_cache.longlong)
statistics.metric_hit('code_notrun',self.valobj)
- return '(long)' + str(data_vo.GetValueAsUnsigned(0))
+ return '(long)' + str(ctypes.c_long(data_vo.GetValueAsUnsigned(0)).value)
elif data_type == 0B0101:
data_vo = self.valobj.CreateChildAtOffset("data",
data_offset,
@@ -216,7 +216,9 @@
return provider.message()
try:
summary = provider.value();
- except:
+ except Exception as foo:
+ print foo
+# except:
summary = None
logger >> "got summary " + str(summary)
if summary == None:
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=160179&r1=160178&r2=160179&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Fri Jul 13 13:53:14 2012
@@ -227,14 +227,21 @@
substrs = ['(NSNumber *) num1 = ',' (int)5',
'(NSNumber *) num2 = ',' (float)3.1',
'(NSNumber *) num3 = ',' (double)3.14',
- '(NSNumber *) num4 = ',' (long)18446744073709551614',
+ '(NSNumber *) num4 = ',' (long)-2',
'(NSNumber *) num5 = ',' (char)65',
'(NSNumber *) num6 = ',' (long)255',
'(NSNumber *) num7 = ','2000000',
'(NSNumber *) num8_Y = ',' @"1"',
'(NSNumber *) num8_N = ',' @"0"',
- '(NSNumber *) num9 = ',' (short)33920'])
+ '(NSNumber *) num9 = ',' (short)-31616'])
+ self.expect('frame variable num_at1 num_at2 num_at3 num_at4',
+ substrs = ['(NSNumber *) num_at1 = ',' (int)12',
+ '(NSNumber *) num_at2 = ',' (int)-12',
+ '(NSNumber *) num_at3 = ',' (double)12.5',
+ '(NSNumber *) num_at4 = ',' (double)-12.5'])
+
+
self.expect('frame variable str0 str1 str2 str3 str4 str5 str6 str8 str9 str10 str11 label1 label2 processName str12',
substrs = ['(NSString *) str1 = ',' @"A rather short ASCII NSString object is here"',
'(NSString *) str0 = ',' @"255"',
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m?rev=160179&r1=160178&r2=160179&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m Fri Jul 13 13:53:14 2012
@@ -153,6 +153,10 @@
NSNumber* num8_Y = [NSNumber numberWithBool:YES];
NSNumber* num8_N = [NSNumber numberWithBool:NO];
NSNumber* num9 = [NSNumber numberWithShort:0x1E8480];
+ NSNumber* num_at1 = @12;
+ NSNumber* num_at2 = @-12;
+ NSNumber* num_at3 = @12.5;
+ NSNumber* num_at4 = @-12.5;
NSString *str0 = [num6 stringValue];
More information about the lldb-commits
mailing list