Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-12

Debugging libraries which define generics.

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Donald Ziesig

Hi All,

I have been working on some *serious* :-$ software libraries that declare generic subprograms and classes.

While debugging these I noticed:

1. When single-stepping, the line being highlighted in the editor window is almost always (but not exclusively) one line *after* the line which is about to be executed.
2. When the mouse hovers over a variable, the debugger (and program being debugged) frequently crashes with the error: "-data-evaluate-expression TCQPiece(ITEM)^" did not return any result. This is particularly annoying because it inevitably happens just as I am getting close to finding a problem and I move the mouse across the editor window :'(.

These problems do not occur when debugging non-generic code.

I am currently using Linux Mint 18 on an Intel core-i5 processor with gdb 7.11.1 (the Ubuntu version).  IIRC, I have had similar problems with Lazarus versions back as far as 1.2 and earlier versions of Debian, but I never had major generic software to debug until now.

I found reports of similar problems caused by line endings (Windows vs. Unix).  Is it possible that the code generated by generic specialization does not observe the OS-specific line endings and confuses gdb?  This is beyond my abilities to fix.

Any suggestions and/or further speculations will be welcome :-).

Don Ziesig

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20171215/222080db/attachment.html>

Reply by email

Martin Frb
to Donald Ziesig
Donald Ziesig wrote 12 lines
Hi All, I have been working on some *serious* :-$ software libraries that declare generic subprograms and classes. While debugging these I noticed: 1. When single-stepping, the line being highlighted in the editor window is almost always (but not exclusively) one line *after* the line which is about to be executed.

This may be an issue in fpc.

IIRC
{$IFDEF unknownfoo}
 'unclosed string
{$ENDIF}
may also lead to wrong line info

Show quoted text 9 lines
1. When the mouse hovers over a variable, the debugger (and program being debugged) frequently crashes with the error: "-data-evaluate-expression TCQPiece(ITEM)^" did not return any result. This is particularly annoying because it inevitably happens just as I am getting close to finding a problem and I move the mouse across the editor window :'(. These problems do not occur when debugging non-generic code.

This is an issue in gdb.

First make sure to use dward (debug info).
This must be done for ALL packages too (well all packages that have debug info).

But even then you will probably get this error.

You can try (if it currently compiles / its a package, install it) lazdebuggerfpgdbmi.lpk  (must be the one with gdbmi *and* fp) And then change the debugger in Tools > Options

I dont know how good it will be....

----------
Also switch of the hint in the options, and use the watch window only. that way you can control which values you look at.

--------
you may also try an older gdb (pre 7.6). But again not likely to help too much.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20171215/aca9862e/attachment-0001.html>

Reply by email

Martin Frb
to Martin Frb
Martin Frb wrote 15 lines
On 15/12/2017 15:46, Donald Ziesig via Lazarus wrote: > > 1. When the mouse hovers over a variable, the debugger (and program > being debugged) frequently crashes with the error: > "-data-evaluate-expression TCQPiece(ITEM)^" did not return any > result. > This is particularly annoying because it inevitably happens just > as I am getting close to finding a problem and I move the mouse > across the editor window :'(. > > These problems do not occur when debugging non-generic code. > This is an issue in gdb. First make sure to use dward (debug info).

^^^ "dwarf"

You can try (if it currently compiles / its a package, install it)  lazdebuggerfpgdbmi.lpk  (must be the one with gdbmi *and* fp)

just remembered, not sure if this works for libraries (.so). You may have to compile an app that includes the code directly.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20171215/f4421cd3/attachment.html>

Reply by email

Donald Ziesig
to Martin Frb
Martin Frb wrote 25 lines
On 15/12/2017 18:29, Martin Frb via Lazarus wrote: > On 15/12/2017 15:46, Donald Ziesig via Lazarus wrote: >> >> 1. When the mouse hovers over a variable, the debugger (and program >> being debugged) frequently crashes with the error: >> "-data-evaluate-expression TCQPiece(ITEM)^" did not return any >> result. >> This is particularly annoying because it inevitably happens just >> as I am getting close to finding a problem and I move the mouse >> across the editor window :'(. >> >> These problems do not occur when debugging non-generic code. >> > This is an issue in gdb. > > First make sure to use dward (debug info). ^^^ "dwarf" > > You can try (if it currently compiles / its a package, install it)  > lazdebuggerfpgdbmi.lpk  (must be the one with gdbmi *and* fp) just remembered, not sure if this works for libraries (.so). You may have to compile an app that includes the code directly.

Thanks Martin.  I changed all of the packages and the main project to use Dwarf3 and it looks as if it has solved the problem. 8-) I'll keep debugging and let you know if it reappears.

Don

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20171215/9c8f2e62/attachment.html>

Reply by email