On May 27, 2009, at 6:02 PM, ext Neil Hooey wrote:

I wrote a very simple Qt program that works just fine. Here is the source:

#include <QApplication>
#include <QPushButton>
int main(int argc, char* argv[]) {
   QApplication app(argc, argv);
   QPushButton button("Hello", &frame);
   button.resize(50, 50);
   button.move(100, 100);
   button.show();
   return app.exec();
}

When I try to debug it in gdb, setting a breakpoint in main in the way
that scratchbox-specific gdb instructs you to doesn't actually get
caught:

$ gdb ./qt-program
GNU gdb 6.8-debian blah blah blah
Welcome to scratchbox2 enabled gdb!
================================
Before starting target program you should run command 'sb2-prepare'
that sets breakpoint which is used to stop target before its main()
gets called.  After the breakpoint is hit, you are able to set
furtherbreakpoints and do normal debugging actions.
================================
(sb2-emulate-gdb) sb2-prepare
Function "_dl_debug_state" not defined.
Breakpoint 1 (_dl_debug_state) pending.
(sb2-emulate-gdb) run
Starting program: /home/nhooey/code/fun/testTable/testTable
QGtkStyle cannot be used together with the GTK_Qt engine.
Qt: Session management error: Could not open network socket
### The program runs, but no breakpoint is caught

It seems that gdb support in sb2 is broken again. I was able to reproduce the bug
here so I will start to investigate it right now.


When I restart gdb and try to set a breakpoint on main() in the usual
way, here's what happens:

(sb2-emulate-gdb) br main
Breakpoint 1 at 0x80489a9
(sb2-emulate-gdb) run
Starting program: /home/nhooey/code/fun/testTable/testTable
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0x80489a0: Input/output error.
Cannot insert breakpoint -4.
Temporarily disabling shared library breakpoints:
breakpoint #-4
### The program runs, but no breakpoint is caught

Does anyone know why this isn't working?

You cannot set breakpoint that way because your binary is not fully mapped in yet hence the IO error from gdb. That's why sb2-prepare command was added to
sb2 gdb wrapper script.

MW

_______________________________________________
Scratchbox-users mailing list
Scratchbox-users@lists.scratchbox.org
http://lists.scratchbox.org/cgi-bin/mailman/listinfo/scratchbox-users

Reply via email to