NEW 141153
[GDB] Couldn't use gdb tool well for WebKit GTK
https://bugs.webkit.org/show_bug.cgi?id=141153
Summary [GDB] Couldn't use gdb tool well for WebKit GTK
Park HyukWoo
Reported 2015-02-02 04:16:16 PST
I built WebKit Gtk(revision 174059) on Ubuntu 14.04 with follow commands $ Tools/Scripts/build-webkit --gtk --debug and finally got MiniBrowser file in WebKitBuild/Debug/bin folder. but when I debug MiniBrowser with gdb tool, I couldn't set breakpoints for it. for example, I ran the following simple html file == test.html == <html> <head> <script> window.onload = function() { var now = new Date(); var a = 4; var c = Math.sqrt(4); alert("wow"); } </script> </head> <body> </body> </html> and set some breakpoints in WebCore and JavaScriptCore module but when I ran MiniBrowser in gdb, it finished execution(html load) without any break even if some breakpoints were set. I ran MiniBrowser in gdb with follow commands $ Tools/jhbuild/jhbuild-wrapper --gtk run gdb --args WebKitBuild/Debug/bin/MiniBrowser $ b JSC::evaluate $ b WebCore::Document::dispatchWindowLoadEvent did i do something wrong? (maybe multi-thread issue?) what should i do to debug WebCore/JavaScriptCore module in MiniBrowser? I'm debugging MiniBrowser to know the loading sequence of html file in WebKit Gtk.
Attachments
Park HyukWoo
Comment 1 2015-02-02 20:44:31 PST
[SOLVED] I made a mistake for debugging WebProcess. I wrote the debugging tips for others. when you want to debug Web Process, you should use gdb in remote terminal and attach to 'WebKitWebProcess' process. because Web Process is executed in WebKitWebProcess not in MiniBrowser process. So, just connect to WebKitWebProcess in gdb by following command $ gdb -p <pid of WebKitWebProcess> However that doesn't work in all cases, because the web process might already have crashed when you are trying to connect to it. You can use the WEB_PROCESS_CMD_PREFIX environment variable for that purpose. If that variable is defined the web process will be run using its value as a prefix. Example: WEB_PROCESS_CMD_PREFIX='/usr/bin/gdbserver localhost:8080' WebKitBuild/Debug/bin/MiniBrowser and in a different terminal: $ libtool --mode=execute gdb WebKitBuild/Debug/bin/WebKitWebProcess (gdb) target remote localhost:8080
Note You need to log in before you can comment on or make changes to this bug.