Bug 959452 - Add lldb summaries for nsACString and nsAString. r=ehsan
authorCameron McCormack <cam@mcc.id.au>
Wed, 15 Jan 2014 11:29:36 +1100
changeset 163413 cd6c3a4beacd3bcd8c818caa4cd0f9c2d93cf282
parent 163412 bb7af8904cac445e8d044d2e5b49748c64ec24a9
child 163414 def1c895cd80fec97b09d8f07256e8a931012617
push id25996
push useremorley@mozilla.com
push dateWed, 15 Jan 2014 15:54:39 +0000
treeherdermozilla-central@dd2cf81c56b7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs959452
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 959452 - Add lldb summaries for nsACString and nsAString. r=ehsan
python/lldbutils/lldbutils/__init__.py
python/lldbutils/lldbutils/general.py
--- a/python/lldbutils/lldbutils/__init__.py
+++ b/python/lldbutils/lldbutils/__init__.py
@@ -1,11 +1,11 @@
 import lldb
 
-__all__ = ['content', 'layout', 'utils']
+__all__ = ['content', 'general', 'layout', 'utils']
 
 def init():
     for name in __all__:
         init = None
         try:
             init = __import__('lldbutils.' + name, globals(), locals(), ['init']).init
         except AttributeError:
             pass
new file mode 100644
--- /dev/null
+++ b/python/lldbutils/lldbutils/general.py
@@ -0,0 +1,11 @@
+import lldb
+from lldbutils import utils
+
+def summarize_string(valobj, internal_dict):
+    data = valobj.GetChildMemberWithName("mData")
+    length = valobj.GetChildMemberWithName("mLength").GetValueAsUnsigned(0)
+    return utils.format_string(data, length)
+
+def init(debugger):
+    debugger.HandleCommand("type summary add nsAString_internal -F lldbutils.general.summarize_string")
+    debugger.HandleCommand("type summary add nsACString_internal -F lldbutils.general.summarize_string")