GNU bug report logs -
#59730
gdb-mi.el: Local variables reordering
Previous Next
Full log
Message #14 received at 59730 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
The updated patch is attached to this mail. Although I was not able to find
any reference to the GDB options that changes
how types are displayed (
https://sourceware.org/gdb/onlinedocs/gdb/Print-Settings.html#Print-Settings).
Am I just
blind? Or did you have a specific setting in mind?
Best regards,
Gustaf
Den tors 1 dec. 2022 kl 21:40 skrev Gustaf Waldemarson <
gustaf.waldemarson <at> gmail.com>:
> > First, if the problem is that the type names are long, maybe it will be
> > enough to truncate them without changing the order?
>
> The truncation is the main issue, although I would argue that this is also
> a good opportunity to change
> the order as well given some of the benefits of a left-to-right reading
> order, (e.g., it is easier to read and
> parse, as explained Herb Sutter^1). Other languages such as Rust/Go could
> also benefit from this. That said,
> I guess this might be a western thing, and it is hardly a hill I would die
> on, so to speak.
>
> > Also, latest version of GDB allow control on which types get shown in
> full
> > and which are shown as <...> -- did you try to use that GDB option to
> make
> > the display more easily readable?
>
> I was not aware of this. I will look into it and see if I can enable it.
> That said, there's probably benefits to having
> the option to truncate from Emacs anyways, primarily to support older
> versions of GDB.
>
> > And wouldn't it be better to truncate the string with
> > truncate-string-to-width or with string-truncate-left instead?
>
> Absolutely, I just was not aware of these (better) tools. One could even
> argue that a custom filter-function could be warranted,
> but I think that's a bit overkill right now at least.
>
> > And finally, when the type is truncated, would it be possible to add a
> > tooltip with the full name of the type, so that users who need that could
> > hover the mouse above the truncated type and see it in full?
>
> Excellent idea, that should be doable by just adding some properties to
> the strings, I'll see if I can sort these things out as well.
>
> Thanks for the feedback, I'll start working on an updated patch soon-ish
>
> ^1. See e.g.
> https://softwareengineering.stackexchange.com/questions/101978/advantages-of-a-left-to-right-language-syntax
> ^1. and https://herbsutter.com/2011/05/04/interview-on-channel-9-2/
>
> Best regards,
> Gustaf
>
> Den tors 1 dec. 2022 kl 16:45 skrev Eli Zaretskii <eliz <at> gnu.org>:
>
>> > From: Gustaf Waldemarson <gustaf.waldemarson <at> gmail.com>
>> > Date: Wed, 30 Nov 2022 23:09:14 +0100
>> >
>> > In summary, this patch does this: In gdb-mi.el mode, for local C/C++
>> variables that were previously written
>> > out:
>> >
>> > - | type | name | value|
>> >
>> > Now write them out as:
>> >
>> > - | name | type | value |
>> >
>> > Additionally, cap the string length of the name and type to
>> `gdb-locals-max-name-length` and
>> > `gdb-locals-max-type-length` respectively (new custom variables with a
>> default set to 20). I also changed the
>> > table to always left-align the values when we're printing the locals.
>> >
>> > Turns out it was really easy to fix, but I may have missed some
>> subtleties, so feel free to give it a look or
>> > start a discussion whether this is a good idea or not. I personally
>> prefer it this way since it is much easier
>> > and faster to see the values of individual variables, especially when
>> the type-info get very long.
>>
>> First, if the problem is that the type names are long, maybe it will be
>> enough to truncate them without changing the order?
>>
>> Also, latest version of GDB allow control on which types get shown in full
>> and which are shown as <...> -- did you try to use that GDB option to make
>> the display more easily readable?
>>
>> And wouldn't it be better to truncate the string with
>> truncate-string-to-width or with string-truncate-left instead?
>>
>> And finally, when the type is truncated, would it be possible to add a
>> tooltip with the full name of the type, so that users who need that could
>> hover the mouse above the truncated type and see it in full?
>>
>> Thanks.
>>
>
[Message part 2 (text/html, inline)]
[0001-gdb-mi.el-Swap-type-and-name-column-in-locals.patch (text/x-patch, attachment)]
This bug report was last modified 2 years and 221 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.