Thanks Mika, that partially helped.

Now when I try to debug the simple Qt program, I get errors with gdb
not being able to find the user-level thread. This is the same simple
single-threaded Qt program I mentioned in the first post.

While debugging the same Qt program outside of Scratchbox 2, the
breakpoints work fine.

While debugging a regular C program that does nothing more than
printf, inside of Scratchbox 2, the breakpoints work fine.

So it seems that a simple Qt program spawns a new thread. I read in
the "Maemo SDK+ Debugging Guide" that gdb needs to be linked against
the same thread library the application is using. So does gdb for
Scratchbox 2 need to be linked against libqthreads? How would you do
that?

Here is the transcript and error:

(sb2-emulate-gdb) sb2-prepare
Function "_dl_debug_state" not defined.
Breakpoint 1 (_dl_debug_state) pending.
(sb2-emulate-gdb) run
Starting program: ./program
Breakpoint 2 at 0xb80a6340
Pending breakpoint "_dl_debug_state" resolved
warning: Temporarily disabling breakpoints for unloaded shared library
"/lib/ld-linux.so.2"
Breakpoint 2 at 0xb80a63c3
[Thread debugging using libthread_db enabled]
Error while reading shared library symbols:
Cannot find new threads: generic error
Cannot find user-level thread for LWP 3639: generic error

On Thu, May 28, 2009 at 10:55 AM, Mika Westerberg
<ext-mika.1.westerb...@nokia.com> wrote:
>
> On May 28, 2009, at 9:24 AM, Westerberg Mika.1 (EXT-Nixu/Helsinki) wrote:
>
>>
>> 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.
>
> Further investigation shows that gdb has been upgraded to version 6.8 which
> somehow (no glue yet) breaks sb2 debugging. Workaround is to downgrade gdb
> in rootstrap to this version:
>
> http://repository.maemo.org/pool/diablo/free/g/gdb/gdb_6.6.dfsg-1+armel+osso1_i386.deb
>
> Just download the file and run:
>
> % sb2 -eR dpkg -i gdb_6.6.dfsg-1+armel+osso1_i386.deb
>
> after this debugging hopefully works again.
>
> We will continue investigation for the root-cause of this problem.
>
> MW
> _______________________________________________
> Scratchbox-users mailing list
> Scratchbox-users@lists.scratchbox.org
> http://lists.scratchbox.org/cgi-bin/mailman/listinfo/scratchbox-users
>
_______________________________________________
Scratchbox-users mailing list
Scratchbox-users@lists.scratchbox.org
http://lists.scratchbox.org/cgi-bin/mailman/listinfo/scratchbox-users

Reply via email to