Author Topic: How to debug a plugin?  (Read 7198 times)

Offline Zlika

  • Plugin developer
  • Multiple posting newcomer
  • ****
  • Posts: 59
How to debug a plugin?
« 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

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: How to debug a plugin?
« Reply #1 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).

Offline Zlika

  • Plugin developer
  • Multiple posting newcomer
  • ****
  • Posts: 59
Re: How to debug a plugin?
« Reply #2 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

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: How to debug a plugin?
« Reply #3 on: September 22, 2005, 06:27:12 pm »
i think it's debuglog or something. Check the messagemanager class to see how it works.

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: How to debug a plugin?
« Reply #4 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 ?
« Last Edit: September 22, 2005, 07:08:08 pm by byo »

Offline cyberkoa

  • Plugin developer
  • Almost regular
  • ****
  • Posts: 145
    • http://
Re: How to debug a plugin?
« Reply #5 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 ?




Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: How to debug a plugin?
« Reply #6 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4305
    • Code::Blocks IDE
Re: How to debug a plugin?
« Reply #7 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.
Be patient!
This bug will be fixed soon...

Offline cyberkoa

  • Plugin developer
  • Almost regular
  • ****
  • Posts: 145
    • http://
Re: How to debug a plugin?
« Reply #8 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 !


Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4305
    • Code::Blocks IDE
Re: How to debug a plugin?
« Reply #9 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...
Be patient!
This bug will be fixed soon...