summaryrefslogtreecommitdiff
path: root/examples/summaries/cocoa/NSDate.py
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2012-03-13 00:25:59 +0000
committerEnrico Granata <egranata@apple.com>2012-03-13 00:25:59 +0000
commit7b9aacf4a454465af905e505f74245173714b23b (patch)
tree9803277d8d5dd6504ec6be1d5ca2267bf2b44b62 /examples/summaries/cocoa/NSDate.py
parent66205ce5381ab6db1f9bff83c483a4dc5854afc7 (diff)
Changed several of the Cocoa formatters to match the output style that Xcode uses internally to provide summaries
This has been done for those summaries where the difference is only cosmetic (e.g. naming things as items instead of values, ...) The LLDB output style has been preserved when it provides more information (e.g. telling the type as well as the value of an NSNumber) Test cases have been updated to reflect the updated output style where necessary git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152592 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples/summaries/cocoa/NSDate.py')
-rw-r--r--examples/summaries/cocoa/NSDate.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/examples/summaries/cocoa/NSDate.py b/examples/summaries/cocoa/NSDate.py
index 3f0273fe1..b3c303946 100644
--- a/examples/summaries/cocoa/NSDate.py
+++ b/examples/summaries/cocoa/NSDate.py
@@ -31,6 +31,13 @@ def osx_to_python_time(osx):
else:
return osx - osx_epoch
+# represent a struct_time as a string in the format used by Xcode
+def xcode_format_time(X):
+ return time.strftime('%Y-%m-%d %H:%M:%S %Z',X)
+
+# represent a count-since-epoch as a string in the format used by Xcode
+def xcode_format_count(X):
+ return xcode_format_time(time.localtime(X))
# despite the similary to synthetic children providers, these classes are not
# trying to provide anything but the summary for NSDate, so they need not
@@ -56,7 +63,7 @@ class NSTaggedDate_SummaryProvider:
# while all Python knows about is the "epoch", which is a platform-dependent
# year (1970 of *nix) whose Jan 1 at midnight is taken as reference
value_double = struct.unpack('d', struct.pack('Q', self.data))[0]
- return time.ctime(osx_to_python_time(value_double))
+ return xcode_format_count(osx_to_python_time(value_double))
class NSUntaggedDate_SummaryProvider:
@@ -81,7 +88,7 @@ class NSUntaggedDate_SummaryProvider:
self.offset(),
self.sys_params.types_cache.double)
value_double = struct.unpack('d', struct.pack('Q', value.GetValueAsUnsigned(0)))[0]
- return time.ctime(osx_to_python_time(value_double))
+ return xcode_format_count(osx_to_python_time(value_double))
class NSCalendarDate_SummaryProvider:
def adjust_for_architecture(self):
@@ -105,7 +112,7 @@ class NSCalendarDate_SummaryProvider:
self.offset(),
self.sys_params.types_cache.double)
value_double = struct.unpack('d', struct.pack('Q', value.GetValueAsUnsigned(0)))[0]
- return time.ctime(osx_to_python_time(value_double))
+ return xcode_format_count(osx_to_python_time(value_double))
class NSTimeZoneClass_SummaryProvider:
def adjust_for_architecture(self):
@@ -215,7 +222,7 @@ def NSTimeZone_SummaryProvider (valobj,dict):
def CFAbsoluteTime_SummaryProvider (valobj,dict):
try:
value_double = struct.unpack('d', struct.pack('Q', valobj.GetValueAsUnsigned(0)))[0]
- return time.ctime(osx_to_python_time(value_double))
+ return xcode_format_count(osx_to_python_time(value_double))
except:
return 'unable to provide a summary'