View Issue Details

IDProjectCategoryView StatusLast Update
0035339LazarusDebuggerpublic2019-08-20 21:02
ReporternanobitAssigned ToMartin Friebe 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformwin32OSWindowsOS Version10
Product Version2.0Product Build 
Target VersionFixed in Version 
Summary0035339: watching function-pointer
DescriptionWatching (mouse hint and watch view) of fnPtr leads to
modal message EObjectCheck: "Object reference is Nil."
And this fnPtr is not listed in the view of local variables.
Steps To Reproduceprogram project1;

  type tfnPtr = function( a: byte): byte;

  function fn( a: byte): byte;
  begin result := a+1; end;

  procedure test;
  var fnPtr: tfnPtr; r: integer;
  begin
    fnPtr := @fn;
    r := fnPtr( 3);
  end;

begin
  test;
end.
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

Martin Friebe

2019-04-09 23:08

manager   ~0115365

I can not reproduce.

32 or 64 bit Lazarus
default or newer version of GDB
stabs or dwarf (not tested dwarf3)

Any details what may be missing?

nanobit

2019-04-10 12:35

reporter   ~0115387

The regular win32 Lazarus 2.0 installation.
GNU debugger (with fpdebug)
gdb v7.7.1 or v8.2
any dwarf

1) add "fnPtr" to watches view
2) run to break point at fnPtr(3) call
3) message appears:

[Window Title]
The debugger experienced an unknown condition

[Content]
Press "Ignore" to continue debugging. This may NOT be safe. Press "Abort" to stop the debugger.
Exception: EObjectCheck with message "Object reference is Nil"
Context: TFpGDBMIDebuggerCommandEvaluate. State: dsPause

  $00E252F5 line 1174 of fpdbgdwarf.pas
  $00E6343A line 285 of fpdbgdwarffreepascal.pas
  $00E2654D line 1271 of fpdbgdwarf.pas
  $00E40702 line 1751 of fppascalparser.pas
  $00E3F112 line 1414 of fppascalparser.pas
  $00E40A37 line 1825 of fppascalparser.pas

Martin Friebe

2019-04-10 20:19

manager   ~0115402

I can not reproduce in trunk. I believe the crash was fixed/prevented with
  r60476 LazDebuggerFp: Prevent crash for unimplemented dwarf-tags (e.g. tag_interface). See issue 35129
This will be part of 2.0.2

This does not implement the display of function pointers. It will show ident not found instead. (So the issue remains)

However without the crash, you can temporarily switch to "Display GDB instead of FpDebug watches" from the run menu.

nanobit

2019-04-13 11:01

reporter   ~0115465

Now I've tested with the trunk version, can confirm identifier-not-found instead of crash in Laz 2.0. It's a good improvement.

Martin Friebe

2019-07-03 20:30

manager   ~0117049

Function pointers should now (mostly) work.
  Showing: Address = name: var-declaration-or-type-name
The Name, depends on the debugger being able to locate the function at the address.

The only known remaining issue is that in some cases the type is not shown as function, but instead it shows the type of the functions result.
E.g. "Function Foo: boolean" may sometimes tell you the variable is "boolean".

Issue History

Date Modified Username Field Change
2019-04-07 19:27 nanobit New Issue
2019-04-07 19:27 nanobit Status new => assigned
2019-04-07 19:27 nanobit Assigned To => Martin Friebe
2019-04-09 23:08 Martin Friebe LazTarget => -
2019-04-09 23:08 Martin Friebe Note Added: 0115365
2019-04-09 23:08 Martin Friebe Status assigned => feedback
2019-04-10 12:35 nanobit Note Added: 0115387
2019-04-10 12:35 nanobit Status feedback => assigned
2019-04-10 20:19 Martin Friebe Note Added: 0115402
2019-04-13 11:01 nanobit Note Added: 0115465
2019-07-03 20:30 Martin Friebe Note Added: 0117049
2019-08-20 21:02 Martin Friebe Status assigned => resolved
2019-08-20 21:02 Martin Friebe Resolution open => fixed
2019-08-20 21:02 Martin Friebe Widgetset Win32/Win64 => Win32/Win64