Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: wtherapy on September 15, 2007, 10:28:03 am

Title: Automatically dereference pointers in watch window
Post by: wtherapy on September 15, 2007, 10:28:03 am
Please, implement the watch window as it is implemented in all the other debuggers, WinDbg, KDbg, Visual Studio: when you have a pointer, display it's value with a + sign in the left, then the user expands and sees the data referenced by the pointer. In the current implementation I need to separately dereference the pointer, thereby adding a lot of entries in the watch window.
Title: Re: Automatically dereference pointers in watch window
Post by: Roman on September 19, 2007, 08:34:17 pm
vote++

Roman
Title: Re: Automatically dereference pointers in watch window
Post by: XayC on September 19, 2007, 09:33:24 pm
I've made a patch, actually it simply removes the old watch, when it is dereferenced.
Code
--- src/plugins/debuggergdb/debuggertree.cpp    (revision 4481)
+++ src/plugins/debuggergdb/debuggertree.cpp    (working copy)
@@ -757,7 +757,12 @@
     WatchTreeData* data = static_cast<WatchTreeData*>(m_pTree->GetItemData(m_pTree->GetSelection()));
     Watch* w = data ? data->m_pWatch : 0;
     if (w)
+    {
         m_Watches.Add(Watch(_T('*') + w->keyword));
+
+        DeleteWatch(w);
+        m_pTree->Delete(m_pTree->GetSelection());
+    }
     else
     {
         wxString itemtext = m_pTree->GetItemText(m_pTree->GetSelection());

Regards, XayC
Title: Re: Automatically dereference pointers in watch window
Post by: wtherapy on October 06, 2007, 07:12:16 am
Hello,

that's good news, how can I use it now? Because I have build 4503 and still the same display.
Title: Re: Automatically dereference pointers in watch window
Post by: XayC on October 06, 2007, 10:34:11 am
I'm still working on it, trying to implement what you actually requested. I didn't put that patch in the patch-manager (because it's a pretty trivial change), so it's not going to be merged in the svn trunk.
If you want to try that patch you have to apply it on a local copy of CB sources and compile them. And there's also another problem, if you try to dereference a pointer which is either in the Local Variables or in the Function Arguments, the item would be removed.

Regards, XayC
Title: Re: Automatically dereference pointers in watch window
Post by: KammutierSpule on November 21, 2010, 07:22:14 pm
why this feature isn't already implemented?! :|
Title: Re: Automatically dereference pointers in watch window
Post by: oBFusCATed on November 21, 2010, 11:04:48 pm
Two reasons:
1. it is hard, because C::B uses the command line protocol of gdb and there is no direct way.
2. it will be slow, the same reason

You're welcome to give it a try, but make patch against the debuggers branch, not trunk.
There are lots of changes related to the watches in the branch.
Title: Re: Automatically dereference pointers in watch window
Post by: Max on November 22, 2010, 07:29:53 pm
I'm wondering why there are still two different version (trunk and debugger branch). It may be true the debbuger branch has bugs but it's better (much better) that the debuuger plugin (that  has bugs) used in the trunk. Moreover splitting the development is decreasing the number of people using (and so debugging) the new debugger interface. We are no longer in the early development stage.

IMHO obviously  :D

Max
Title: Re: Automatically dereference pointers in watch window
Post by: oBFusCATed on November 22, 2010, 07:51:13 pm
It may be true the debbuger branch has bugs.
I don't know about bugs, probably you could report the ones you've found? :)

The development is not split, in fact no development  is done on the debugger plugin in trunk.
Also, as I've stated many times, there is a pending patch for review, then we will have a nightly and probably then a merge will happen...