Subject: bug#59730: gdb-mi.el: Local variables reordering

From: Gustaf Waldemarson <[email-masked]>
Date: Wed, 30 Nov 2022 23:09:14 +0100

Hello,

After about 3 years, I finally spent some time to actually change the order
of local variables as I had originally suggest in an old feature
(bug#34589).

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.

Best regards,
Gustaf

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.33, cairo version 1.16.0) of 2022-11-30 built on ShadowX
Repository revision: ec759e82b39f6ee54e9187acc9525cd65d704c59
Repository branch: master
System Description: Ubuntu 22.04.1 LTS

Configured using:
 'configure --prefix=/home/xaldew/.local
 '--program-transform-name=s/^ctags$/ctags.emacs/' --without-makeinfo
 --with-xpm=ifavailable --with-jpeg=ifavailable --with-gif=ifavailable
 --with-tiff=ifavailable'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LCMS2
LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND
THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: sv_SE.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: C++//l

Minor modes in effect:
  lsp-diagnostics-mode: t
  lsp-headerline-breadcrumb-mode: t
  lsp-modeline-workspace-status-mode: t
  lsp-modeline-diagnostics-mode: t
  lsp-modeline-code-actions-mode: t
  dap-tooltip-mode: t
  dap-ui-many-windows-mode: t
  dap-ui-controls-mode: t
  dap-ui-mode: t
  gdb-many-windows: t
  beacon-mode: t
  modern-c++-font-lock-mode: t
  lsp-completion-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: t
  treemacs-fringe-indicator-mode: t
  dap-auto-configure-mode: t
  dap-mode: t
  flyspell-mode: t
  whitespace-mode: t
  rainbow-delimiters-mode: t
  hes-mode: t
  projectile-mode: t
  lsp-ui-mode: t
  lsp-ui-sideline-mode: t
  flycheck-mode: t
  lsp-managed-mode: t
  lsp-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-company-mode: t
  company-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  global-anzu-mode: t
  anzu-mode: t
  perspeen-mode: t
  windmove-mode: t
  which-key-mode: t
  anyclip-mode: t
  override-global-mode: t
  cwarn-mode: t
  electric-pair-mode: t
  save-place-mode: t
  global-subword-mode: t
  subword-mode: t
  winner-mode: t
  global-auto-revert-mode: t
  xterm-mouse-mode: t
  savehist-mode: t
  ido-everywhere: t
  gud-tooltip-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  auto-fill-function: yas--auto-fill
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
/home/xaldew/.config/emacs/elpa/transient-20221130.1823/transient hides
/home/xaldew/.local/share/emacs/30.0.50/lisp/transient

Features:
(shadow sort bbdb-message guess-language mail-extr warnings emacsbug
message yank-media dired dired-loaddefs rfc822 mml mml-sec epa derived
gnus-util time-date mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils display-line-numbers server pinentry
files-x lsp-diagnostics lsp-headerline lsp-icons lsp-modeline dap-mouse
dap-ui gdb-mi bui bui-list bui-info bui-entry bui-core bui-history
bui-button bui-utils lsp-lens beacon vc-git diff-mode vc-dispatcher
modern-cpp-font-lock .yas-setup.el cc-mode/.yas-setup.el view lsp-zig
lsp-steep lsp-svelte lsp-sqls lsp-ruby-syntax-tree lsp-yaml lsp-xml
lsp-vimscript lsp-vhdl lsp-volar lsp-vetur lsp-html lsp-verilog lsp-vala
lsp-v lsp-typeprof lsp-ttcn3 lsp-toml lsp-terraform lsp-tex lsp-sorbet
lsp-solargraph lsp-rust lsp-rf lsp-remark lsp-racket lsp-r
lsp-purescript lsp-pylsp lsp-pyls lsp-pwsh lsp-php lsp-pls
lsp-perlnavigator lsp-perl lsp-openscad lsp-ocaml lsp-magik lsp-nix
lsp-nim lsp-nginx lsp-mint lsp-marksman lsp-markdown lsp-lua lsp-ltex
lsp-kotlin lsp-json lsp-javascript lsp-idris lsp-haxe lsp-groovy
lsp-hack lsp-graphql lsp-gleam lsp-go lsp-completion lsp-gdscript
lsp-fsharp lsp-fortran lsp-eslint lsp-erlang lsp-emmet lsp-elixir
lsp-elm lsp-dockerfile lsp-dhall lsp-d lsp-css lsp-csharp gnutls
lsp-crystal lsp-cmake lsp-clojure lsp-treemacs lsp-treemacs-generic
lsp-treemacs-themes treemacs-treelib treemacs treemacs-header-line
treemacs-compatibility treemacs-mode treemacs-interface
treemacs-persistence treemacs-filewatch-mode treemacs-follow-mode
treemacs-rendering treemacs-annotations treemacs-async
treemacs-workspaces treemacs-dom treemacs-visuals
treemacs-fringe-indicator treemacs-scope pulse treemacs-faces
treemacs-icons treemacs-themes treemacs-core-utils pfuture hl-line
treemacs-logging treemacs-customization treemacs-macros
lsp-semantic-tokens lsp-clangd lsp-beancount lsp-bash lsp-astro
lsp-ansible lsp-angular lsp-ada lsp-actionscript dap-gdb-lldb dap-utils
dom xml dap-mode dap-tasks dap-launch lsp-docker yaml posframe
dap-overlays term/tmux term/xterm xterm form-feed paredit nameless
flyspell ispell whitespace rainbow-delimiters highlight-escape-sequences
projectile lisp-mnt grep ibuf-ext ibuffer ibuffer-loaddefs lsp-ui
lsp-ui-flycheck lsp-ui-doc goto-addr lsp-ui-imenu lsp-ui-peek
lsp-ui-sideline flycheck lsp-mode tree-widget spinner network-stream
puny nsm markdown-mode noutline outline inline imenu f f-shortdoc
shortdoc ewoc epg rfc6068 epg-config compile text-property-search
lsp-ui-util face-remap find-func lsp-protocol s ht dash py-snippets
yasnippet-radical-snippets yasnippet-snippets yasnippet company-oddmuse
company-keywords company-etags etags fileloop generator xref project
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-bbdb company undo-tree diff queue anzu
thingatpt atomic-chrome websocket bindat let-alist
color-theme-approximate perspeen perspeen-tab powerline advice
powerline-separators color powerline-themes delim-col hydra-examples
windmove rect hydra lv bbdb bbdb-site timezone cus-edit pp cus-load
icons wid-edit ace-link avy pcase which-key anyclip-mode cl-extra
help-mode edmacro kmacro diminish use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core finder-inf local-autoloads cwarn cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs elec-pair saveplace cap-words superword subword winner
autorevert filenotify xt-mouse tango-dark-theme savehist ido gud comint
ansi-osc ansi-color ring keybinds terminals ace-link-autoloads
unfill-autoloads company-auctex-autoloads gl-conf-mode-autoloads
spacemacs-theme-autoloads css-eldoc-autoloads beacon-autoloads
emms-autoloads paredit-autoloads glsl-mode-autoloads
highlight-escape-sequences-autoloads evil-autoloads powershell-autoloads
gnuplot-mode-autoloads cuda-mode-autoloads ein-autoloads
debbugs-autoloads ssh-config-mode-autoloads gnuplot-autoloads
perspeen-autoloads cider-autoloads sesman-autoloads
clojure-mode-autoloads dart-mode-autoloads sublime-themes-autoloads
coffee-mode-autoloads opencl-mode-autoloads json-mode-autoloads rx
company-anaconda-autoloads pinentry-autoloads rainbow-mode-autoloads
htmlize-autoloads flycheck-rust-autoloads kotlin-mode-autoloads
lsp-ltex-autoloads bbdb-vcard-autoloads ebdb-autoloads
projectile-autoloads jira-markup-mode-autoloads
browse-kill-ring-autoloads slime-autoloads macrostep-autoloads
helm-dash-autoloads dap-mode-autoloads lsp-docker-autoloads
yaml-autoloads lsp-treemacs-autoloads treemacs-autoloads cfrs-autoloads
pfuture-autoloads bui-autoloads sx-autoloads jenkins-autoloads
smart-jump-autoloads bbdb-autoloads parseedn-autoloads delight-autoloads
anzu-autoloads x86-lookup-autoloads undo-tree-autoloads queue-autoloads
langtool-autoloads parseclj-autoloads plantuml-mode-autoloads
git-modes-autoloads ace-window-autoloads go-mode-autoloads
powerline-autoloads lsp-ui-autoloads deferred-autoloads iedit-autoloads
csv-mode-autoloads srefactor-autoloads abc-mode-autoloads autoinsert
atomic-chrome-autoloads solarized-theme-autoloads
anaconda-mode-autoloads web-mode-autoloads flycheck-kotlin-autoloads
lua-mode-autoloads nov-autoloads dash-docs-autoloads
rainbow-delimiters-autoloads form-feed-autoloads
yasnippet-radical-snippets-autoloads cmake-mode-autoloads
powerthesaurus-autoloads request-autoloads pyimport-autoloads
shut-up-autoloads json-snatcher-autoloads helm-lsp-autoloads
lsp-mode-autoloads spinner-autoloads ht-autoloads cargo-autoloads
clang-format-autoloads toml-mode-autoloads diminish-autoloads
websocket-autoloads yasnippet-snippets-autoloads nameless-autoloads
cdlatex-autoloads eclim-autoloads anaphora-autoloads rust-mode-autoloads
py-snippets-autoloads magit-gerrit-autoloads rmsbolt-autoloads
magit-svn-autoloads pythonic-autoloads company-quickhelp-autoloads
magit-annex-autoloads goto-chg-autoloads poly-markdown-autoloads
markdown-mode-autoloads polymode-autoloads alert-autoloads
gntp-autoloads log4e-autoloads color-theme-approximate-autoloads
use-package-autoloads bind-key-autoloads calfw-autoloads
graphviz-dot-mode-autoloads flycheck-package-autoloads
package-lint-autoloads flycheck-autoloads pkg-info-autoloads
epl-autoloads ecb-autoloads avy-autoloads modern-cpp-font-lock-autoloads
dts-mode-autoloads zenburn-theme-autoloads yaml-mode-autoloads
esxml-autoloads kv-autoloads elpy-autoloads pyvenv-autoloads
highlight-indentation-autoloads ob-ipython-autoloads f-autoloads
dash-functional-autoloads hydra-autoloads lv-autoloads
auto-complete-auctex-autoloads auto-complete-autoloads
yasnippet-autoloads auctex-latexmk-autoloads auctex-autoloads tex-site
ahk-mode-autoloads magit-autoloads magit-section-autoloads
git-commit-autoloads with-editor-autoloads transient-autoloads
compat-autoloads cask-mode-autoloads company-c-headers-autoloads
pos-tip-autoloads zerodark-theme-autoloads all-the-icons-autoloads
image+-autoloads expand-region-autoloads gnus-desktop-notify-autoloads
helm-autoloads helm-core-autoloads async-autoloads ggtags-autoloads
mmm-mode-autoloads posframe-autoloads company-math-autoloads
math-symbol-lists-autoloads company-autoloads ivy-autoloads
uimage-autoloads guess-language-autoloads dumb-jump-autoloads
popup-autoloads info dash-autoloads s-autoloads google-c-style-autoloads
which-key-autoloads package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv
bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
emacs)

Memory information:
((conses 16 465686 22927)
 (symbols 48 41605 1)
 (strings 32 144416 7236)
 (string-bytes 1 5047896)
 (vectors 16 74684)
 (vector-slots 8 1033911 12667)
 (floats 8 419 1011)
 (intervals 56 2262 292)
 (buffers 984 17))