Recent

Author Topic: [solved] debugger doesn't stop on breakpoint  (Read 1654 times)

CapelliC

  • Jr. Member
  • **
  • Posts: 58
[solved] debugger doesn't stop on breakpoint
« on: June 29, 2020, 10:22:35 am »
Attempting to follow what pas2php does, I placed a breakpoint on first statement
in project.lpr. Then hit f9, but the execution doesn't stop.
What's the problem ? program.lpr isn't mean to be the entry point ?

In Project Options / Compiler Options I see that Target files name (-o)] is set to ../index.cgi (no other option seems related to this problem).

This could mean I cannot debug it ?
« Last Edit: June 29, 2020, 04:30:40 pm by CapelliC »

Warfley

  • Hero Member
  • *****
  • Posts: 1499
Re: debugger doesn't stop on breakpoint
« Reply #1 on: June 29, 2020, 02:17:02 pm »
Are debug informations enabled? if not you can't debug anything properly.

CapelliC

  • Jr. Member
  • **
  • Posts: 58
Re: debugger doesn't stop on breakpoint
« Reply #2 on: June 29, 2020, 02:37:31 pm »
In
Project Options / Compiler Options / Debugging / [ Generate info for the debugger ] is checked.
[ Type of debug info ] is Automatic(-g)
Cannot find anything relevant in other sections... maybe in Linking ?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: debugger doesn't stop on breakpoint
« Reply #3 on: June 29, 2020, 03:59:37 pm »
I tried to look at pas2php, but all I could find is a collection of units, but no compilable project.

Anyway => ignoring the extension ".cgi", is the file executable? Can you call/execute it from the command line?

If so, set:
- debug info to "dwarf + set"
- optimization to -O- (or -O1)
- disable anything that says "strip"

The exe should be of a reasonable big size.
For testing, you should be able to make a copy of the exe, and run "strip copy_of_exe"
This should reduce the filesize by more than half.

Check your debugger setup: https://wiki.lazarus.freepascal.org/Debugger_Setup

CapelliC

  • Jr. Member
  • **
  • Posts: 58
Re: debugger doesn't stop on breakpoint
« Reply #4 on: June 29, 2020, 04:30:12 pm »
What I'm trying to debug is the project in

pas2php/project/project.lpr

It doesn't compile out of the box -
 there are 4 mismatches on VariableName (add .name) in Pas2PhpImplementation.pas
and it's missing the unit LazFileUtils in Pas2Php.pas.
Also, the debug info generation flag wasn't set (thanks to Warfley for suggesting to check this).

I've removed the ../index.cgi from Target file name, rebuilt all, hit F7, ignored an exception about a CGI missing parameter (still don't understand from where this get generated) and at least I can step into the applicative code.

Thanks all for the help

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: [solved] debugger doesn't stop on breakpoint
« Reply #5 on: June 29, 2020, 04:38:50 pm »
"cgi param"

They are usually passed via the environment. CGI apps are normally run by a webserver that sets them.

Search for a tutorial on writing cgi scripts, it will tell you what params the server passes. Then in menu: Run > Run params, you can set the environment.

CapelliC

  • Jr. Member
  • **
  • Posts: 58
Re: [solved] debugger doesn't stop on breakpoint
« Reply #6 on: June 29, 2020, 04:48:11 pm »
At least I've found the entry point

in P2PCgi.pas

initialization
  CgiProcessQueryString;
end.

 

TinyPortal © 2005-2018