News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

How to debug a plugin?

Started by Zlika, September 21, 2005, 09:34:58 PM

Previous topic - Next topic

Zlika

Hi!
I'm working on a little plugin but I don't know how to debug it.
If someone could tell me how I should do...
Thank you

Zlika

rickg22

OK um... first, make sure the "Allow only single instance" (or something) option is disabled in the environment settings. Now, with the codeblocks project on, debug it this way:

there's the InitFrame (or something) function in main.cpp (or was it app.cpp?). Anyway, there's a "scanForPlugins" (or something) function, to debug your plugin, just hit f4 in that line so codeblocks will execute.

Then you're able to set up the breakpoints in your plugin. ta-da :)

But personally, I find it easier to do messagebox() functions and codeblocks' debug log. Yeah it's tedious, but doesn't actually need a debugger for it (unless you're having segfaults).

Zlika

Thank you for the answer.
Concerning the "CodeBlocks's debug log", I have seen how to send messages to it but... I don't know where it is printed!? In a file or somewhere in the CodeBlocks IDE? I thougth it was in the "CodeBlocks Debug" tab but I can't see any of my outputs! Maybe I don't use the right function to do it...

Zlika

rickg22

i think it's debuglog or something. Check the messagemanager class to see how it works.

byo

#4
Firsrt turn on  Settings->Environment->Application's debug log - it turns on new tab on Messages pane - there's all You need :)

EDIT: I haven't read this topic carefully. Do You use Manager::Get()->GetMessageManager()->DebugLog ?

cyberkoa

I used to use wxMessageBox to debug but now this time I need to use the GDB to debug. I still couldn't get the way to debug wxSmith .. but I really a newbie in debugging C++ GUI program  ..

I have tried to toggle a break point at ScanForPlugins() at main.cpp and press F4 to let the program run to cursor .

another CB instants running , and I try to check the message , the 10 plugins have been loaded , and the keybind has also been loaded  :shock: ? the program does not stop at breakpoint ?

I check the Debug menu, only Debug Windows and Stop debugger are not grey , cannot press continue /step over/step into.

Since wxSmith has a different project file , how should I do the debug ? I load the CB project file and toggle the breakpoint at ScanForPlugins and load wxSmith project file , toggle the break point at wxSmith source , is it correct ?




MortenMacFly

Quote from: cyberkoa on November 29, 2005, 06:18:35 AM
another CB instants running , and I try to check the message , the 10 plugins have been loaded , and the keybind has also been loaded  :shock: ? the program does not stop at breakpoint ?
...when this happens to me I usually had forgotten to enable the "-g" debug compiler switch and/or forgotten to do a full re-build with the new settings. It's an obvious thing but maybe it happened to you as well...?!

Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

mandrav

The debugger in SVN HEAD supports putting a breakpoint *anywhere*, even in DLLs. No need to break on ScanForPlugins or anywhere else. Just put a breakpoint where you need it and press F8.
Be patient!
This bug will be fixed soon...

cyberkoa

Quote from: mandrav on November 29, 2005, 08:58:29 AM
The debugger in SVN HEAD supports putting a breakpoint *anywhere*, even in DLLs. No need to break on ScanForPlugins or anywhere else. Just put a breakpoint where you need it and press F8.
Thx :) it is very good !


mandrav

Quote from: mandrav on November 29, 2005, 08:58:29 AM
The debugger in SVN HEAD supports putting a breakpoint *anywhere*, even in DLLs. No need to break on ScanForPlugins or anywhere else. Just put a breakpoint where you need it and press F8.

I just want to clarify that "*anywhere*" does not include C++ constructors with gdb.exe. I 'm still converting the hack we used for this...
Be patient!
This bug will be fixed soon...