samedi 18 janvier 2020

How to make Firefox startup faster in GDB

I have a large number of HTML files to debug. I wrote a python GDB script and call gdb ./path/to/firefox and open each of the HTML files within Firefox, then run the script to do what I want. The problem is this process is super slow. I am wondering is there a faster way to do this.

I noticed that everything else is fairly fast except the point after gdb outputs the following:

$ gdb ../firefox-63.0.3/objdir-ff-dbg/dist/bin/firefox
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ../firefox-63.0.3/objdir-ff-dbg/dist/bin/firefox...done.
(gdb) set args file:///home/ug16zy2/test.html 
(gdb) r
Starting program: /home/ug16zy2/firefox-63.0.3/objdir-ff-dbg/dist/bin/firefox file:///home/ug16zy2/test.html 
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Then I need to wait for a long time (around 20 seconds) until it outputs the next line:

Loading JavaScript value pretty-printers; see js/src/gdb/README.
If they cause trouble, type: disable pretty-printer .* SpiderMonkey
SpiderMonkey unwinder is disabled by default, to enable it type:
    enable unwinder .* SpiderMonkey

What is GDB doing and how can I avoid whichever is taking such a long time?

PS: I need to use GDB because I want to stop the process when a specific line in JS code is executed. Unfortunately the line is inside a callback registered with an event listener. The problem boils down to stopping Firefox when an event listener is triggered AND its callback function finishes execution. (If there is any other alternative that can achieve the same thing, pls let me know :) Many thanks!)

Aucun commentaire:

Enregistrer un commentaire