Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / toolkit / library / libxul.so-gdb.py
blobd84aead1c312e5aa0d2fad7f6dda721dbdf4f050
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 """ GDB Python customization auto-loader for libxul """
7 import re
8 from os.path import abspath, dirname, exists
10 # Add the toplevel objdir to the gdb source search path.
12 # In development builds, $objdir/dist/bin/libxul.so is a symlink to
13 # $objdir/toolkit/library/build/libxul.so, and the latter path is what gdb uses
14 # to search for gdb scripts.
16 # For artifact builds, libxul.so will be a regular file in $objdir/dist/bin.
17 # Look both places.
19 libxul_dir = dirname(__file__)
20 objdir = None
21 for relpath in ("../../..", "../.."):
22 objdir = abspath(libxul_dir + "/" + relpath)
23 if exists(objdir + "/build/.gdbinit"):
24 break
25 else:
26 gdb.write("Warning: Gecko objdir not found\n")
28 if objdir is not None:
29 m = re.search(r"[\w ]+: (.*)", gdb.execute("show dir", False, True))
30 if m and objdir not in m.group(1).split(":"):
31 gdb.execute("set dir {}:{}".format(objdir, m.group(1)))
33 # When running from a random directory, the toplevel Gecko .gdbinit may
34 # not have been loaded. Load it now.
35 gdb.execute("source -s build/.gdbinit.loader")