Recent

Author Topic: How to run the code step by step - debugger not working  (Read 15232 times)

dotniet

  • New Member
  • *
  • Posts: 46
How to run the code step by step - debugger not working
« on: October 28, 2009, 04:44:56 pm »
Hi.

I cannot  run the code step by step. In 'options' the debugger is set to gdb.exe and the program is there (on disk).
When I set a brk point is shows a question mark, then when I run the program it the break point turns to a red 'x' sign.

I have tried also to set back both "smart link" options but still not working.

I need to do something special to debug my program?

I have:
   Lazarus 0.9.28 beta
   Win XP - 32 bit
« Last Edit: October 28, 2009, 04:47:22 pm by dotniet »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11463
  • Debugger - SynEdit - and more
    • wiki
Re: How to run the code step by step - debugger not working
« Reply #1 on: October 28, 2009, 06:17:45 pm »
There are many possible reasons. The first 2 are unlikely, but for completness sake

- in the options: there are 2 relevant fields. You mention you have at least set one of them). I assume you mean you set them both? debugger type, AND location of gdb.exe

- The breakpoint is at a line of code, which is never called, and hence omitted from your source. I guess that is not likely to be the case.

- You did not compile your app or the specific unit, with debug info

If you compile your app, in the compiler option you must have debug info turned on. You may (optional) choose dwarf.

You must *not* use strip on your compiled program
You must not pack (upx) your compiled program
You must not use a starter/launcher application (xterm) (run/run params) or the debugger will try to debug that instead

If you include units from packages, (including lcl) debug info for those is only included, if the package was explicitly compiled with debug info too.


oniriabot

  • New Member
  • *
  • Posts: 12
Re: How to run the code step by step - debugger not working
« Reply #2 on: October 29, 2009, 01:36:39 pm »
Hello,

I have the same problems. When I install Lazarus 0.9.26, I can debug my program step by step.
When I install Lazarus 0.9.28, I can't.
I have windows XP on my computer.
I don't understand because I install Lazarus 0.9.26 on a folder and lazarus 0.9.28 in another and at this time, Lazarus 0.9.26 doesn't want to debug anything (gdb is launch if I see in task manager).
I verified the folder of program -> it's the right folder

So I doesn't understand why Ican't debug

Thank you for your help

Oniriabot

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11463
  • Debugger - SynEdit - and more
    • wiki
Re: How to run the code step by step - debugger not working
« Reply #3 on: October 29, 2009, 01:56:45 pm »
@oniriabot

Does Lazarus show you breakpoints as ok? e.g the normal red dot?
or do you also see the disabled breakpoints as dotniet writes:
"When I set a break point is shows a question mark, then when I run the program it the break point turns to a red 'x' sign." ?

If you have enabled breakpoints, you have a different problem. And I would suggest you start a new thread, otherwise people are less likely to see dotniet problem, and he has lower chances to get an answer.

You may want to read:
http://forum.lazarus.freepascal.org/index.php/topic,6635.msg36799.html

if your problem is neither this (disabled brkpoints), nor that (exception) then open a new thread, and include the output of:
Menu "View", "debug windows", "debug output"

-----------------

@dotniet:
One more: do *not* use "use external gdb debug symbols file (-Xg)" from the compiler-option dialog
=> it doesn't work

check the size of your exe, it should be well over 10 MB (for a simple application)

if nothing helps aslo include the "debug output"





oniriabot

  • New Member
  • *
  • Posts: 12
Re: How to run the code step by step - debugger not working
« Reply #4 on: October 29, 2009, 02:08:51 pm »
OK, I open a new thread but I found the solution :
In Configuration - Option -debugger info, I use the lazarus 0.9.26's gdb and now, I can debug program step by step.

I think there is a bug in gdb software because gdb for lazarus 0.9.26 is running and gdb for lazarus 0.9.28 doesn't debug.

dotniet

  • New Member
  • *
  • Posts: 46
Re: How to run the code step by step - debugger not working
« Reply #5 on: October 30, 2009, 02:43:08 pm »
you must have debug info turned on.

Thanks!!!
That was the problem. I came from Delphi. I was not aware that I need the debug info in exe.

Thanks again.

diducu

  • Newbie
  • Posts: 4
Re: How to run the code step by step - debugger not working
« Reply #6 on: November 05, 2009, 06:21:00 pm »

I cannot  run the code step by step. In 'options' the debugger is set to gdb.exe and the program is there (on disk).
When I set a brk point is shows a question mark, then when I run the program it the break point turns to a red 'x' sign.

I have tried also to set back both "smart link" options but still not working.

I need to do something special to debug my program?

I have:
   Lazarus 0.9.28 beta
   Win XP - 32 bit

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11463
  • Debugger - SynEdit - and more
    • wiki
Re: How to run the code step by step - debugger not working
« Reply #7 on: November 05, 2009, 06:35:22 pm »
Again it seems your program does not contain debug info.

See my post at the top..

Also make sure you are NOT using an external debug symbol file.
Check all the options in compiler-settings.

BTW, the default for them is to be on, so you must have accidentally changed them. Or you are debugging3rd party code which may not have them


oniriabot

  • New Member
  • *
  • Posts: 12
Re: How to run the code step by step - debugger not working
« Reply #8 on: November 05, 2009, 06:57:42 pm »
I have the same problem.
When I want to use Lazarus 0.9.28, I can't debug my software but with lazarus 0.9.26 I can.

I add debug info in the soft, but gdb doesn't stop anywhere.

With lazarus 0.9.26, I don't need to add something, it works fine but the new lazarus doesn't want to debug.

Is it possible to see what gdb tell to lazarus like a verbose mode ?
I can't understand what is the problem. I think, the new lazarus doesn't like french windows configuration but why ????

 

TinyPortal © 2005-2018