bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21438: 25.0.50; GUD locals frame/window doesn't shows struct values


From: Eli Zaretskii
Subject: bug#21438: 25.0.50; GUD locals frame/window doesn't shows struct values as nil
Date: Wed, 09 Sep 2015 17:14:24 +0300

> From: Tassilo Horn <tsdh@gnu.org>
> Date: Wed, 09 Sep 2015 08:04:49 +0200
> 
> stepping till the end of the function, this is the contents of the
> locals buffer shows:
> 
> --8<---------------cut here---------------start------------->8---
> struct it       it         nil
> struct text_pos pt         nil
> struct window * w          0x12a1d40
> struct buffer * old_buffer 0x0
> Lisp_Object     result     58
> --8<---------------cut here---------------end--------------->8---
> 
> But it and pt cannot be NULL/nil (and they are not when checking with
> "info locals" in the GUD GDB buffer).
> 
> The reason for that is that GUD uses the GDB command "-stack-list-locals
> --thread X --simple-values" as defined in gdb-mi.el:3991 which returns:
> 
>   locals=[{name="it",type="struct it"},
>           {name="pt",type="struct text_pos"},
>           {name="w",type="struct window *",value="0x12a1d40"},
>           {name="old_buffer",type="struct buffer *",value="0x0"},
>           {name="result",type="Lisp_Object",value="58"}]
> 
> Note that the entries for the two structs it and pt don't have a value
> field.
> 
> I guess the usage of --simple-values is intentional, and in fact, when
> trying to use "--all-values" instead I get a
> 
>   error in process filter: gdb-jsonify-buffer: Stack overflow in regexp 
> matcher

Yes, the use of --simple-values is intentional.  If you want to see
the values of the fields, you need to click mouse-2 on the variable
name, and then Emacs will pop up a frame with the fields.

> I'm not actually sure if it would be benefitical to use --all-values
> even if that regexp matching error was fixed because the structs can be
> really large.  But at least the value should not be shown as "nil" but
> as "<non-simple value>" or something else which makes it obvious that
> the displayed value is not the real value.

Like the patch below?  If you think it's OK, I will push it.

Thanks.

--- lisp/progmodes/gdb-mi.el~0  2015-05-20 08:22:42.000000000 +0300
+++ lisp/progmodes/gdb-mi.el    2015-09-09 16:47:24.399310500 +0300
@@ -4038,6 +4038,8 @@
       (let ((name (bindat-get-field local 'name))
             (value (bindat-get-field local 'value))
             (type (bindat-get-field local 'type)))
+        (when (not value)
+          (setq value "<complex data type>"))
         (if (or (not value)
                 (string-match "\\0x" value))
             (add-text-properties 0 (length name)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]