Author Topic: Show debugging information on hover  (Read 26876 times)

Offline shirsoft

  • Single posting newcomer
  • *
  • Posts: 9
Show debugging information on hover
« on: May 06, 2010, 02:31:20 am »
Hi guys,

I recently checked out code blocks and it seems really nice. Best thing is it is intuitive and easy to use. A lot of effort must have gone behind this simplicity.

I was thinking of showing debugging information for variables when the mouse hovers on them. Ofcourse this would work only during debugging.
It resembles the idea first introduced in MSVC 2005(i might be wrong).

I use this feature in VS a lot, compared to the old way, where we need to add the variables to the watch, or scroll through it.

Do you think this would be useful for C::b and its users?

Another idea I had was visualizing a chunk of memory as 2d image. This is particularly useful when dealing with image processing algorithms. (I have been through a lot of frustrating experiences while debugging pixel by pixel)

-Thanks!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show debugging information on hover
« Reply #1 on: May 06, 2010, 03:24:57 am »
Hi guys,

I recently checked out code blocks and it seems really nice. Best thing is it is intuitive and easy to use. A lot of effort must have gone behind this simplicity.

I was thinking of showing debugging information for variables when the mouse hovers on them. Ofcourse this would work only during debugging.
It resembles the idea first introduced in MSVC 2005(i might be wrong).

I use this feature in VS a lot, compared to the old way, where we need to add the variables to the watch, or scroll through it.

Do you think this would be useful for C::b and its users?
There is a simple version of this feature already implemented: Settings -> Compiler & Debugger -> Debugger -> Evaluate expression under the cursor
For the future a better version could be implemented but it depends if wxWidget could do it -> someone should do test if it is possible

Quote
Another idea I had was visualizing a chunk of memory as 2d image. This is particularly useful when dealing with image processing algorithms. (I have been through a lot of frustrating experiences while debugging pixel by pixel)
It is possible but someone should do it (it might be slow)

p.s. if you what a better debugging capabilities look at the debugger branch in svn
(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 shirsoft

  • Single posting newcomer
  • *
  • Posts: 9
Re: Show debugging information on hover
« Reply #2 on: May 06, 2010, 03:33:02 am »
I had a look and it looks quite nice.
depends if wxWidget could do it -> someone should do test if it is possible

Which feature of wxWidgets do you wish to be tested?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show debugging information on hover
« Reply #3 on: May 06, 2010, 03:40:33 am »
We need some control that looks like the one used in VS...

In the debugger branch C::B is moved to a wxPropGrid control for the watches window.
There was an idea to use the same control (wxPropGrid) for the tooltip.

1. Test if it is possible to put wxPropGrid in a wxTipWindowBase (see gdb_tipwindow.h/cpp for details)
2. Is it possible to make it autosizing (expanding/collapsing to change the size of the tip window)
3. Does it work on all platforms windows,linux,macos (reliably!)
« Last Edit: May 06, 2010, 01:48:34 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 shirsoft

  • Single posting newcomer
  • *
  • Posts: 9
Re: Show debugging information on hover
« Reply #4 on: May 06, 2010, 03:42:14 am »
alright, I'll have a look. My quarter is going on so its a bit tough to find a lot of time but summers for sure!


Offline shirsoft

  • Single posting newcomer
  • *
  • Posts: 9
Re: Show debugging information on hover
« Reply #5 on: May 06, 2010, 11:43:19 am »
I gave it shot without using the tip window base and property grid. I don't think property grid would support icons.
The file can be found here : http://ul.to/6tthfi

The app shows a piece of code in an inactive textbox. When you click on 'Hover Test' button, it simulates as if the mouse has been hovering the variable 'sph'. Rest is somewhat like visual studio.
Additionally one can edit values of variables which don't have any childs, similar to visual studio.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show debugging information on hover
« Reply #6 on: May 06, 2010, 01:50:04 pm »
Can't run (and wouldn't run if I was) exe files (I'm on linux).
Can you provide some compilable source code or a simple screenshot?
(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 shirsoft

  • Single posting newcomer
  • *
  • Posts: 9
Re: Show debugging information on hover
« Reply #7 on: May 06, 2010, 05:19:43 pm »
Sure, I have uploaded the screenshot to imageshack: http://img695.imageshack.us/i/debugo.png/

I don't have a makefile for the linux version of the code (I am still used to VS) but I can upload the code
if you wish to see.

There's not much to the code. I use a custom control in place of a property grid and frameless dialog instead of
the 'tip window base'

The custom control has these properties
1. bool suggesting whether its expandable or not
2. Name of the attribute being displayed.
3. Icon for the attribute
4. Value of the attribute as a string

The dialog window has a list of these custom controls, one for each attribute

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show debugging information on hover
« Reply #8 on: May 06, 2010, 05:39:40 pm »
Ah, looks good :)

Can the user edit the value of variables (like in VS)?
For example can he/she make x to be equal to 100, y = 21?

If the control can do that I can test it on linux (don't worry for the compilation :) )
(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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Show debugging information on hover
« Reply #9 on: May 06, 2010, 05:49:19 pm »
The file can be found here : http://ul.to/6tthfi
I am unable to download this file (tried several computers).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show debugging information on hover
« Reply #10 on: May 06, 2010, 06:05:29 pm »
Morten: here I've mirrored it: http://smrt.is-a-geek.org/codeblocks/DebugViz.rar (don't blame me if your computer dies in fire!)
(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 shirsoft

  • Single posting newcomer
  • *
  • Posts: 9
Re: Show debugging information on hover
« Reply #11 on: May 06, 2010, 06:12:42 pm »
Can the user edit the value of variables (like in VS)?

Yes it can. Basically the control displays a textbox when ever the values are editable.
It doesn't do any validation. Ideally I would have an observer pattern which notifies the
'datamodel' to do the validation. I think MVC would fit in nicely here.

An optimization would be to share the textbox across all instance of the custom control
since only textbox can be editable at any given time.

I am unable to download this file (tried several computers).
Strange, I am able to access it. May be its something do with the shortened version of uploaded.to to ul.to
Anyways, I have uploaded the code to a google code http://code.google.com/p/debugviz11/source/browse/#svn/trunk

A release exe is checked in too

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show debugging information on hover
« Reply #12 on: May 06, 2010, 07:07:45 pm »
Ok, have it compiled, after the addition of some wxT(), here and there.

The usage of wxDialog is a no go on linux -> the wxDialog always has a border/caption.

Also you should implement the automatic closing of the dialog yourself, wxTipWindow seems to do it for you.
I've tried to port it to wxTipWindow, but I've got a crash...

Can you try to port it to wxTipWindow, or something that is 100% sure that will have no border on linux?
Also can you make the windows to collapse/hide automatically?

This is a good start, but the harder part is to be done: making the control work  :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 shirsoft

  • Single posting newcomer
  • *
  • Posts: 9
Re: Show debugging information on hover
« Reply #13 on: May 06, 2010, 08:52:30 pm »
I'll play around in linux and see how it goes.

Personally I would like the main popup window to go away when it looses focus or something,
but would like the child windows to be shown or hidden only by clicking on the + icon.

Offline shirsoft

  • Single posting newcomer
  • *
  • Posts: 9
Re: Show debugging information on hover
« Reply #14 on: May 07, 2010, 09:58:36 pm »
The usage of wxDialog is a no go on linux -> the wxDialog always has a border/caption.

I remember facing that issue on linux a few months ago, however running this code on ubuntu 9.10 with wxWidgets 2.8 and it works fine.
The dialog doesn't have a border!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show debugging information on hover
« Reply #15 on: May 08, 2010, 02:45:53 am »
Try Enlightenment DR17 and it will have border :)
(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 shirsoft

  • Single posting newcomer
  • *
  • Posts: 9
Re: Show debugging information on hover
« Reply #16 on: May 09, 2010, 11:21:02 am »
How about wxFrame? I seem to be able to get rid of the frame.
Is wxFrame generic enough to show similar behavior on other OS's too?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show debugging information on hover
« Reply #17 on: May 09, 2010, 01:09:53 pm »
Commit your changes to googlecode and I can test them...
(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 cbexaminr

  • Multiple posting newcomer
  • *
  • Posts: 104
Re: Show debugging information on hover
« Reply #18 on: August 19, 2010, 03:19:27 pm »
Morten/obfus/others,

Anybody still working on this?  If not, I may explore it some.  (I might anyway, while awaiting a reply.)


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show debugging information on hover
« Reply #19 on: August 19, 2010, 03:27:01 pm »
I'm not working on 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 cbexaminr

  • Multiple posting newcomer
  • *
  • Posts: 104
Re: Show debugging information on hover
« Reply #20 on: August 21, 2010, 05:58:11 am »
Anybody want to give this a try?  (windows only tried thus far by me)

Its progressively based on shirsoft's code (hence is just a DEMO, not integrated into codeblocks), and contains a lot of junk that shows or at least hints at the variations I went through to arrive at what's here.  Not perfect, but I think better than when I started.  Mouse hover over the '+' will open descendants - leaving current will generally close it if it has no descendants.  To close cleanly, each descendant must be exited thru its ancestor, or a return to current top then leaving must be repeated for each level.  Once the user is trained, it works great ;).

Feature still lacking is some means of adding a scroll bar when the number of items for a given entity "level" won't fit on screen.  (Don't know if horizontal scroll might also eventually be needed due to excessive length of any single item.)  Since the existing release implementation doesn't seem to allow for such vertical scrolling I don't feel too bad about that yet.


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show debugging information on hover
« Reply #21 on: August 21, 2010, 12:02:15 pm »
Looks good, no border on E17 which is great :)

There are some bugs:
1. When I hover over + for the sph entry the second level opens, then I hover over the second level and then move my mouse out of both levels, the result is that only the second level is closed.
2. You can show the second level when the first level is closed.

Looking at the code the positions of the windows are calculated in advance, but I think the should be calculated when the level is about to be shown.
Also this control should support scrolling: http://farm1.static.flickr.com/174/416944134_f4d123e9bc_o.png
(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 cbexaminr

  • Multiple posting newcomer
  • *
  • Posts: 104
Re: Show debugging information on hover
« Reply #22 on: August 22, 2010, 08:16:56 pm »
1)Since its apparently too hard to train my users, here's an attempt that may require less training.

2)Do you know what the control is in that image?  Is that an image of a wxwidets application? Or were just suggesting that an effort should be made to create a control that resembles that image?


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show debugging information on hover
« Reply #23 on: August 22, 2010, 08:37:23 pm »
2)Do you know what the control is in that image?  Is that an image of a wxwidets application? Or were just suggesting that an effort should be made to create a control that resembles that image?
Hm, it seems that you haven't used Visual Studio >=2005.
The screenshot is from their implementation of the Debug hover window and I suppose it is done with win32 api only (another possibility is .net but I doubt).

p.s. will test the new version in a minute...

Edit:
Now it is way better than before, it is closing a bit too fast when the mouse leaves the window, but this should be fixable with some tweaking.
Can you implement the scrolling behaviour?
« Last Edit: August 22, 2010, 08:43:32 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 cbexaminr

  • Multiple posting newcomer
  • *
  • Posts: 104
Re: Show debugging information on hover
« Reply #24 on: September 07, 2010, 09:05:10 pm »
FWIW,

soso news
I have implemented rudimentary scrolling, and I have it integrated into (checkout of) CB wxpropgrid_debugger branch, using the GDBWatch entities.  (I didn't actually get scrolling implemented in the demo, because it was going to require too much throw away framework for data structures, since a specific one was going to need to be supported.  Hence the move to integration into CB branch.)

bad news
It doesn't work nearly as smoothly integrated into the whole as it seemed to in the much smaller demo program, even after a number of "hacks" attempting to address the various visual, and some not-so-visual, issues I have encountered.

(obfuscated, others) Do you want me to bother attempting to post a patch in its current state.  (The code is quite dirty at the moment, as it has my "running history" of the various things I've tried.  It only contains code added to gdb_tipwindow.<cpp,h>, (all classes lifted from the demo, not mods to existing tipwindow stuff), and slight change to gdb_commands.h to invoke it. [well, excepting all the update.bat files that are not winxp sp2 compatible, at least in terms of line-endings, that I changed when I originally obtained and built the branch])

I am currently a bit frustrated, but have not yet given up entirely.  I'm not sure when that might change, based on available resources and other priorities.

ps - it currently does have borders around the frames, as with default (editor) colors on my winxp mach, it was very hard to see without them.  This is currently a minor difference of a flag passed to the underlying frame-descendant constructors.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Show debugging information on hover
« Reply #25 on: September 09, 2010, 09:32:39 pm »
Post your patch, more eyes see better :)
If you can clean your patch it will be great, if not so be 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 cbexaminr

  • Multiple posting newcomer
  • *
  • Posts: 104
Re: Show debugging information on hover
« Reply #26 on: September 17, 2010, 08:26:50 pm »
current experimental development patch against svn 6604, wxpropgrid_debugger branch.

[edit: note, I had to modify eol properties to get svn to diff it... I don't know what implications are of that for applying this.]

obfusc, have a look when you can.  This may be closer to a starting point than I was before.  The approach is somewhat modified as to point in hierarchy where timer is managed from original demo (and my original point of major frustration.) On (MSW) wxwidgets, I have a timer that seems to be stopping of its own accord (which led me to the gdb/c::b file/path issues noted elsewhere), which I think I've currently hacked around, but would like to find as it may be either a wxwidgets or codeblocks issue of some sort.  Remember, there are borders currently, there's two lines in tipwindow.h that can be swapped, borders are a difference of (currently) a compilation flag.  Number of rows displayed is currently "default"ed to two (plus possible scroll items), but that is constructor value also (envision something like 10 maybe being a medium, maybe user should eventually be allowed some flexibility to choose within limits.) And code is cleaner than when I posted before, but still very much experimental with some retained "history".

Data display is not good, just whatever default comes in GDBValue, which seems a little strange particularly for array of char (don't seem to be any children for array of char.) At any rate, data value display/editing could benefit from a lot of add'l work.  Width of displayed items prob. will require changes too, some adjustment made relative to entity names, but not for data values.

Also can envision desireable possibility of "tack"ing items so that several might be brought up quickly and held, rather than just current single.  (I personally have never faired too well using the "watch" window functionality in debuggers.)

A "history" snapshot/logging function might be pleasant to have as well.  (Until some of this effort I wasn't aware of gdb's "history" value retention from print.)

And I can imagine a little more as well.  (Such as something along the lines of what I think gdb's "watchpoints" can accomplish, breaking briefly to report some state and then continuing - but that's not really part of tips.)

But, I guess the base needs to be there first...
« Last Edit: September 17, 2010, 08:44:32 pm by cbexaminr »