Author Topic: DDD-like watches  (Read 26916 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12125
    • Travis build status
Re: DDD-like watches
« Reply #30 on: March 17, 2011, 03:24:43 pm »
But I plan to add functionality that allows assign variable to array. Variable that store the array size. If there is realloc in program, it would be good to assign variable storing the size of array and this array will have correct size whole time. Now I must every time change size in context menu according to new reallocated size. In my school C::B is used as additional teaching aid and this could be good for beginners but not only for them.
I'm not sure I understand what you are talking about, but it sounds like something uses, at least in the C++ world.
Also this seems like a task for the real debugger (GDB/CDB), not the debugger front end (C::B).

Edit: uses, should have been useless... :(
« Last Edit: March 17, 2011, 10:01:59 pm by oBFusCATed »
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12125
    • Travis build status
Re: DDD-like watches
« Reply #31 on: March 17, 2011, 10:02:55 pm »
1) I don't like waiting and I did some test. Here is relevant screen. As you can see from log, structure type would be HWND__* and value 0x0000000. But it is wrong in the watches window. For similar class is everything fine.
In SVN, with some modifications to the tests (you've not run them!)  :lol:
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12125
    • Travis build status
Re: DDD-like watches
« Reply #32 on: March 17, 2011, 11:34:38 pm »
3. If it works, OK, I'll give it a try...
Still broken here :(

Quote
> whatis output
Attempt to take contents of a non-pointer value.
>>>>>>cb_gdb:
> output output
(const wxString &) @0x7fffffffb5f0: {
  <wxStringBase> = {
    m_pchData = 0x1ef5e18 L"Reading symbols from /home/obfuscated/projects/tests/_cb_cc/call_tip/bin/debug/call_tip...done."
  }, <No data fields>}>>>>>>cb_gdb:

Put a breakpoint in GDB_Driver::ParseOutput and add the parameter output in the watches...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12125
    • Travis build status
Re: DDD-like watches
« Reply #33 on: March 22, 2011, 01:14:19 am »
4) In GdbCmd_FindWatchType class there was "whatis &" instead of "whatis " string used to finding type of watch and then tmp.substr(0, tmp.length() - 1); used to removing last "*". But this was bad for arrays or functions:
  • int (*)[4] -> int (*)[4
  • int (*)(int) -> int (*)(int
  • ...
This should be fixed in svn, can you test it?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline m.29

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: DDD-like watches
« Reply #34 on: March 22, 2011, 11:12:27 am »
Pointers on structures in CDB is good now. But tests in debuggergdb_test_parser_cdb.cpp are wrong. Results would be t*=0x123456 instead of t=0x123456, because of inputs are pointers.

GdbCmd_FindWatchType gives correct types. Thanks. I wrote different patch for it. Next time I will faster :)

I'm not sure I understand what you are talking about, but it sounds like something useless, at least in the C++ world.
Also this seems like a task for the real debugger (GDB/CDB), not the debugger front end (C::B).
Yes, it's really task for GDB and GDB supports it. It is called Array slices. I tried to find similar functionality in CDB debugger, but I think it is not implemented there.

Sorry for my late answers - I was busy by my another school projects.
Windows XP SP3, wxWidgets 2.8.11, C::B DEBUGGER BRANCH nightly builds

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12125
    • Travis build status
Re: DDD-like watches
« Reply #35 on: March 22, 2011, 01:22:20 pm »
Pointers on structures in CDB is good now. But tests in debuggergdb_test_parser_cdb.cpp are wrong. Results would be t*=0x123456 instead of t=0x123456, because of inputs are pointers.
No, the test are correct, but the parser is broken if it returns t*=0x123456.
The tests work correctly on linux. I've not tried them on windows, probably I must do so in the next couple of days.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline m.29

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: DDD-like watches
« Reply #36 on: March 23, 2011, 10:21:12 am »
Sorry, I changed GetSymbol with GetType. I tried it on Ubuntu, and it works correctly.
I resolved all collisions in my sources and created patch. Every feedback will be appreciated. Thanks for your time :D
Windows XP SP3, wxWidgets 2.8.11, C::B DEBUGGER BRANCH nightly builds

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12125
    • Travis build status
Re: DDD-like watches
« Reply #37 on: March 23, 2011, 10:50:04 am »
Why do you have GUI code in the plugin?
And why do you need AddVisualObject and DeleteVisualObject (probably because of the previous :) )?
Probably a better way is to use watches directly, so then your implementation will be common for all debugger plugins.
At the moment every plugin should reimplement your tree controls in order to implement this feature.

You should modify the watches, to mark them non visible in the Watches windows, but I think this is minor problem at the moment.
For testing purposes you can have them duplicated in both windows (Watches window and your new window).

p.s. For doing GUI the official way is through the use of wxSmith.
p.p.s. I was thinking if it would be possible to implement this whole visible debugging as a separate plugin, so its impact on C::B is minimal. What do you think?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline m.29

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: DDD-like watches
« Reply #38 on: March 23, 2011, 12:16:48 pm »
Hmm, because I have to display data structures? :? What other way is possible to display them? Or what is it wrong specifically?

Every plugin can implement this methods (AddVisualObject and DeleteVisualObject), and then create your own visual representation of watch. This representation will be created then by calling this method.

My idea was, that every plugin can implement your own representation of watch, which will be displayed on the canvas. My representation is tree control, but some other plugin can implement it other way.

This is great idea. I can try it :) But what is major problem then?

ad p.s. I tried to do things similar to nearest code. I read articles about formatting and other advices in C::B, but I saw that every piece of code has his own formatting and logic. I write GUI in xrc instead of wxs because all other windows was written in this format. This is what you point to? I can read about wxSmith, but I don't know where should I use it.

ad p.p.s. I was also thinking this way, but I followed by your advise:
m.29:
Probably you need to modify the sdk and put most of the drawing code and data structures there.
If you do so all plugins can implement this graphical mode, not only the current one and there will be minimal code duplication.
See how it is done for the other features (watches, breakpoints, etc).
I look at how it is done for watches and then create similar cbVisualObject. I tried implement it as a separate plugin, but I don't know how, because I want to add functionality to GDBDebugger and I haven't access to its structures (e.g.: GDBWatch) in separate plugin.
« Last Edit: March 23, 2011, 12:18:23 pm by m.29 »
Windows XP SP3, wxWidgets 2.8.11, C::B DEBUGGER BRANCH nightly builds

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12125
    • Travis build status
Re: DDD-like watches
« Reply #39 on: March 23, 2011, 01:38:53 pm »
Hmm, because I have to display data structures? :? What other way is possible to display them? Or what is it wrong specifically?
Why don't you use cbWatch as your data structure?
This was my initial idea.

Every plugin can implement this methods (AddVisualObject and DeleteVisualObject), and then create your own visual representation of watch. This representation will be created then by calling this method.

My idea was, that every plugin can implement your own representation of watch, which will be displayed on the canvas. My representation is tree control, but some other plugin can implement it other way.
No, you want the drawing and control code to be common for all plugins. The plugins should implement only data gathering.
See the MVC pattern. The View and the Controller should be common in the SDK or in additional plugin. Only the model should be implemented by debugger plugins.

ad p.s. I tried to do things similar to nearest code. I read articles about formatting and other advices in C::B, but I saw that every piece of code has his own formatting and logic. I write GUI in xrc instead of wxs because all other windows was written in this format. This is what you point to? I can read about wxSmith, but I don't know where should I use it.
True, most of the GUI is done using XRC, but this has/had happened before wxSmith.

ad p.p.s. I was also thinking this way, but I followed by your advise:
m.29:
Probably you need to modify the sdk and put most of the drawing code and data structures there.
If you do so all plugins can implement this graphical mode, not only the current one and there will be minimal code duplication.
See how it is done for the other features (watches, breakpoints, etc).
I look at how it is done for watches and then create similar cbVisualObject. I tried implement it as a separate plugin, but I don't know how, because I want to add functionality to GDBDebugger and I haven't access to its structures (e.g.: GDBWatch) in separate plugin.
You've not followed it, because you have GUI in the plugin and if you look at this http://forums.codeblocks.org/index.php/topic,10908.0.html topic you'll see that I've tried to extract the GUI from the plugin.

What info do you need in GDBDebugger or GDBWatch that is not accessible through the SDK interfaces cbDebuggerPlugin and cbWatch?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline m.29

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: DDD-like watches
« Reply #40 on: March 24, 2011, 04:04:54 pm »
I know what you mean now. My idea was the opposite, but I see this could be much better. So I will refactor my code and provide new patch.

What info do you need in GDBDebugger or GDBWatch that is not accessible through the SDK interfaces cbDebuggerPlugin and cbWatch?
I think only methods in GDBWatch:
  • IsArray
  • GetArrayStart
  • GetArrayCount
  • GetIndex added by me
I know that in other languages (Python, ...) there are no arrays, but this methods could be more abstract like IsContainer, ... and added to cbWatch. What do you think about this idea?
Windows XP SP3, wxWidgets 2.8.11, C::B DEBUGGER BRANCH nightly builds

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12125
    • Travis build status
Re: DDD-like watches
« Reply #41 on: March 24, 2011, 04:37:08 pm »
Why do you care if the object is a container?
The cbWatch is a node in a tree, in fact, so if there are children the object is container somehow...

For example: if you have a watch object for an array: the elements of the array would be added as children cbWatch objects to the array cbWatch object.

Your drawing/visualizing code should only traverse the tree (asking every node in the three for its properties), see how it is done in the Watches window.
The drawing/visualizing should not care what the type of the watch is.
Probably we could add some hints, but I think it is doable without them.

p.s. IsContainer is hardly implementable in the DebuggerPlugin, because the Watch properties dialog is implemented in the plugin, not in the SDK.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline m.29

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: DDD-like watches
« Reply #42 on: April 09, 2011, 11:25:59 pm »
I cared about that because I wanted to use another visualization for arrays (see image). But I write my own method to determine if watch is array. I check if children's symbol contains [ character :-|

I re-factored my code and moved sources to SDK. I think there is only model in the plugin. I'm posting my patch here in next few days. Hope you'll find time to check it and will give me the feedback on it. And thanks for the previous feedback :)

[attachment deleted by admin]
Windows XP SP3, wxWidgets 2.8.11, C::B DEBUGGER BRANCH nightly builds

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12125
    • Travis build status
Re: DDD-like watches
« Reply #43 on: April 09, 2011, 11:37:48 pm »
Great, I'm waiting for the patch :)
Hope it runs on linux  :lol:
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline m.29

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: DDD-like watches
« Reply #44 on: April 16, 2011, 04:08:22 pm »
So I did the most of my TODOs and tried the patch on Ubuntu. On Ubuntu I found modifications like this one in patch:
Code: [Select]
@@ -232,7 +232,7 @@
  </Linker>
  </Target>
  <Target title="Compiler depslib">
- <Option output="plugins/compilergcc/depslib/depslib" prefix_auto="1" extension_auto="1" />
+ <Option output="plugins/compilergcc/depslib/libdepslib" prefix_auto="1" extension_auto="1" />
  <Option working_dir="" />
  <Option type="2" />
  <Option compiler="gcc" />
I don't know what is it and why is there. Because of this there are not included modifications in "CodeBlocks-unix.cbp" file so on linux you need to add 10 files to project.

src/include/arraypanel.h
src/include/viewnode.h
src/include/viewvector.h
src/include/visualwatchesdlg.h
src/include/visualobject.h

src/sdk/arraypanel.cpp
src/sdk/viewnode.cpp
src/sdk/viewvector.cpp
src/sdk/visualwatchesdlg.cpp
src/sdk/visualobject.cpp

Hope it is not complication for you. I'm waiting for your feedback :-)
Windows XP SP3, wxWidgets 2.8.11, C::B DEBUGGER BRANCH nightly builds