all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#34589: 26.1.91; GDB-MI Display Complex Data Types
@ 2019-02-20 10:08 Gustaf Waldemarson
  2019-02-20 17:16 ` Eli Zaretskii
                   ` (4 more replies)
  0 siblings, 5 replies; 27+ messages in thread
From: Gustaf Waldemarson @ 2019-02-20 10:08 UTC (permalink / raw)
  To: 34589

Hello,

I've got a minor feature request to the gdb-mi (and possibly a bug to
report). I've recently been coding a lot of C++ where almost every variable is a
class/struct of some kind and up until now I've simply ignored the "locals"
windows since almost every data-type is listed as "<complex data type>".

Eventually though, I looked up why it was doing that instead of doing
some kind of pretty printing, and finally I noticed the
"--simple-values" flag, which causes GDB to print the variable name and
type, but not the value (for "complex" data types).

Since as C++ (and other languages) is moving more and more towards these
kinds non-simple data types, I figured I should send out a feature
request for something like the following:

- Remove "--simple-values" by default.

- Add a customizable variable such as `gdb-simple-values-only`, which
  adds the above flag.

- Add a customizable variable such as `gdb-locals-value-limit` to limit
  the length a value is allowed to be shown.

- Add a simple filter of the retrieved value string to make it fit on a
  single line (e.g., a simple version could just remove all newlines).

Naturally, the having "--simple-values" be default or not is really a
matter of taste, the above merely reflects my personal preference.

There might also be some efficiency concerns for really large
data-structure being sent through the GDB interface, but perhaps that's
already handled elsewhere?

Also, since it is tangential with the above topic: reference and pointer
variables to complex data types *are* being displayed already presumably
unintentionally. And since the output is not filtered, this leads to a
rather distorted local variable window.

A simple example showing the above "bug" can be seen in the program:

#include <iostream>
#include <vector>

using namespace std;

int main(void)
{
    size_t idx = 0;
    vector<int> v{1, 2, 3, 4, 5};
    auto &vr = v;
    for (auto i : v)
    {
        idx++;
        cout << i << endl;
    }
    return 0;
}

(Compile with CXXFLAGS="-std=c++11 -g" and open with gdb-mi as usual).

I guess this is caused by GDB considering references themselves to be
simple values. I believe the proposed feature(s) would fix this issue
and provide a more useful debugging experience.

Best regards,
Gustaf



In GNU Emacs 26.1.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2019-01-10 built on E105888
Repository revision: 9845044fb659735251269213e6e4e6debdd08eee
System Description:    Ubuntu 16.04.5 LTS

Recent messages:
Mark saved where search started
When done with a buffer, type C-x #
Mark saved where search started
Mark set
Mark saved where search started [3 times]
When done with a buffer, type C-x #
Mark saved where search started [2 times]
Quit
delete-backward-char: Text is read-only
Making completion list...

Configured using:
 'configure --prefix=/home/guswal01/.local
 '--program-transform-name=s/^ctags$/ctags.emacs/''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS GLIB NOTIFY
GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM
THREADS LCMS2

Important settings:
  value of $LC_ALL:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
  gdb-many-windows: t
  global-magit-file-mode: t
  diff-auto-refine-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  beacon-mode: t
  flycheck-pos-tip-mode: t
  projectile-mode: t
  hes-mode: t
  global-linum-mode: t
  linum-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-company-mode: t
  company-mode: t
  global-anzu-mode: t
  anzu-mode: t
  perspeen-mode: t
  global-atomic-chrome-edit-mode: t
  global-undo-tree-mode: t
  which-key-mode: t
  anyclip-mode: t
  override-global-mode: t
  electric-pair-mode: t
  save-place-mode: t
  global-subword-mode: t
  subword-mode: t
  show-paren-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
  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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/guswal01/.emacs.d/elpa/soap-client-3.1.5/soap-inspect hides
/home/guswal01/.local/share/emacs/26.1.91/lisp/net/soap-inspect
/home/guswal01/.emacs.d/elpa/soap-client-3.1.5/soap-client hides
/home/guswal01/.local/share/emacs/26.1.91/lisp/net/soap-client

Features:
(shadow sort bbdb-message mail-extr emacsbug sendmail gnus-async qp
gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp gnus-ml
gnus-msg disp-table nndoc gnus-cache gnus-dup gnus-art mm-uu mml2015
mm-view mml-smime smime dig mm-archive network-stream starttls url-cache
debbugs-gnu debbugs soap-client url-http url-auth url-gw nsm url
url-proxy url-privacy url-expand url-methods url-history mailcap rng-xsd
rng-dt rng-util xsd-regexp xml eieio-opt speedbar sb-image ezimage
dframe help-fns radix-tree pbrt-mode misearch multi-isearch two-column
iso-transl tabify flycheck-popup-tip gdb-mi ace-window
modern-cpp-font-lock irony-cdb-libclang irony-cdb-json pp
irony-cdb-clang-complete irony-cdb irony-completion irony-snippet irony
irony-iotask face-remap vc-git bug-reference org-rmail org-mhe org-irc
org-info org-gnus nnir gnus-sum gnus-group gnus-undo gnus-start
gnus-cloud nnimap nnmail mail-source tls gnutls utf7 netrc nnoo
parse-time gnus-spec gnus-int gnus-range gnus-win gnus nnheader
org-docview doc-view jka-compr image-mode org-bibtex bibtex org-bbdb
org-w3m org-table ob-latex ob-plantuml ob-org ob-shell ob-gnuplot
ob-python ob-ditaa ob-dot org-element avl-tree generator org org-macro
org-footnote org-pcomplete org-list org-faces org-entities noutline
outline org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob
ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs cal-menu calendar cal-loaddefs guess-language magit-extras
magit-submodule magit-obsolete magit-blame magit-stash magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff
smerge-mode diff-mode magit-core magit-autorevert magit-process
magit-margin magit-mode git-commit magit-git magit-section magit-utils
magit-popup crm log-edit message rmc puny format-spec rfc822 mml mml-sec
epa derived epg gnus-util rmail rmail-loaddefs mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
with-editor async-bytecomp async shell pcomplete dired dired-loaddefs
term/tmux term/xterm xterm smart-mode-line-dark-theme smart-mode-line
rich-minority beacon server flymake-proc flymake warnings
auto-complete-config auto-complete popup form-feed paredit nameless
lisp-mnt flyspell ispell whitespace flycheck-pos-tip pos-tip flycheck
find-func dash rainbow-delimiters projectile grep compile ibuf-ext
ibuffer ibuffer-loaddefs highlight-escape-sequences linum
yasnippet-snippets yasnippet company-oddmuse company-keywords
company-etags etags xref project company-gtags company-dabbrev-code
company-dabbrev company-files company-capf company-cmake company-xcode
company-clang company-semantic company-eclim company-template
company-bbdb company anzu thingatpt perspeen perspeen-tab powerline
powerline-separators powerline-themes atomic-chrome websocket url-cookie
url-domsuf url-util bindat subr-x let-alist json map
color-theme-approximate color delim-col hydra-examples windmove rect
hydra lv pcase bbdb bbdb-site timezone cus-edit cus-start cus-load
wid-edit ace-link avy undo-tree diff which-key advice anyclip-mode
cl-extra help-mode diminish use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
use-package-core finder-inf autoinsert tex-site rx slime-autoloads info
package epg-config url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache url-vars
local-autoloads cwarn cc-mode cc-fonts easymenu cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs elec-pair saveplace
cap-words superword subword time-date paren winner autorevert filenotify
xt-mouse tango-dark-theme savehist ido seq byte-opt gv bytecomp
byte-compile cconv gud easy-mmode comint ansi-color ring keybinds
edmacro kmacro cl-loaddefs cl-lib terminals mule-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type 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 elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic 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 charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 1119702 162902)
 (symbols 48 60024 2)
 (miscs 40 6949 1708)
 (strings 32 201194 30469)
 (string-bytes 1 6831751)
 (vectors 16 81280)
 (vector-slots 8 2121524 238164)
 (floats 8 3772 1218)
 (intervals 56 96783 1278)
 (buffers 992 96)
 (heap 1024 90082 4527))





^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2022-03-07  9:27 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-20 10:08 bug#34589: 26.1.91; GDB-MI Display Complex Data Types Gustaf Waldemarson
2019-02-20 17:16 ` Eli Zaretskii
2019-02-21 13:42   ` Gustaf Waldemarson
2019-02-23  9:40     ` Eli Zaretskii
2019-02-23 10:01       ` Gustaf Waldemarson
2019-02-23 10:36         ` Eli Zaretskii
2019-02-28 16:05           ` Gustaf Waldemarson
2019-02-28 17:24             ` Andrew W. Nosenko
2019-02-28 17:58             ` Eli Zaretskii
2019-03-01  3:57             ` Richard Stallman
2019-03-02  3:28             ` Richard Stallman
2019-03-03 20:32               ` Gustaf Waldemarson
2019-03-04  3:30                 ` Eli Zaretskii
2019-03-04  8:05                   ` Gustaf Waldemarson
2019-03-08  9:06                     ` Eli Zaretskii
2019-11-05 10:05                       ` Gustaf Waldemarson
2020-09-30 18:08                         ` Lars Ingebrigtsen
2020-09-30 18:30                           ` Eli Zaretskii
2020-04-15 14:54 ` Yuan Fu
2020-04-15 15:05   ` Eli Zaretskii
2022-03-06 20:39 ` William Xu
2022-03-06 20:44 ` William Xu
2022-03-06 20:46 ` Weilin Xu
2022-03-06 21:56   ` Lars Ingebrigtsen
2022-03-06 22:33     ` William Xu
2022-03-06 23:02       ` Lars Ingebrigtsen
2022-03-07  9:27         ` William Xu

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.