GNOME Bugzilla – Bug 631139
Display arrays in "watches" window as textbox
Last modified: 2020-11-07 12:12:24 UTC
Currently, arrays are displayed in "watces" window (during debugging sessions) as expandable trees (each leaf is a value). This is not practical for large arrays and does not allow one to copy the values of the entire array (in order to paste it into another file, for example). More, vertically displaying arrays has the drawback of quickly cluttering the "watches" window. Instead, I propose to display each watched expression (and notably arrays) in a textbox on the right of the watched expression. For example: Expression | Value a[0]@3 | {0, 1, 43} a[0]+7 | 7 structvar | [structure] -field1 | 87 -field2 | "John Smith" More, editable fields (such as program variables) should be editable (allowing one to modify the value of a variable during debugging) while the other ones should be read-only (one cannot modify the value of the sum of two variables, for example "a+b").
I'm agree that the watch window are not practical. This tree view is the way gdb send back the data. The front end doesn't make the difference between structures and arrays. I think the latest version of gdb adds an additional hint information allowing to distinguish both cases, anyway it need more code to do something better. As Anjuta supports it now, another solution is that you write yourself a pretty printer for arrays displaying them as a strings. But you have to write the pretty printer in Python and you will not be able to change the array values. Do you know another IDE, preferably on Linux and using gdb, displaying arrays like you want ?
Created attachment 171614 [details] Eclipse Debug Perspective screenshot 1
Created attachment 171615 [details] Eclipse Debug Perspective screenshot 2
Quote: "As Anjuta supports it now, another solution is that you write yourself a pretty printer for arrays displaying them as a strings. But you have to write the pretty printer in Python and you will not be able to change the array values." That is true, however I have no knowledge of Python or how to write a pretty printer. Quote: "Do you know another IDE, preferably on Linux and using gdb, displaying arrays like you want ?" Almost yes, it is Eclipse. I attached two screenshots of its Debug Perspective. The watches ("Expressions") window is in the up right corner. Note that "*s1" is a structure and that "signal_real" is an array (or a pointer to a double). The arrays are displayed both as expandable trees (left side) and as {0,1,2,...} arrays (right side). Eclipse does not allow modifying the value of an Expression, you have to use the "Variables" window (not shown in the screenshots) for that. On a secondary note, the Eclipse Debug Perspective automatically inserts a breakpoint at "main" each time when launching the program under the control of the debugger, which I find very convenient (continuing debugging is just a "Resume" click away).
(In reply to comment #4) > Almost yes, it is Eclipse. I attached two screenshots of its Debug Perspective. > The watches ("Expressions") window is in the up right corner. Note that "*s1" > is a structure and that "signal_real" is an array (or a pointer to a double). > The arrays are displayed both as expandable trees (left side) and as > {0,1,2,...} arrays (right side). OK, thanks. > On a secondary note, the Eclipse Debug Perspective automatically inserts a > breakpoint at "main" each time when launching the program under the control of > the debugger, which I find very convenient (continuing debugging is just a > "Resume" click away). I have done it first, but I think someone has reported that it's annoying. Moreover it can be a issue if the debugger is not used with a C program which doesn't have a main function. I don't know if it's possible but I think gdb support other languages.
> I have done it first, but I think someone has reported that it's annoying. > Moreover it can be a issue if the debugger is not used with a C program which > doesn't have a main function. I don't know if it's possible but I think gdb > support other languages. Could have be me ;) It is not always pratical when you debug a big program because you have to hit run twice always. But this sounds like something we could offer as an option.
I saw this bug was commented in: http://mail.gnome.org/archives/anjuta-devel-list/2011-February/msg00020.html I would like to provide further support if needed in order to help with implementation in next Anjuta version. Thank you for considering my bug report.
bugzilla.gnome.org is being replaced by gitlab.gnome.org. We are closing all old feature requests in Bugzilla which have not seen updates for many years. If you are still requesting this feature in a currently supported version of GNOME (currently that would be 3.38), then please feel free to report it at https://gitlab.gnome.org/GNOME/anjuta/-/issues/ Thank you for reporting this issue and we are sorry it could not be implemented.