Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367197

Summary: Very inefficient presentation in detail section of the Variables view
Product: [Tools] CDT Reporter: Phil Mason <pmason>
Component: cdt-debug-dsfAssignee: Project Inbox <cdt-debug-dsf-inbox>
Status: NEW --- QA Contact: Jonah Graham <jonah>
Severity: enhancement    
Priority: P3 CC: cdtdoug, eclipse.sprigogin, marc.khouzam
Version: 8.1.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:
Attachments:
Description Flags
Patch that adds a menu item to limit NumberFormatDetailPane to only details.
none
Patch to implement first run at feature
none
Updated patch that resolves an issue in previous patch none

Description Phil Mason CLA 2011-12-20 10:00:03 EST
Created attachment 208621 [details]
Patch that adds a menu item to limit NumberFormatDetailPane to only details.

If several members of an array of structures are selected the detail pane currently shows:

Name : tempStruct[0]
                Details:{a = 2, b = 3}
                Default:{...}
                Decimal:{...}
                Hex:{...}
                Binary:{...}
                Octal:{...}
Name : tempStruct[1]
                Details:{a = 3, b = 7}
                Default:{...}
                Decimal:{...}
                Hex:{...}
                Binary:{...}
                Octal:{...}

Which contains a lot of lines that don’t supply much information and make comparisons harder. It would be nice to have the ability to simplify the display to only show details giving this:

Name : tempStruct[0]
                Details:{a = 2, b = 3}
Name : tempStruct[1]
                Details:{a = 3, b = 7}
Name : tempStruct[2]
                Details:{a = 5, b = 31}

Or even better

Name : tempStruct[0]    Details:{a = 2, b = 3}
Name : tempStruct[1]    Details:{a = 3, b = 7}
Name : tempStruct[2]    Details:{a = 5, b = 31}

Attached is a patch that adds a menu item to the pulldown menu for variable, expression and register view that adds this functionality. 

At present the new menu item doesn't cause the detail pane to redraw as I'm not sure how to add that functionality. If someone can suggest where to start then I'm happy to add that.
Comment 1 Marc Khouzam CLA 2011-12-20 10:09:13 EST
I really like this feature, so I jumped on the patch to try it out :-)

It does not apply cleanly.  I see things like:
"Philm Number Format"
"com.broadcom.cdt.debug.dsf.ui.debugDetailsCommand"

on the 'old' side of the diff.  Makes me thing the patch is not made against master :-)

Be aware that when creating a patch using EGit, it will only create a patch between the selected commit and the previous one.  If you have done multiple commits, you will need to merge them into a branch to obtain one commit.  Or you could squash them (I haven't done that before).  Or, you could do a SOFT reset of your branch to the last commit before you changes (should keep all changes un-committed in your workspace), the do a single commit.
Comment 2 Marc Khouzam CLA 2011-12-20 10:10:29 EST
Sorry about all the typos.  I think my keyboard is broken :-)
Comment 3 Phil Mason CLA 2011-12-20 10:14:08 EST
(In reply to comment #1)

> It does not apply cleanly.  I see things like:
> "Philm Number Format"
> "com.broadcom.cdt.debug.dsf.ui.debugDetailsCommand"

< slaps forehead and attaches the patch I meant to use...>

Sorry about that. I think that the new patch should be better. I pulled a clean version of head and merged it this morning and it went in OK.

Let me know if you still have problems.
Comment 4 Phil Mason CLA 2011-12-20 10:14:50 EST
Created attachment 208624 [details]
Patch to implement first run at feature

Initial posted the wrong patch. Sorry about that.
Comment 5 Phil Mason CLA 2012-01-05 12:39:57 EST
Created attachment 209090 [details]
Updated patch that resolves an issue in previous patch

This is a new patch that resolves an issue where the initial state of the menu could be incorrect.

I'd still like to improve the patch in a couple of ways but I'm not sure how:

1) The detail pane should refresh when the option is changed

2) There is only one setting for all the detail panes (as the state variable is static because the handler is static as it is an inner class). If I don't make the handler an inner class (which would resolve the static issue) I'm not sure how to get the correct detail pane to update.

If anybody can provide any pointers on where to begin with these issues I'd be grateful and will try to submit an updated patch.
Comment 6 Marc Khouzam CLA 2012-04-02 11:57:56 EDT
*** Bug 375763 has been marked as a duplicate of this bug. ***
Comment 7 Marc Khouzam CLA 2012-04-02 11:59:09 EDT
Good similar suggestion from Sergey in Bug 375763:

For an std:string the detail section looks like this:
Name : my_string
    Details:"The quick brown fox jumps over the lazy dog"
    Default:"The quick brown fox jumps over the lazy dog"
    Decimal:"The quick brown fox jumps over the lazy dog"
    Hex:"The quick brown fox jumps over the lazy dog"
    Binary:"The quick brown fox jumps over the lazy dog"
    Octal:"The quick brown fox jumps over the lazy dog"

For an integer variable:
Name : my_int
    Details:1
    Default:1
    Decimal:1
    Hex:0x1
    Binary:1
    Octal:01

For a pointer:
Name : my_pointer
    Details:(MyType *) 0xf5d4b900
    Default:(MyType *) 0xf5d4b900
    Decimal:(MyType *) 0xf5d4b900
    Hex:(MyType *) 0xf5d4b900
    Binary:(MyType *) 0xf5d4b900
    Octal:(MyType *) 0xf5d4b900

For an object without a pretty printer
Name : my_object
    Details:{field1 = value1, field2 = value2, ...}
    Default:{...}
    Decimal:{...}
    Hex:{...}
    Binary:{...}
    Octal:{...}

All examples above have high degree of redundancy and abundance of superficial
information. I'd like to see, at least as a configurable option, the following
compact display:

For a string:
The quick brown fox jumps over the lazy dog
(notice no variable name and no quotes)

For an integer:
123 (hex: 0x7B)

For a pointer:
(MyType*) 0xf5d4b900

For an object without a pretty printer
{field1 = value1, field2 = value2, ...}

It is also very important to have an option to wrap text in the detail section.
Otherwise, the only way to see the whole contents of a long string or a complex
structure is to copy/paste from the detail section to a text editor capable of
text wrapping.