Remote debugging (or other powerful debugging possibilities)
I ported the xine.h to objectpascal.
But it seems that I got something wrong. Lazarus' integrated debugger is of no help here.
gdb seems to have a user interface next to unusable.
Next I tried insight (which I think internally uses gdb) but at least it has a nice GUI.
I was surprised (and disappointed) to learn that although insight can show disassembly of code it also has source code available, it cannot disassemble code that it has no source!
I don't know whether this is a limitation of insight itself or the underlying gdb.
But something even worse: when debugging, suddenly the machine locks up totally. Even "panic" keys such as Ctrl-Alt-Backspace or Ctrl-Alt-F1 etc do not do anything.
The first time this happened I had no choice but to use the hardware reset button.
Then I installed the ssh server so I can login my linux PC (having KUbuntu 7.10 installed) from a windows PC using putty. Now I can at least kill the offending process to avoid a hardware reset but that still does not help with debugging.
A remote debugger that could show the debugging user interface either on a windows PC or another linux PC would be useful, because then a temporary XWindow system lockup while debugging would be no problem.
What remote debuggers are available to debug linux programs ?
the IDA claims to be able to do it, but does that include the free 4.9 version ?
I guess that while porting the xwindow and gtk libraries to objectpascal, those who did that work may have run into similar problems.
If you did, what debugger did you use to find what is theproblem so you can correct it ?
So all those who have used a remote debugger to debug linux applications, please write about what debugger dis you use.
I also have the Kylix3 professional, but is that of any help here?
(then I would need to install for example debian sarge into a virtual machine to run kylix3, since it doesn't run in more modern linuxes). Also, I have no idea, if xine was useful at the time of selecting a version of xine to be included in debian sarge.
The xine engine is hard to debug, because the video playing needs to lock the XWindow system (as in the following example, which I translated to objectpascal from the "C" language example program shown here:
http://xinehq.de/index.php/hackersguide)
XLockDisplay(display);
got_event := XPending(display);
if LongBool( got_event )
then XNextEvent(display, @xevent);
XUnlockDisplay(display);
Without remote debugging, I think what happens is that after the XLockDisplay -call, the debugger cannot access the XWindow -server, and so that results in a total machine lockup.
This is all theoretical, since the machine locks up in a much earlier place.
The only thing that I have got working so far, is that I started by converting the small example "C" program to a .so dynamic library, and the main() to dll_main() and called that from a freepascal program.
That works otherwise perfectly, but it produces some strange error message about a mutex when closing the application. Until app closing time, there are no problems at all.
I tried to debug that situation too, but the lack of the possibility to single-step disassembly listing of a code I have no source in Insight left me with nothing to do a succesful debugging.
The only workaround to suppress the error message about the mutex I found was this:
program XineTest;
uses
MyFirstUnit, {other used units here} ;
...
end.
---------------------------
Unit MyFirstUnit;
interface
implementation
initialization
finalization
// do a syscall: sys_exit; this is equivalent to Halt; - but halt still produces the error message about the mutex.
sys_exit(0);
end.
By putting MyFirstUnit as the first unit in the main program, I can guarantee that the finalization sections in all other units used will run before this one - so the only thing bypassed is the system unit finalization section.