Debugging a plugin

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
djorge
Senior Member
Senior Member
Posts: 422
Joined: 2003-07-03, 12:48 UTC
Location: Portugal

Debugging a plugin

Post by *djorge »

How do i debug a plugin as it is not an executable?

Thanks in advance
djorge
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

Usually the IDE allows to specify EXE-file that will start and load the DLL being debugged. What programming IDE do you use?
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
djorge
Senior Member
Senior Member
Posts: 422
Joined: 2003-07-03, 12:48 UTC
Location: Portugal

Post by *djorge »

Flint wrote:What programming IDE do you use?
I didn't know that. That's interesting. I'm using visual c++.

Thanks,
djorge
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

djorge
I'm using visual c++.
In this case the debugging of DLL is very simple. Just select Debug -> Start menu command (VC++ .NET) or Build -> Start Debug -> Go (VC++ 6.0), and VC++ will automatically sujjest you to enter the EXE-file name. Just input full path of TOTALCMD.EXE and press OK - the the IDE will start TC (it will warn that TC has no debug info - just press OK).
For example, set Breakpoint somewhere in your plugin. Then make new instance of TC call your plugin so that the function with breakpoint was called, and VC++ will stop at this breakpoint.

Of course, before all that you must specify full path to your debug version of DLL in wincmd.ini, else TC will call either some other plugin file, not being debugged, or will not call this plugin at all.
djorge
Senior Member
Senior Member
Posts: 422
Joined: 2003-07-03, 12:48 UTC
Location: Portugal

Thank you Flint

Post by *djorge »

It worked. Now i can debug my plugin and better understand the plugin behavior.

Can I use the same techique to debug a Lib (I have the Lib source files) ?

And if it is a Packer/Viewer plugin? How the debug is done? Is with the same technique ?

Thanks djorge
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

djorge
Can I use the same techique to debug a Lib
Hm... I didn't try it. LIB-files are linked with the EXE-file itself, so you can debug them from debugging that project where you use this LIB. Just enter into the function imported from the LIB-file, and VC++ should go into the LIB sources. But there is one difficulty: I have not debugged LIBs, so I don't know how to tell VC++ where LIB's sources are. Maybe it will ask, maybe it will find them automatically from debug info, maybe something else...
And if it is a Packer/Viewer plugin? How the debug is done? Is with the same technique ?
I have not created Packer-plugins yet, but I think debugging of them must be in the same way - just write path to WCX in wincmd.ini, start new TC instance and enter into the archive with supported type. What about Lister-plugins - I just write new version of my plugin, with debugging of course :) It is in the similar way - wincmd.ini, start TC, press F3 on some file that will be opened by plugin. VC++ automatically enters into my functions, stops at breakpoints and so on.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes, packer and lister plugins are just DLLs, like file system plugins, so debugging works the same way.
Author of Total Commander
https://www.ghisler.com
Post Reply