Please share your expertise. 
Debian
Use GDB and an interface like Kdevelop or GDB’s “Text User Interface” (TUI).
Ensure you have the debugging symbol packages installed:
- webvm-dbg
- libwebkit-1.0-1-dbg
- iceweasel-dbg
ctrl+x a to start using text user interface.
Howto add a manual interrupt. Insert:
__asm__("int3");
Where you want to set break point in the source code.
WebKit
alias debug=$(gdb /home/hendry/webkit/WebKit/WebKitBuild/Debug/WebKitTools/GtkLauncher/GtkLauncher)
Firefox
iceweasel -p testing -a testing http://api.webvm.net/tests/ -g
about:config and set browser.sessionstore.resume_from_crash to false in order to maintain sanity.
Have the iceweasel-dbg (debugging symbols) Debian package installed.
export NSPR_LOG_MODULES=all:5
iceweasel -g
Load symbols of plugin
symbol-file /usr/lib/webvm/npwebvm.so
b Instance.cpp:199
Opera
Opera uses /usr/lib/opera/plugins/operapluginwrapper to run the plugin.
This makes it non-trivial to debug with gdb. export
OPERA_KEEP_BLOCKED_PLUGIN=1 might help from respawning the wrapper.
(gdb) set args
(gdb) set args -debugplugin
(gdb) show args
Argument list to give program being debugged when it is started is "-debugplugin".
Here is a thread on opera-linux which might solve this debugging issue.
Darwin
Using GDB, hope to be using Xcode. Also see won
Symbol not found? Check the linking with for e.g.:
otool -L /Library/Internet\ Plug-Ins/WebVM.plugin/Contents/MacOS/NPN_Invoke
To force a break point add ‘-fasm-blocks’ to CFLAGS and add:
__asm int3;
This is probably x86 only.
I am not sure how debugging symbols work on Darwin. However debugging plugins “just seems to work” on normal Opera/Safari/Firefox Application installs.
runorrto start executing the browser. It most cases it should load the plugin and then you should be able to set break points for debugginglistshows the code listing your are inb NP_Initializefor setting a breakpoint on NP_Initialize is a good place to start debugging fromcontinueorcto continuebtto see the backtrace.bt fullgives moreup 1anddown 1to move about the back trace
Xcode2.4 notes
You can debug Safari and Opera visually with Xcode. However it doesn’t seem to work very well with Firefox-bin.
Opera
Switches say -debugplugin
However this switch only seems to work on UNIX (Debian) platform builds.
Firefox
Firefox does seems to pause GDB on startup. However you can continue debugging from here.
export NSPR_LOG_MODULES=all:9 causes Firefox to display a lot of debugging ‘info’ to STDOUT. Try “all:5”, as I think it still adequately shows plugin debug messages, without too much other cruft.
gdb /Applications/Firefox.app/Contents/MacOS/firefox-bin
Work cycle example
gdb /home/hendry/webkit/WebKit/WebKitBuild/Debug/WebKitTools/GtkLauncher/GtkLauncher
b filename:123 # set a breakpoint on filename, line 102 (an interesting place)
info break # list breakpoints
run http://api.webvm.net/tests/101/ # launch at a test
It should hit a break point, if not try ctrl+c, continue to resume.
list # show code listing
step or s to step through code line by line. p to print values. Press ⏎ (Enter) to repeat the last command.
Caveats and issues
Here is my .gdbinit. You can write little aliases to speed up repetitive debugging cycles. Readline does not seem to work properly with gdb, hence ⇧ (up arrow/cursor) to call up previous commands does not work.
Debugging with Xcode with a Makefile based project
Debugging in Xcode without an Xcode project does not seem to work 

