The GDB local variable window (in the multi-window view) usually works fine to track local variables. However, I've recently been coding a lot in C++, and almost all variables are some kind of struct/class, which is just displayed as <complex data type>, which isn't very useful. Is there any way of telling Emacs (or GDB?) to display said data type anyways? Maybe even with some upper limit?

  • People tend to script their own gdb commands to do that, so I suspect this isn't Emacs-related anyway – wasamasa Feb 19 '19 at 17:25
  • Hmm, aren't those kinds of scripts intended for pretty printing the types? Which isn't necessarily the same as displaying the data itself? – Xaldew Feb 20 '19 at 8:52

After some research, I found out that the <complex data type> string is indeed added by Emacs. In particular, Emacs uses the "--simple-values" flag sent to the GDB-MI interface to only retrieve values that are "simple". Currently, there is no way of customizing this behavior, save for editing the gdb-mi.el in the Emacs source itself.

For this reason I have submitted a feature request to the main Emacs developers, which you can view here. If you consider something like that useful, considering chiming in to the discussion there instead.

  • [Sry can't comment with sub 50 rep] I'm sick of using gud-watch + Speedbar to view structs, since under certain circumstances it's a buggy mess. I'm looking forward to the mentioned patch in gdb-mi.el.. ..but let me get this straigth: The patch was stopped due to legal issues in Feb/Mar and is now in limbo. Is my interpretation of the email chain correct? – SairesArt Nov 3 '19 at 17:11
  • 2
    That was correct up until about a month ago. The legal limbo has been resolved and I'm now allowed to submit patches to Emacs. Unfortunately, I've just not really had the time to finish up the patches and re-open the tickets, but since people are waiting on them I'll try to get on with it – Xaldew Nov 4 '19 at 10:04
  • 1
    Yes please! This would be great to have. Congratulations on figuring out the legal limbo, looking forward to using your patch. – Clément Nov 10 '19 at 5:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.