.gdbinit
author Cosmin Sabou <csabou@mozilla.com>
Sat, 03 Nov 2018 03:12:43 +0200
changeset 444308 63f135d2db22375b51cf0ded745279afe2188022
parent 433647 044a277c437902749f8c14c79bff77a9700fcf7c
permissions -rw-r--r--
Backed out 48 changesets (bug 1376873, bug 1502992) for causing windows 7 wpt crashes on several files. Backed out changeset b9db1780bb9c (bug 1502992) Backed out changeset f9f879bd247c (bug 1376873) Backed out changeset f029e9f3ceaf (bug 1376873) Backed out changeset 7317f657a9a7 (bug 1376873) Backed out changeset 4efbe4d0050c (bug 1376873) Backed out changeset 26e09a6dee05 (bug 1376873) Backed out changeset afbd3a8108de (bug 1376873) Backed out changeset 23b5fb1a2577 (bug 1376873) Backed out changeset 5d9c7a09616c (bug 1376873) Backed out changeset f15c4be0f19f (bug 1376873) Backed out changeset 3d11b041baf2 (bug 1376873) Backed out changeset 9674bbefc68e (bug 1376873) Backed out changeset 5a45d2c706d6 (bug 1376873) Backed out changeset 9b82f16618b9 (bug 1376873) Backed out changeset 0c3c2fc4646b (bug 1376873) Backed out changeset 381df4c6ae88 (bug 1376873) Backed out changeset acc06acb5342 (bug 1376873) Backed out changeset 60fdf3598932 (bug 1376873) Backed out changeset 176b82dccf4c (bug 1376873) Backed out changeset 58e47be76761 (bug 1376873) Backed out changeset d082eb8d80c6 (bug 1376873) Backed out changeset 622f78404b8a (bug 1376873) Backed out changeset 086c722131f9 (bug 1376873) Backed out changeset 79010785539c (bug 1376873) Backed out changeset 6b2919ed789b (bug 1376873) Backed out changeset da8d3eb163bd (bug 1376873) Backed out changeset 0fc8c65e163e (bug 1376873) Backed out changeset de3f5bd6846b (bug 1376873) Backed out changeset 2951112ade46 (bug 1376873) Backed out changeset 9fe47f8ea1b8 (bug 1376873) Backed out changeset b94935661622 (bug 1376873) Backed out changeset 6eca45c83131 (bug 1376873) Backed out changeset 909f472c2e40 (bug 1376873) Backed out changeset 19d9a30b300c (bug 1376873) Backed out changeset 6a52b92ff037 (bug 1376873) Backed out changeset 6a6771656fe5 (bug 1376873) Backed out changeset ffdbeba93fa6 (bug 1376873) Backed out changeset d12ad321047d (bug 1376873) Backed out changeset d1f7d44e05a4 (bug 1376873) Backed out changeset b59e1fca5c13 (bug 1376873) Backed out changeset 5d7a8864505d (bug 1376873) Backed out changeset e1ea09e84feb (bug 1376873) Backed out changeset bc92eac0522f (bug 1376873) Backed out changeset 1f86d23e4806 (bug 1376873) Backed out changeset d78c5c50b6b8 (bug 1376873) Backed out changeset 2e1af73cdd2e (bug 1376873) Backed out changeset dda3c784b0c0 (bug 1376873) Backed out changeset f40ca921b74b (bug 1376873)

# .gdbinit file for debugging Mozilla

# You may need to put an 'add-auto-load-safe-path' command in your
# $HOME/.gdbinit file to get GDB to trust this file. If your builds are
# generally in $HOME/moz, then you can say:
#
#  add-auto-load-safe-path ~/moz

# Don't stop for the SIG32/33/etc signals that Flash produces
handle SIG32 noprint nostop pass
handle SIG33 noprint nostop pass
handle SIGPIPE noprint nostop pass

# Don't stop for certain other signals where it's not useful,
# such as the SIG64 signals triggered by the Linux
# sandboxing code on older kernels.
handle SIG38 noprint nostop pass
handle SIG64 noprint nostop pass
handle SIGSYS noprint nostop pass

# Show the concrete types behind nsIFoo
set print object on

# run when using the auto-solib-add trick
def prun
        tbreak main
        run
	set auto-solib-add 0
        cont
end

# run -mail, when using the auto-solib-add trick
def pmail
        tbreak main
        run -mail
	set auto-solib-add 0
        cont
end

# Define a "pu" command to display PRUnichar * strings (100 chars max)
# Also allows an optional argument for how many chars to print as long as
# it's less than 100.
def pu
  set $uni = $arg0
  if $argc == 2
    set $limit = $arg1
    if $limit > 100
      set $limit = 100
    end
  else
    set $limit = 100
  end
  # scratch array with space for 100 chars plus null terminator.  Make
  # sure to not use ' ' as the char so this copy/pastes well.
  set $scratch = "____________________________________________________________________________________________________"
  set $i = 0
  set $scratch_idx = 0
  while (*$uni && $i++ < $limit)
    if (*$uni < 0x80)
      set $scratch[$scratch_idx++] = *(char*)$uni++
    else
      if ($scratch_idx > 0)
	set $scratch[$scratch_idx] = '\0'
	print $scratch
	set $scratch_idx = 0
      end
      print /x *(short*)$uni++
    end
  end
  if ($scratch_idx > 0)
    set $scratch[$scratch_idx] = '\0'
    print $scratch
  end
end

# Define a "ps" command to display subclasses of nsAC?String.  Note that
# this assumes strings as of Gecko 1.9 (well, and probably a few
# releases before that as well); going back far enough will get you
# to string classes that this function doesn't work for.
def ps
  set $str = $arg0
  if (sizeof(*$str.mData) == 1 && ($str.mFlags & 1) != 0)
    print $str.mData
  else
    pu $str.mData $str.mLength
  end
end

# Define a "pa" command to display the string value for an nsAtom
def pa
  set $atom = $arg0
  if (sizeof(*((&*$atom)->mString)) == 2)
    pu (&*$atom)->mString
  end
end

# define a "pxul" command to display the type of a XUL element from
# an nsXULElement* pointer.
def pxul
  set $p = $arg0
  print $p->mNodeInfo.mRawPtr->mInner.mName->mStaticAtom->mString
end

# define a "prefcnt" command to display the refcount of an XPCOM obj
def prefcnt
  set $p = $arg0
  print ((nsPurpleBufferEntry*)$p->mRefCnt.mTagged)->mRefCnt
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

##
## nsTArray
##
define ptarray
        if $argc == 0
                help ptarray
        else
                set $size = $arg0.mHdr->mLength
                set $capacity = $arg0.mHdr->mCapacity
                set $size_max = $size - 1
                set $elts = $arg0.Elements()
        end
        if $argc == 1
                set $i = 0
                while $i < $size
                        printf "elem[%u]: ", $i
                        p *($elts + $i)
                        set $i++
                end
        end
        if $argc == 2
                set $idx = $arg1
                if $idx < 0 || $idx > $size_max
                        printf "idx1, idx2 are not in acceptable range: [0..%u].\n", $size_max
                else
                        printf "elem[%u]: ", $idx
                        p *($elts + $idx)
                end
        end
        if $argc == 3
          set $start_idx = $arg1
          set $stop_idx = $arg2
          if $start_idx > $stop_idx
            set $tmp_idx = $start_idx
            set $start_idx = $stop_idx
            set $stop_idx = $tmp_idx
          end
          if $start_idx < 0 || $stop_idx < 0 || $start_idx > $size_max || $stop_idx > $size_max
            printf "idx1, idx2 are not in acceptable range: [0..%u].\n", $size_max
          else
            set $i = $start_idx
                while $i <= $stop_idx
                        printf "elem[%u]: ", $i
                        p *($elts + $i)
                        set $i++
                end
          end
        end
        if $argc > 0
                printf "nsTArray length = %u\n", $size
                printf "nsTArray capacity = %u\n", $capacity
                printf "Element "
                whatis *$elts
        end
end

document ptarray
        Prints nsTArray information.
        Syntax: ptarray   
        Note: idx, idx1 and idx2 must be in acceptable range [0...size()-1].
        Examples:
        ptarray a - Prints tarray content, size, capacity and T typedef
        ptarray a 0 - Prints element[idx] from tarray
        ptarray a 1 2 - Prints elements in range [idx1..idx2] from tarray
end

def js
  call DumpJSStack()
end

def ft
  call $arg0->DumpFrameTree()
end

def ftl
  call $arg0->DumpFrameTreeLimited()
end

source .gdbinit_python