Bug 1283768 - Add a gdb helper to dereference smart pointers. r?glandium draft
authorWei-Cheng Pan <wpan@mozilla.com>
Fri, 01 Jul 2016 15:32:00 +0800
changeset 383109 f9088649498706b7f1580709b65d4343b0b289be
parent 382798 82e1f1b9c0559f38a8460e2f2f3044de4c7712d6
child 524396 eda845eaee5e8c0e57366004b5d8153b2de1a7f4
push id21937
push userbmo:wpan@mozilla.com
push dateFri, 01 Jul 2016 08:12:01 +0000
reviewersglandium
bugs1283768
milestone50.0a1
Bug 1283768 - Add a gdb helper to dereference smart pointers. r?glandium MozReview-Commit-ID: KG7z6N5X1Mp
.gdbinit
--- a/.gdbinit
+++ b/.gdbinit
@@ -101,16 +101,35 @@ def prefcnt
 end
 
 # define a "ptag" command to display the tag name of a content node
 def ptag
   set $p = $arg0
   pa $p->mNodeInfo.mRawPtr->mInner.mName
 end
 
+# define a "psp" command to dereference a smart pointer
+def psp
+  set $p = $arg0
+  if $argc == 1
+    print *($p).mRawPtr
+  end
+  if $argc == 2
+    print ($p).mRawPtr->$arg1
+  end
+end
+
+document psp
+  Dereference smart pointers.
+  Syntax: psp
+  Examples:
+  psp a - Prints the dereferenced raw pointer
+  psp a mData - Prints a->mData
+end
+
 ##
 ## nsTArray
 ##
 define ptarray
         if $argc == 0
                 help ptarray
         else
                 set $size = $arg0.mHdr->mLength