Recent

Author Topic: [Solved] Debug a plugin DLL: start/run stays disabled  (Read 723 times)

d7_2_laz

  • Hero Member
  • *****
  • Posts: 588
[Solved] Debug a plugin DLL: start/run stays disabled
« on: December 12, 2024, 11:08:47 pm »
This question here has a pre-history dealing with templates for Notepad++ plugin writing.
All templates i tried with Windows 10 64 bit, Lazarus 3.6 for Windows 64bit, recent Notepad++ version crashed  … at addresses outside the scope of the pascal code though.
Until i found a well working example. See reply #9 in:

https://forum.lazarus.freepascal.org/index.php/topic,69562.0.html

I attached a (slightly modified by me) demo project there.

Unfortunately, after setting the 'host application' in the start parameters within this demo project, the “run/start” functionality is not enabled. For all crashing templates, it had been enabled.

Does anybody maybe know what one has to do for to unlock/enable the "Start" functionality after having set the host application for to be able to debug a plugin dll?
« Last Edit: December 13, 2024, 06:16:04 pm by d7_2_laz »
Lazarus 3.6  FPC 3.2.2 Win10 64bit

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10655
  • Debugger - SynEdit - and more
    • wiki
Strange...

First of all, I am guessing that all you other settings are unchanged.
So if you do: Project > New > Application ==> Then you can run this in the debugger.


Second, just to check (even though I doubt it would affect the run button)
Tools > Options > Debugger > Backend ==> is it gdb or FpDebug? (both should work, but try either)

Quote
“run/start” functionality
The green button? Or the entry in the menu Run?
- Well they should be the same, but in the run menu, there is a 2nd entry, which should be "run without debugger". If that is "run with debugger" then you need to go to the project options, in there the compiler section the page debuggin, and make sure the checkbox "run uses the debugger" is set.


Also in project options, make sure  "debug info" is enabled.
And on the page "Compiler commands" => compare the settings with those of a new project.





d7_2_laz

  • Hero Member
  • *****
  • Posts: 588
Hi Martin, many thanks for attention!

First, no new application; i derived it from:
https://bitbucket.org/rdipardo/delphiplugintemplate/src/default/Readme.textile
Note, there's a Delphi as well as a Lazarus version herein.

If i look into:
debugger backend:  -> FpDebug    // with gdb i'll retry tomorrow

Run/start: green toolbutton (here also with no enabled dropdown about start parameters) as well as menu item Run. Both disabled.

"Run with or without debugger"? -> "Without debugger", had tried this (as expected without recognizable effect).
Project debugger option "Run uses the debugger" is set.  "Generate info for debugger" is set.

"Compare the settings with those of a new [resp. working] project" -> did already, but will go more indepth tomorrow.

Probably it's a silly thing, debugging DLLs is a somehow unknown territory for me.
Lazarus 3.6  FPC 3.2.2 Win10 64bit

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10655
  • Debugger - SynEdit - and more
    • wiki
Debugging dll isn't the most used feature.... So the IDE might have some bugs.

I just played around a bit and I wasn't able with any of the settings to break it....

One other think to try.
- Remove (backup) the lpi file
- then open (drag drop) the lpr file
- the IDE should ask to create a project for it => yes, and library

Then try again.

If anything in the lpi is wrong then that should fix it

d7_2_laz

  • Hero Member
  • *****
  • Posts: 588
Hm, tried first with comparing the lpi files from two related projects, where one has Run enabled, and the other not.
Many parameters different of course, but, focusing on those which seem to be potentially relevant, tried to bring them to match step-by-step.
No recognizable effect so far, regarding the enabling.

Then i backuped/removed the lpi file and tried to recreate it from the lpr file.
Drag/drop - how meant?
I did an 'Open with ...' of the lpr file targeting the lazarus.exe. Result:
I see my original project file in the IDE, but at first position additionally a very initial unit1 appears.
When compiling, it compiles to <drive>\Users\<username>\Appdata\Local\temp etc.
When doing 'Save project as ..', it offers a brandnew project1 with an project1.exe being generated then (exe!).
Same when (of course) telling the original project name as target.
With other words: by half a brand-new project will be created (i'd expected to save the existing project maybe as lpi, lpr, lps).
What might i have missed when trying to recreate the lpi file from the lpr file?

Edit: involved versions: Windows 10; Lazarus 3.6 64bit

Setting debugger backend to gdb instead of fpdebug: no change.

« Last Edit: December 13, 2024, 03:43:41 pm by d7_2_laz »
Lazarus 3.6  FPC 3.2.2 Win10 64bit

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10655
  • Debugger - SynEdit - and more
    • wiki
I don't know about "open with".

But if you use menu: File > Open ...

On your disk you should have a file that has the source code of your dll, the source starts with "library somename;", it usually has an extension .lpr

- Select that file to open,
- The IDE should ask you "Open as project or source"
- chose "project", the IDE should ask what type of project, and library should be in the list

Then save it, and you have a brand new lpi file for your project.

d7_2_laz

  • Hero Member
  • *****
  • Posts: 588
"Open with ..."-> had been irritated by the "open (drag drop)", so i did by fileexporer outside, select a file, context menu "Open with ..".

Whatsoever, via IDE menu "File open" of the lpr file it behaves as:
re-opens the lpr file immediately / without question; if i press the Save button (disc ico), it recreates indeed the  lpi file.
Unfortunately, via file-compare it shows as completely identical to the previously backuped/removed one ...

What i'll try now, is to file-compare the lpi's (project with run enabled vs. project with run disabled) and to bring the problematic one in synch with the other step by step.
Lazarus 3.6  FPC 3.2.2 Win10 64bit

d7_2_laz

  • Hero Member
  • *****
  • Posts: 588
Got it ......... ouch how trivial  ...   :o
there's a general flag in there: "Runnable Value="False"/>" (in the IDE it's in "Verschiedenes" (Miscellaneous)).

Whoever this had used for which reasons .......

Lazarus 3.6  FPC 3.2.2 Win10 64bit

 

TinyPortal © 2005-2018