Closed Bug 1642121 Opened 3 years ago Closed 3 years ago

gdb prettyprinters not loaded if running from wrong directory


(Developer Infrastructure :: Developer Environment Integration, defect, P3)


(firefox79 fixed)

Tracking Status
firefox79 --- fixed


(Reporter: sfink, Assigned: sfink)


(Blocks 1 open bug)



(1 file)

I started on this because I wanted JS pretty-printers in Pernosco. It scope-crept.

I wrote this patch to address two problems:

  1. if I do mach run from a directory other than $topsrcdir, $objdir, or
    $objdir/dist/bin, then .gdbinit will not be loaded.
  2. Debugging the firefox binary will never load the JS prettyprinters in any

I believe this patch fixes other problems as well, such as .gdbinit_python not being found, and the gdbpp pretty-printers not getting loaded in various situations.

The main changes of this patch are:

  1. Move .gdbinit into build/ (and $objdir/build/) to delay it from getting
    loaded until the search path is configured.
  2. Move into the correct directory.
  3. Use either or to configure the correct
    search path then load .gdbinit, and have .gdbinit load all of the
    pretty-printers (Gecko and JS).
  4. Use a single preprocessed file to configure the source directory. Use
    relative paths within the objdir for everything else.

Note that this still hardcodes the name "" rather than using the platform-specific name. I figured this was fine because gdb is really only functional on Linux anyway. This limitation is pre-existing.

(removed redundant comment)

Note that there is a Rust debugging script that is stored in the .debug_gdb_scripts section that will still not be found after this patch. I didn't try to tackle that. (That script looks like it ships with rustc, but nothing adds that directory to the search path. Maybe it does with a Rust main binary?)

Component: General → Developer Environment Integration
Blocks: 1645060
Pushed by
Remove directory dependence of GDB init files. r=nalexander
Pushed by
Remove directory dependence of GDB init files. r=nalexander
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
Regressions: 1646306
Regressions: 1652232
Depends on: 1655789


Flags: needinfo?(sphink)
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.