Skip to content

Instantly share code, notes, and snippets.

@ChunMinChang
Last active December 19, 2022 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChunMinChang/464d8e338fb6c55f081286ea0aa503f6 to your computer and use it in GitHub Desktop.
Save ChunMinChang/464d8e338fb6c55f081286ea0aa503f6 to your computer and use it in GitHub Desktop.
Debugging gecko with gdb

Debugging gecko with gdb

Setup gecko-dev/.gdbinit

Suppose the gecko folder is /home/cm/Work/gecko-dev

Add the following lins to your /home/cm/Work/gecko-dev/.gdbinit

add-auto-load-safe-path /home/cm/Work/gecko-dev/build/.gdbinit
add-auto-load-safe-path /home/cm/Work/gecko-dev/toolkit/library/libxul.so-gdb.py

The above settings will ignore the SIGSYS comming constantly. See more here

Setup $HOME/.gdbinit

Add the following lins to your $HOME/.gdbinit

set auto-load local-gdbinit on

add-auto-load-safe-path /home/cm/Work/gecko-dev/.gdbinit

Write your gdb scripts if you need

If you need to do something constantly (e.g., add breakpoints), it's best to make it as a script so it could be performed automatically

For example, you can create a gecko-dev/gdb.script with the following commands:

show auto-load

break dom/media/ChannelMediaResource.cpp:519
break dom/media/MediaCache.cpp:2696

info break

Debugging with GDB

Now, everytime when gdb is run, /home/cm/Work/gecko-dev/.gdbinit would be loaded, and then /home/cm/Work/Work/gecko-dev/build/.gdbinit and its friends would be loaded.

If you have a gdb script named gdb.script and you want to attach to process 8529, you can do

gdb --pid=8529 --command=gdb.script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment