Recent

Author Topic: (SOLVED) Debugging hangs  (Read 7998 times)

gonzob

  • Newbie
  • Posts: 3
(SOLVED) Debugging hangs
« on: January 31, 2011, 01:59:29 am »
Hi all.

This is my first post, and my first attempts at Lazarus/Pascal

I want to do some database program development in both Windows and Linux (Opensuse). I have installed Lazarus on both systems and have worked through the MySQL example (trymysql). I have the program working on the Win system.

I then moved the forms, etc to the Linux system and tried the Lazarus version that came with Opensuse 11.3, and it hung while debugging, so I thought I'd try a more recent version. I installed 0.9.31 29212 via RPM and it still hangs.

Details are:

The project builds OK, then the Lazarus GUI says (debugging...) and nothing happens. I click the pause button and a new tab in the Source Editor pops in called "gtk2widgetset.inc" and the following line is highlighted:

Gtk2MPF(ufds, nfsd, timeout);

I've tried searching, but nothing seems to help.

Any advice?

Thanks

Gonzo
« Last Edit: February 01, 2011, 12:03:25 am by gonzob »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9909
  • Debugger - SynEdit - and more
    • wiki
Re: Debugging hangs
« Reply #1 on: January 31, 2011, 03:02:45 am »
Quote
I click the pause button and a new tab in the Source Editor pops in called "gtk2widgetset.inc"
Ok, so your program is definitely running (even if not as expected)

It should also mean that you have gdb configured as debugger, and likely indicate that your project is compiled with debug info.
I also assume you have double checked those basics...

About debug-info:
On the project-settings "linking" tab, did you select just -g (stabs) or -gw (dwarf)?
Or better even, try each.

Also note, that you may have to recompile the LCL and any package involved, and you may have to configure debug info for them first. At least if you expect to debug into those.

Does your app use threads? There a many postings about that, and it does not seem to work with gdb (yet) on linux. (search the forum and bug tracker)

If you do not use threads

* Important question: Which version of GDB?

* fpc version ?

* Also please open the Menu: "view" => "Debug windows" => "Debug output" (do open it before you start your app), and then once your app is running, copy the content, zip and attach here.

* Start Lazarus from a console, andd watch/copy-attach the IDE's console output during your debug attempt

* I assume you have some breakpoints that you expect to be hit?

* What happens if you start with F8, that should break the app right at startup (in the main project, at begin)

gonzob

  • Newbie
  • Posts: 3
Re: Debugging hangs
« Reply #2 on: January 31, 2011, 06:29:23 am »
OK,

<deep breath>

Thanks for that comprehensive response! I'll try to do justice to it....

Using gdb (ver 7.1-3.12-i586)

Compiled with debuginfo? Don't know - can't see where to select this...

Tried the linking options - no difference that I could see.

Debug output attached up to the point it hangs - I see a lot of references to not being able to find lots of "debuginfo" related files but don't understand the significance.

fpc is 2.4.2 - downloaded from the daily snapshots yesterday. (with source)

Starting from a console seems to give the same output as the debug screen.

I don't know if I have "threads" - the program is the example from here: http://wiki.lazarus.freepascal.org/MySQLDatabases

I haven't put in any breakpoints, as it's such a small program, and it worked under Windows.

If I start with F8, it stops at "begin", with almost all of the output as attached.

Thanks

Gonzo


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9909
  • Debugger - SynEdit - and more
    • wiki
Re: Debugging hangs
« Reply #3 on: January 31, 2011, 02:44:55 pm »
Quote
Compiled with debuginfo? Don't know - can't see where to select this...
That referred to the options on the linking tab. The options for eithe -g or -gw (at the end of the description)

Anyway, the debug output looks normal.
And you seem to have debug info, The msgs saying otherwise are expected, they are about files from the RTL, which does not (and need not) have any.

The gdb version is sufficient (everything from 6.3 upwards should do, but 7.x is recommended).

Have you tried to run the app on Linux, outside the debugger (outside Lazarus)?
Does it only hang when run inside the debugger?
(Sorry if you have, but better a question too many, than missing some important info)

How does the "hang" manifest? Does the form show? but not react?

AFAIK: It seems (from a quick look) that Gtk2MPF should be g_main_context_get_poll_func, which is the main event loop, so the app should be there, whenever it is waiting for something to do.

So that does not give any indication either.

--
Unfortunately, I wont currently have the time to go deeper into the problem... :(

gonzob

  • Newbie
  • Posts: 3
Re: Debugging hangs
« Reply #4 on: February 01, 2011, 12:02:21 am »
Thanks for your help, Martin_fr.

I tried running the program directly from a Linux console, and no change. I tried it on another Linux box, with the same result.

What happened is that the form never showed. I checked the form's VISIBLE tag and it was FALSE. Aha!, I said and changed it. Still the same.

Then it occurred to me that maybe I wasn't calling the form....oops. createform was missing from the lpr.

All fixed. Thanks again for your time.

Gonzo.
« Last Edit: February 01, 2011, 12:04:23 am by gonzob »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9909
  • Debugger - SynEdit - and more
    • wiki
Re: (SOLVED) Debugging hangs
« Reply #5 on: February 01, 2011, 01:19:20 am »
Well good to hear it works :)

 

TinyPortal © 2005-2018