News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Help Required.

Started by nahn1989, January 10, 2012, 10:26:16 AM

Previous topic - Next topic

nahn1989

Hi,

I want to develop a plugin for code::blocks. I compiled code::blocks nightly build rev 7671 on windows 7. If i use ListCtrlLogger in my plugin, on double click event, code::blocks crashes.

Please tell me how to compile the code blocks properly on windows 7.

MortenMacFly

See here:
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows

Some more information is here:
http://wiki.codeblocks.org/index.php?title=Developer_documentation

Generally without code or more information it's hard to answer (if not impossible) why it is crashing.
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]

nahn1989

Source code used is shown below.

namespace
{
const int ID_List = wxNewId();
};

BEGIN_EVENT_TABLE(Open_Tag_Log, wxEvtHandler)
//
END_EVENT_TABLE()

Open_Tag_Log ::Open_Tag_Log(const wxArrayString& Titles, wxArrayInt& Widths)
    : ListCtrlLogger(Titles, Widths)
{
}

Open_Tag_Log::~Open_Tag_Log()
{
  if (control && !Manager::IsAppShuttingDown())
  {
    control->RemoveEventHandler(this);
  }
}

wxWindow* Open_Tag_Log::CreateControl(wxWindow* parent)
{
  ListCtrlLogger::CreateControl(parent);
  control->SetId(ID_List);
  OpenTagLog.AppendToLog(_("Create Control Called"));
  Connect(ID_List, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED,
            (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
            &Open_Tag_Log::OnDoubleClick);
  control->PushEventHandler(this);
  return control;
}

void Open_Tag_Log::OnDoubleClick(wxCommandEvent &event)
{
  // go to the relevant file/line
  OpenTagLog.AppendToLog(_("Double Click"));
  if (control->GetSelectedItemCount() == 0)
  {
    return;
  }
  // find selected item index
  const int Index = control->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
  SyncEditor(Index);
}

ollydbg

Or post all the plugin source here(as a zip file), so some one can have a look.
Mostly, I suggest you debug your plugin under gdb.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

nahn1989

How to debug the plugin using GDB on windows platform?

ollydbg

Quote from: nahn1989 on January 11, 2012, 04:36:46 AM
How to debug the plugin using GDB on windows platform?

As Morten said, you need to build the Codeblocks from source under Windows.
Debug your plugin is the same as debug c::b.

You build your plugin, and start debug c::b, then the  c::b(debugee) will automatically load your plugin.

This is some kind of how to debug a dll. :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.