Closed Bug 1642121 Opened 4 months ago Closed 3 months ago

gdb prettyprinters not loaded if running from wrong directory

Categories

(Firefox Build System :: Developer Environment Integration, defect, P3)

defect

Tracking

(firefox79 fixed)

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: sfink, Assigned: sfink)

References

(Blocks 1 open bug, Regressed 2 open bugs)

Details

Attachments

(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
    case.

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 libxul.so-gdb.py into the correct directory.
  3. Use either libxul.so-gdb.py or js-gdb.py 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 "libxul.so" 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 gdb_load_rust_pretty_printers.py 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 sfink@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/df0d6b993ad6
Remove directory dependence of GDB init files. r=nalexander
Pushed by sfink@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4d8ee4696e13
Remove directory dependence of GDB init files. r=nalexander
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
Regressions: 1646306
Regressions: 1652232
Depends on: 1655789

(re-landed)

Flags: needinfo?(sphink)
You need to log in before you can comment on or make changes to this bug.