Tuesday, July 17, 2007

gdb - debug plugins with realplay

When I debug helix plugins with realplay, my old way, setting LD_PRELOAD, seemed do not work,mainly because realplay is an X windows application, and I can not go to the main entry point before load the shared "so". My new way to debug helix plugin is, run realplay externel on a shell:

export HELIX_LIBS=/usr/local/RealPlayer
/usr/local/RealPlayer/realplay.bin &
[1] 4175

the number 4175 will be the process id which will be used by gdb.

Then start gdb in emacs, "ESC-x gdb":

attach 4175

will attach the running process with gdb, then, I can set break points for my plugins.

When debugging, the main problem here is, the helix code is not available since I directly pull the builtin files from www.real.com, so the `next' command will complain when there's not valid code to debug. Here is a reference from RMS gdb manual:

The next command will exit any functions we can't debug (like C library functions).

Since `next' will not work if the plugs calls a function from helix, but the other command `until' still works, the only thing is, I may not like to use this command.