Recent

Author Topic: How to find source code error line  (Read 586 times)

udihamudi

  • New Member
  • *
  • Posts: 12
How to find source code error line
« on: September 16, 2022, 10:48:46 pm »
Hello all,

Sorry I am very new to Lazarus, I am getting the following error when running my application -
"no variant method call dispatch"
"Pres ok to ignore..."

My question is how can I see which source file the error came from and what is the line number in this source file that raised this error?

Thanks!!

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2085
  • Fifty shades of code.
    • Delphi & FreePascal
Re: How to find source code error line
« Reply #1 on: September 16, 2022, 11:06:34 pm »
Press F7 to step thru your code (debug) until the message appear or set breakpoints or do here and there some "ShowMessage" things to display where you are in code...
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

udihamudi

  • New Member
  • *
  • Posts: 12
Re: How to find source code error line
« Reply #2 on: September 17, 2022, 12:13:00 am »
Thanks! is there a way to cause the execution to print the line number when I get the error?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9908
  • Debugger - SynEdit - and more
    • wiki
Re: How to find source code error line
« Reply #3 on: September 17, 2022, 12:54:50 am »
I don't know about that error, but if there is no exception the debugger wont stop....

Several things you can try

1) Search the error text in all sources (incl fpc/rtl), set a breakpoint where the dialog is opened.
That may however need an fpc install build with debug info.... (fpcupdeluxe)

2) Use the IDE's pause button while that dialog is open.
However, depends on various things if the debugger can then get a callstack...
- Change to the GDB based debugger. The one thing it is better is Callstacks.
- If you have: FPC with debug info, so it may not be needed.
- If you press pause, you may be in the wrong thread, so you must look at all threads, and see if one of them happens to have a useful callstack.

Arioch

  • Sr. Member
  • ****
  • Posts: 421
Re: How to find source code error line
« Reply #4 on: September 17, 2022, 01:05:35 am »
On Delphi JEDI Code Library provides for exception stack traces, assuming the EXE has debug information (in Dlephi native format, or in special JCL format, which it produces out from "setialed map file"

In general JCL always supported FPC too, but i am not sure if that particular component was ported to FPC

Judging by only providing .DFM files but not .LFM - it did not

d:\fpcupdeluxe\ccr\jcl\jcl\experts\repository\ExceptionDialog\StandardDialogs\ExceptDlg.pas

There is, however, another exception stack tracer for FPC

d:\fpcupdeluxe\ccr\madexcept\ExceptionLogger.lpk
https://github.com/r3code/lazarus-exception-logger/

Notice though, any excpetion stack tracer makes exception error diaplaying noticeably slower, and being complex software in worst cases can escalate some really bad crash into a total program failure.  The debug information, even in a special stripped and compressed format, would also increase compiled files size.


 

TinyPortal © 2005-2018