Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: Zlika on September 21, 2005, 09:34:58 pm

Title: How to debug a plugin?
Post by: Zlika on September 21, 2005, 09:34:58 pm
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
Title: Re: How to debug a plugin?
Post by: rickg22 on September 21, 2005, 11:59:24 pm
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).
Title: Re: How to debug a plugin?
Post by: Zlika on September 22, 2005, 01:42:58 pm
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
Title: Re: How to debug a plugin?
Post by: rickg22 on September 22, 2005, 06:27:12 pm
i think it's debuglog or something. Check the messagemanager class to see how it works.
Title: Re: How to debug a plugin?
Post by: byo on September 22, 2005, 06:48:06 pm
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 ?
Title: Re: How to debug a plugin?
Post by: cyberkoa on November 29, 2005, 06:18:35 am
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 ?



Title: Re: How to debug a plugin?
Post by: MortenMacFly on November 29, 2005, 07:39:43 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.
Title: Re: How to debug a plugin?
Post by: 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.
Title: Re: How to debug a plugin?
Post by: cyberkoa on December 02, 2005, 10:55:41 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 !

Title: Re: How to debug a plugin?
Post by: mandrav on December 02, 2005, 11:04:04 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...