To me it seems that you don't just add the root ones as is done in the normal watches.I do not see how this influences the "MemoryWatches". At the moment i make a watch for every element that is expanded and not only the root. I do this, because the address range of the registers can contain address jumps from one register to the other (and they can be MBytes large). It is not guaranteed that between this "jumps" are valid addresses that can be read. Of course this is not performant. A good plugin should check the range of the watches, and if it is one big continuous range it should collect this and make one big watch. But i do not think this logic should be part of codeblocks,but rather part of the plugin. The watches should be as universal as possible (For example to use them as memory viewer of the normal codeblocks https://github.com/bluehazzard/cbMemoryView )...
Does it make sense to do the same thing? Is it to limiting?
but with svd files you could have hundreds of registers and their views.Yes this is a problem, and it makes the plugin painful slow, but i have written this limitation in the README. It is not really a limitation, because it would get confusing pretty fast if you expand a lot registers, so it is not the normal use case. If it is really a user problem the plugin can be extended with the logic mentioned above pretty easy. Because of the slow update rate for many watches i need events to inform the user that all watches are updated.
#0 0x00007ffff442dd94 in wxPGChoicesData::Item (this=0x0, i=0) at ../git/include/wx/propgrid/property.h:673
#1 0x00007ffff442deae in wxPGChoices::Item (this=this@entry=0x61600172bdb8, i=i@entry=0) at ../git/include/wx/propgrid/property.h:887
#2 0x00007ffff442aaef in wxPGChoices::operator[] (i=0, this=0x61600172bdb8) at ../git/include/wx/propgrid/property.h:950
#3 wxPGProperty::GetDisplayInfo (this=this@entry=0x61600172bc80, column=column@entry=1, choiceIndex=choiceIndex@entry=0, flags=flags@entry=0, pString=pString@entry=0x7fffffffc580, pCell=pCell@entry=0x7fffffffc500) at ../git/src/propgrid/property.cpp:839
#4 0x00007ffff442b274 in wxPGDefaultRenderer::Render (this=0x602000057230, dc=..., rect=..., propertyGrid=0x61c000042880, property=0x61600172bc80, column=1, item=-1, flags=0) at ../git/src/propgrid/property.cpp:256
#5 0x00007ffff4444cf6 in wxPropertyGrid::DoDrawItemsBase (this=this@entry=0x61c000042880, dc=..., itemsRect=itemsRect@entry=0x7fffffffcac0, isBuffered=isBuffered@entry=true) at ../git/src/propgrid/propgrid.cpp:2488
#6 0x00007ffff44453d3 in wxPropertyGrid::DoDrawItems (itemsRect=0x7fffffffcac0, dc=..., this=0x61c000042880) at ../git/include/wx/propgrid/propgrid.h:1824
#7 wxPropertyGrid::DrawItems (this=this@entry=0x61c000042880, dc=..., topItemY=<optimized out>, bottomItemY=<optimized out>, itemsRect=itemsRect@entry=0x7fffffffcac0) at ../git/src/propgrid/propgrid.cpp:1999
#8 0x00007ffff44459a0 in wxPropertyGrid::OnPaint (this=0x61c000042880) at ../git/src/propgrid/propgrid.cpp:1879
#9 0x00007ffff28199f6 in wxAppConsoleBase::HandleEvent (this=<optimized out>, handler=<optimized out>, func=<optimized out>, event=...) at ../git/src/common/appbase.cpp:657
#10 0x00007ffff2819a3a in wxAppConsoleBase::CallEventHandler (this=0x61a00001e680, handler=0x61c000042880, functor=..., event=...) at ../git/src/common/appbase.cpp:669
#11 0x00007ffff29b5e63 in wxEvtHandler::ProcessEventIfMatchesId (entry=..., handler=handler@entry=0x61c000042880, event=...) at ../git/src/common/event.cpp:1396
#12 0x00007ffff29b814f in wxEventHashTable::HandleEvent (this=<optimized out>, event=..., self=self@entry=0x61c000042880) at ../git/src/common/event.cpp:1004
#13 0x00007ffff29b81fa in wxEvtHandler::TryHereOnly (this=this@entry=0x61c000042880, event=...) at ../git/src/common/event.cpp:1593
#14 0x00007ffff29b8266 in wxEvtHandler::TryBeforeAndHere (event=..., this=0x61c000042880) at ../git/include/wx/event.h:3892
#15 wxEvtHandler::ProcessEventLocally (this=this@entry=0x61c000042880, event=...) at ../git/src/common/event.cpp:1526
#16 0x00007ffff29b832f in wxEvtHandler::ProcessEvent (this=0x61c000042880, event=...) at ../git/src/common/event.cpp:1499
#17 0x00007ffff369f425 in wxScrollHelperEvtHandler::ProcessEvent (this=0x608000579ca0, event=...) at ../git/src/generic/scrlwing.cpp:200
#18 0x00007ffff29b84d1 in wxEvtHandler::SafelyProcessEvent (this=<optimized out>, event=...) at ../git/src/common/event.cpp:1617
#19 0x00007ffff36273e6 in wxWindowBase::HandleWindowEvent (this=this@entry=0x61c000042880, event=...) at ../git/src/common/wincmn.cpp:1539
#20 0x00007ffff33f6145 in wxWindow::GTKSendPaintEvents (this=this@entry=0x61c000042880, region=<optimized out>) at ../git/src/gtk/window.cpp:5184
#21 0x00007ffff33f63b5 in expose_event (gdk_event=0x7fffffffd380, win=0x61c000042880) at ../git/src/gtk/window.cpp:432
#22 0x00007ffff6933b46 in _gtk_marshal_BOOLEAN__BOXED (closure=0x6070006c1580, return_value=0x7fffffffcfb0, n_param_values=<optimized out>, param_values=0x7fffffffd010, invocation_hint=<optimized out>, marshal_data=<optimized out>) at gtkmarshalers.c:84
#23 0x00007ffff517a325 in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
#24 0x00007ffff518cc62 in ?? () from /usr/lib64/libgobject-2.0.so.0
#25 0x00007ffff51951d7 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
#26 0x00007ffff5195b1f in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#27 0x00007ffff6a5439c in gtk_widget_event_internal (widget=widget@entry=0x621000c35b40, event=event@entry=0x7fffffffd380) at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gtk/gtkwidget.c:5010
#28 0x00007ffff6a5474f in IA__gtk_widget_send_expose (widget=widget@entry=0x621000c35b40, event=event@entry=0x7fffffffd380) at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gtk/gtkwidget.c:4839
#29 0x00007ffff69328a2 in IA__gtk_main_do_event (event=0x7fffffffd380) at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gtk/gtkmain.c:1623
#30 0x00007ffff658b3c2 in _gdk_window_process_updates_recurse (window=window@entry=0x6250007976c0, expose_region=expose_region@entry=0x6190004aad60) at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gdk/gdkwindow.c:5479
#31 0x00007ffff658b365 in _gdk_window_process_updates_recurse (window=window@entry=0x62500079a000, expose_region=expose_region@entry=0x6190004b9d50) at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gdk/gdkwindow.c:5452
#32 0x00007ffff658b365 in _gdk_window_process_updates_recurse (window=window@entry=0x625000797ea0, expose_region=expose_region@entry=0x6190004cb0d0) at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gdk/gdkwindow.c:5452
#33 0x00007ffff658b365 in _gdk_window_process_updates_recurse (window=window@entry=0x6250004efd80, expose_region=expose_region@entry=0x61900047ab80) at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gdk/gdkwindow.c:5452
#34 0x00007ffff658b365 in _gdk_window_process_updates_recurse (window=window@entry=0x6250004ef120, expose_region=expose_region@entry=0x6190004d5090) at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gdk/gdkwindow.c:5452
#35 0x00007ffff65bbcda in _gdk_windowing_window_process_updates_recurse (window=window@entry=0x6250004ef120, region=region@entry=0x6190004d5090) at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gdk/x11/gdkwindow-x11.c:5643
#36 0x00007ffff6587d02 in gdk_window_process_updates_internal (window=0x6250004ef120) at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gdk/gdkwindow.c:5646
#37 0x00007ffff6588658 in IA__gdk_window_process_all_updates () at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gdk/gdkwindow.c:5752
#38 0x00007ffff65886b9 in gdk_window_update_idle (data=<optimized out>) at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gdk/gdkwindow.c:5372
#39 0x00007ffff6566499 in gdk_threads_dispatch (data=0x6190004cbb00) at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gdk/gdk.c:534
#40 0x00007ffff4e9a45a in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#41 0x00007ffff4e9a818 in ?? () from /usr/lib64/libglib-2.0.so.0
#42 0x00007ffff4e9ab42 in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
#43 0x00007ffff6931612 in IA__gtk_main () at /var/tmp/portage/x11-libs/gtk+-2.24.32-r1/work/gtk+-2.24.32/gtk/gtkmain.c:1270
#44 0x00007ffff33c0633 in wxGUIEventLoop::DoRun (this=0x606000c01e20) at ../git/src/gtk/evtloop.cpp:64
#45 0x00007ffff285bfbe in wxEventLoopBase::Run (this=0x606000c01e20) at ../git/src/common/evtloopcmn.cpp:90
#46 0x00007ffff281df1e in wxAppConsoleBase::MainLoop (this=0x61a00001e680) at ../git/src/common/appbase.cpp:380
#47 0x00007ffff2819907 in wxAppConsoleBase::OnRun (this=<optimized out>) at ../git/src/common/appbase.cpp:301
#48 0x00007ffff34c3180 in wxAppBase::OnRun (this=<optimized out>) at ../git/src/common/appcmn.cpp:335
#49 0x00005555556b1f75 in CodeBlocksApp::OnRun (this=0x61a00001e680) at /home/obfuscated/projects/codeblocks/git/src/src/app.cpp:870
#50 0x00007ffff28b1cd6 in wxEntry (argc=@0x7ffff2c51c30: 8, argv=<optimized out>) at ../git/src/common/init.cpp:507
#51 0x00007ffff28b29e2 in wxEntry (argc=<optimized out>, argv=<optimized out>) at ../git/src/common/init.cpp:519
#52 0x00005555556ad7d9 in main (argc=8, argv=0x7fffffffde98) at /home/obfuscated/projects/codeblocks/git/src/src/app.cpp:338
Is it expected that the plugin will display a progress dialog during memwatch update?Yes, for long operations it should display a update (wxProgress) dialog.
It seems that the performance of the x command depends on the requested size. If this is really the case (I've not tried to do some benchmarking) the plugin should have totally separate workflow.Yes it is depended... I have not optimized the plugin. I wanted first to be sure that the plugin will work with trunk codeblocks before i optimize it, add add other features (see below)
For example I have a stm32f103c8t6 in a black pill. I'm using a st link v2 clone and swd interface. I see that I can look at registers for quite a lot of peripherals which I'll probably never use and for sure I'll never use them simultaneously. So I think the plugin should have a page where I could add registers (single registers, not group of registers) and then only those registers are updated.I planned to ad a favorite tab where you can add your needed registers
Also I think the current mode of updating only the expanded registers is not really user friendly. Probably you could use the third column to add a checkbox or make a custom property which have a checkbox somewhere. This checkbox or special toggle bitmap button if possible should be used to specify if the register is autoupated or not.see the above. I think the normal workflow should be to add them to your favorites...
General notes about the source code:Thank you, i will try to implement them as soon as i find time...
And a bug report:would be nice if you could put them in github issue tracker...
Yes it is depended... I have not optimized the plugin. I wanted first to be sure that the plugin will work with trunk codeblocks before i optimize it, add add other features (see below)But doing it like that we'll have a chicken/egg problem, because I'm looking at the pluign to find the best way to design the API. 8) As you probably know I don't like the pause/continue patch. So I want to find a better solution.
Yes it is depended... I have not optimized the plugin. I wanted first to be sure that the plugin will work with trunk codeblocks before i optimize it, add add other features (see below)But doing it like that we'll have a chicken/egg problem, because I'm looking at the pluign to find the best way to design the API. 8) As you probably know I don't like the pause/continue patch. So I want to find a better solution.
Do you want to be able to cancel the update of multiple mem-watches? Do you think this works now?If it is possible it would be nice... But does GDB let you do it? What do you mean by "now" ?
Can you draw an image of your idea of the api? What do you mean by separate workflow?
If it is possible it would be nice... But does GDB let you do it? What do you mean by "now" ?"Now" means your current implementation in your repo.
If you work on this, you can also think about an api to send general commands to the debugger, something like a queue ;)I don't want to think about such API. This would never work reliably. I've stated this multiple times. If something needs to send commands to the debugger it would be a lot easier to make it a part of the debugger plugin than to make it an external plugin which talks to the debugger.
The current behaviour uses the pause event to know when a command has finished. As expressed in multiple places. This is a bad idea, because it ties your plugin to the current implementation of the debugger plugin.Ok, i understand this, and i am completely on your side about this. Currently it is a bad implementation, but i used what was present (and not implemented xD, only the defines where there )
What I want to do is to provide a call like:If i understand you correctly (i think it today is to late for me to discuss this properly) the debugger plugin sends an event when all (one) MemWatch is updated from the debugger? This is a nice implementation. One event pro watch would be cool, so we can update all windows continuously (for example if the memory window uses also MemoryWatches). How do you pass what watch has been updated to the event? Some kind of id? The pointer address? From this point one event for all watches would be more easy. I have no strong opinion about this....
UpdateMemWatches which is called from your plugin.
This call would send an event when one/all mem watches are updated.
Not sure if separate events are useful, but probably you can tell me. 8)
"Now" means your current implementation in your repo.I have no strong opinion about the cancel.. If it is needed the plugin can remove the watch with the implemented api call and then ignore the event. What the debugger plugin does with this is a other point. As far as i can see we can not stop gdb so we should not waste time on this...
By cancel I mean cancel execution of the next command. I doubt it is possible to cancel commands. In the terminal you can press ctrl-c, but I doubt this would be reliable. It could be tested, but I prefer to spend time doing work on gdb/mi than this.
I don't want to think about such API. This would never work reliably. I've stated this multiple times. If something needs to send commands to the debugger it would be a lot easier to make it a part of the debugger plugin than to make it an external plugin which talks to the debugger.ok. i do not want to recook this whole topic. Some last question:
If i understand you correctly (i think it today is to late for me to discuss this properly) the debugger plugin sends an event when all (one) MemWatch is updated from the debugger? This is a nice implementation. One event pro watch would be cool, so we can update all windows continuously (for example if the memory window uses also MemoryWatches). How do you pass what watch has been updated to the event? Some kind of id? The pointer address? From this point one event for all watches would be more easy. I have no strong opinion about this....This sound too generic. For now I think I'll concentrate on memory watches only. If it works well we could port this to other parts.
Some last question:What does "remote reset" mean in the first place? How do you do it? Is it different for different mcus? How often do you need to do it?
How do you think it is possible to send "remote reset" to the debugger from within codeblocks? Some toolbar button would be nice. There are other "remote" commands, like uploading new code ecc... This is essential for debugging embedded systems properly...
cbDebuggerPlugin *dbg = Manager::Get()->GetDebuggerManager()->GetActiveDebugger();
cbDebuggerPlugin *plugin = Manager::Get()->GetDebuggerManager()->GetDebuggerHavingWatch(watch);
diff --git a/src/plugins/debuggergdb/gdb_driver.cpp b/src/plugins/debuggergdb/gdb_driver.cpp
index e844ad69d..f4797e563 100644
--- a/src/plugins/debuggergdb/gdb_driver.cpp
+++ b/src/plugins/debuggergdb/gdb_driver.cpp
@@ -692,14 +692,18 @@ void GDB_driver::UpdateWatches(cb::shared_ptr<GDBWatch> localsWatch, cb::shared_
void GDB_driver::UpdateMemoryRangeWatches(MemoryRangeWatchesContainer &watches)
{
+ bool updateWatches = false;
for (cb::shared_ptr<GDBMemoryRangeWatch> &watch : watches)
{
if (watch->IsAutoUpdateEnabled())
{
QueueCommand(new GdbCmd_MemoryRangeWatch(this, watch));
- QueueCommand(new DbgCmd_UpdateWindow(this, cbDebuggerPlugin::DebugWindows::MemoryRange));
+ updateWatches = true;
}
}
+
+ if(updateWatches)
+ QueueCommand(new DbgCmd_UpdateWindow(this, cbDebuggerPlugin::DebugWindows::MemoryRange));
}
void GDB_driver::UpdateWatch(const cb::shared_ptr<GDBWatch> &watch)
codeblocks->codeblocks->arm_gdb->arm_gdb_server
codeblocks->arm_gdb->arm_gdb_server
On windows any gdb which supports python is setup to start two executables gdb and gdb_orig...I think only GDB supplied from mingw-w64(original name is mingw-build) has such two gdb executables. I don't know why they need such changes, maybe they want to load the python pretty printer automatically by the proxy-gdb.