Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

Change the Debugger Toolbar on the fly

(1/4) > >>

e.p:
Hello, I am bothering you again ;-)

I am adding a second debugger on the framework created by obfuscated.
Problem: the functions of my debugger are different from the functions of gdb, so I need a different toolbar with different tools.

I managed to change on the fly the Debug menu (I call in DebuggerMenuHandler::SetActiveDebugger a slightly modified version of DebuggerManager::GetMenu).
I am now trying to do the same with the toolbar, but without success.

I modified DebuggerToolbarHandler::GetToolbar and it does what I want. But calling it does not replace the toolbar.
Making MainFrame::CreateToolbars public and calling it adds the right toolbar, but after it I have everything twice. A solution would be to delete all the toolbars (how?) and then call MainFrame::CreateToolbars.

Is there a better way? Hints? Am I missing something?

Regards
e.p

oBFusCATed:
Hm, tell us what you want to have in the toolbar and we(I) will see if they could be added/implemented.
What kind of debugger?
Is your plugin going to be open sourced?

Can you show me the changes you've made?

e.p:

--- Quote from: oBFusCATed on May 26, 2011, 12:31:53 pm ---Hm, tell us what you want to have in the toolbar and we(I) will see if they could be added/implemented.
--- End quote ---

I don't think it would make sense. The functions are very specific and would be of no use for normal debuggers (it is a hardware debugger).


--- Quote ---What kind of debugger?
--- End quote ---

A debugger for a microcontroller unit.


--- Quote ---Is your plugin going to be open sourced?
--- End quote ---

It will be distributed freely to the developers using the microcontroller.
In order to make it work, I had to make changes to the code of CB, so it will not be available as plugin, but only as packet together with the "special" version of CB.


--- Quote ---Can you show me the changes you've made?
--- End quote ---

We run two different networks: the development network (without internet access) and the external network. So I can not show you the code directly.
I'll explain you what I did and if you want more details, ask. I can copy small snippets of code if needed.




* copy debuggergdb folder and paste it as debuggerA
* renamed everything until I had a properly compiling project with two debuggers (which did exactly the same)
* adapted debuggerA (executable name, prompt, options, ParseOutput,...)
* since the debugging windows are very different and I need to call functions of their classes from ParseOutput, I created other classes for them (e.g. A_cbCPURegistersDlg instead of cbCPURegistersDlg)
* added in the .xrc files objects like "debugger_A_menu" (the same for the toolbar)
* added to DebuggerMenuHandler::SetActiveDebugger the following line: Manager::Get()->GetDebuggerManager()->GetMenu();
* edited GetMenu so that the menu gets deleted each time and then rebuilt using either "debugger_A_menu" or "debugger_menu" according to the active debugger
* added in debuggermenu.cpp the IDs, the event table entries and the event handlers for the A-menu
This works like a gem. The problem I am facing is how to adapt the toolbar, too.

Thank you for your help
e.p

oBFusCATed:

--- Quote from: e.p on May 26, 2011, 01:33:41 pm ---It will be distributed freely to the developers using the microcontroller.
In order to make it work, I had to make changes to the code of CB, so it will not be available as plugin, but only as packet together with the "special" version of CB.

--- End quote ---
Keep in mind that most of the sources of C::B are licensed under the GPL v3 license, some are LGPL v3. Look at the top of the files you modify for the correct license.
(some files in the SDK have wrong licenses btw). So if you modify a GPL file you can't redistribute binaries without redistributing the changes to that code.
LGPL is relatively similar.



--- Quote from: e.p on May 26, 2011, 01:33:41 pm ---

* copy debuggergdb folder and paste it as debuggerA
* renamed everything until I had a properly compiling project with two debuggers (which did exactly the same)
* adapted debuggerA (executable name, prompt, options, ParseOutput,...)
* since the debugging windows are very different and I need to call functions of their classes from ParseOutput, I created other classes for them (e.g. A_cbCPURegistersDlg instead of cbCPURegistersDlg)
* added in the .xrc files objects like "debugger_A_menu" (the same for the toolbar)
* added to DebuggerMenuHandler::SetActiveDebugger the following line: Manager::Get()->GetDebuggerManager()->GetMenu();
* edited GetMenu so that the menu gets deleted each time and then rebuilt using either "debugger_A_menu" or "debugger_menu" according to the active debugger
* added in debuggermenu.cpp the IDs, the event table entries and the event handlers for the A-menu
This works like a gem. The problem I am facing is how to adapt the toolbar, too.

Thank you for your help
e.p

--- End quote ---
Hm, sounds like a big hack. And why have you copied the debuggergdb directory?
Why haven't you started a new plugin, there is a wizard which does almost perfect job?

My advice would be to not use the Debugger menu and Debugger toolbar, but use your separate version.
Every plugin can have a menu and a toolbar, see the other plugins how to do it.

And I'm asking again, what do you want to have in the toolbar, how could it be so different to the normal debugger?

e.p:

--- Quote from: oBFusCATed on May 26, 2011, 02:04:56 pm ---Keep in mind that most of the sources of C::B are licensed under the GPL v3 license, some are LGPL v3. Look at the top of the files you modify for the correct license.
(some files in the SDK have wrong licenses btw). So if you modify a GPL file you can't redistribute binaries without redistributing the changes to that code.
LGPL is relatively similar.
--- End quote ---

This is no problem. What I am saying is that you cannot use it as single plugin in a "normal" version of CB. You need the rest of the modified code too.



--- Quote ---Hm, sounds like a big hack. And why have you copied the debuggergdb directory?
Why haven't you started a new plugin, there is a wizard which does almost perfect job?
--- End quote ---

Because I can recycle a lot of your code ;-)


--- Quote ---And I'm asking again, what do you want to have in the toolbar, how could it be so different to the normal debugger?
--- End quote ---

We have no "Run to cursor" and no "Information windows".
No "Call stack" and no "Threads". In return we have a "Pin Emulation" and a "Debugger Link" window. And a "reset" button.

e.p

Navigation

[0] Message Index

[#] Next page

Go to full version