Recent

Author Topic: How do you use the debugger - gdb  (Read 23954 times)

Elphi

  • Full Member
  • ***
  • Posts: 132
How do you use the debugger - gdb
« on: September 22, 2007, 09:44:02 pm »
I've set some debugger options
type: gdb
path: /usr/bin/gdb

I've set compiler option to generate debug info for gdb.

I've set a breakpoint in my program.

When I run the program I expect that it stops at the breakpoint set, but it doesn't. What am I doing wrong?

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: How do you use the debugger - gdb
« Reply #1 on: September 24, 2007, 01:52:47 am »
My "Add BreakPoint" menu item is disabled. Is it enabled on your Lazarus?

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2645
RE: How do you use the debugger - gdb
« Reply #2 on: September 24, 2007, 11:40:06 am »
@elphi: it the code run where you placed the breakpoint

@antonio: that dialog needs to be implemented, you can add a breakpoint by clicking in the left gutter.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: How do you use the debugger - gdb
« Reply #3 on: September 24, 2007, 03:53:36 pm »
Thanks.

Elphi

  • Full Member
  • ***
  • Posts: 132
How do you use the debugger - gdb
« Reply #4 on: September 24, 2007, 04:27:54 pm »
Sorry, I not familiar with gdb; where should hit code run? The run items in the IDE are disabled.
The breakpoint list show the breakpoint in state 'invalid'.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2645
How do you use the debugger - gdb
« Reply #5 on: September 25, 2007, 01:05:06 pm »
You see this invalid state while running, or before running ?
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Elphi

  • Full Member
  • ***
  • Posts: 132
How do you use the debugger - gdb
« Reply #6 on: September 26, 2007, 12:19:40 am »
Before running state = ? (On)
When running state = Invalid.

I've learned now that breakpoints set in the program body function as expected, but breakpoints in used units are somehow not recognized.
I also see that the first 30-40 steps after the breakpoint the "current-line" is set at strange places: at the method header, at empty lines, at defines that aren't valid etc. Can't say why it behaves as expected at some point.
Furthermore I get an access violation when I Reset Debugger.

When I run the program without breakpoints I can't figure out how to get the console I am supposed to see. Brings me to the original question: how to use gdb?

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2645
How do you use the debugger - gdb
« Reply #7 on: September 26, 2007, 11:23:55 am »
Pointing to wrong locations usually means that a different source is used for compiling than you use in the ide. (unless you're using some older 2.1.x compiler)

When a unit gets an invalid breakpoint, it can mean 2 things:
1) that unit isn't compiled with debug info. This is usually the case for rtl or fcl units. Only lazarus units are shipped with debug info.
2) that version of the unit is not used when compiling.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Elphi

  • Full Member
  • ***
  • Posts: 132
How do you use the debugger - gdb
« Reply #8 on: September 26, 2007, 10:53:01 pm »
Quote from: "Marc"
Pointing to wrong locations usually means that a different source is used for compiling than you use in the ide. (unless you're using some older 2.1.x compiler)

Certainly not in this case. I've done a Clean Directory with default settings, and stepping through the source seems ok.

Quote from: "Marc"
When a unit gets an invalid breakpoint, it can mean 2 things:
1) that unit isn't compiled with debug info. This is usually the case for rtl or fcl units. Only lazarus units are shipped with debug info.

Not the case here; it concerms my own units.
Quote from: "Marc"
2) that version of the unit is not used when compiling.

The be sure I've the correct version of the unit I deliberately made a compile time error at the breakpoint line, and the compiler recognizes this error.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2645
How do you use the debugger - gdb
« Reply #9 on: September 27, 2007, 12:59:32 pm »
what fpc version do you use
what os (32 or 64 bit)
what debugger options did you set ?
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Elphi

  • Full Member
  • ***
  • Posts: 132
How do you use the debugger - gdb
« Reply #10 on: September 27, 2007, 10:43:38 pm »
Lazarus 0.9.23 svn rev 12157, fpc 2.2.0 x86_64-linux-gtk on CentOS 5
Debugger type: gdb, path: usr/bin/gdb

Elphi

  • Full Member
  • ***
  • Posts: 132
How do you use the debugger - gdb
« Reply #11 on: September 27, 2007, 10:50:26 pm »
Lazarus 0.9.23 svn rev 12157, fpc 2.2.0 x86_64-linux-gtk on CentOS 5
Debugger type: gdb, path: usr/bin/gdb

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2645
How do you use the debugger - gdb
« Reply #12 on: September 28, 2007, 11:21:26 am »
with options I mean: project - compiler options - linking
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Elphi

  • Full Member
  • ***
  • Posts: 132
How do you use the debugger - gdb
« Reply #13 on: September 28, 2007, 09:59:18 pm »
-g -gl

Elphi

  • Full Member
  • ***
  • Posts: 132
How do you use the debugger - gdb
« Reply #14 on: September 30, 2007, 03:28:58 pm »
Related to this bug report?
http://www.freepascal.org/mantis/view.php?id=9821[/url]

 

TinyPortal © 2005-2018