public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fetch lazy value before calling val_print
@ 2017-02-23 17:13 Yao Qi
  2017-03-03 17:17 ` Yao Qi
  0 siblings, 1 reply; 2+ messages in thread
From: Yao Qi @ 2017-02-23 17:13 UTC (permalink / raw)
  To: gdb-patches

As reported in PR 21165,

(gdb) info locals^M
gv = /home/yao/SourceCode/gnu/gdb/git/gdb/value.c:372: internal-error: int value_bits_any_optimized_out(const value*, int, int): Assertion `!value->lazy' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.ada/info_locals_renaming.exp: info locals (GDB internal error)
Resyncing due to internal error.

This internal error is caused by e8b24d9 (Remove parameter valaddr from
la_val_print).  Commit e8b24d9 removes some calls to
value_contents_for_printing, but value_fetch_lazy is not called, so the
internal error above is triggered.  This patch adds value_fetch_lazy
call before val_print.

Regression tested on x86_64-linux.

gdb:

2017-02-23  Yao Qi  <yao.qi@linaro.org>

	PR gdb/21165
	* ada-valprint.c (ada_val_print_ref): Call value_fetch_lazy if
	value is lazy.
	* valprint.c (common_val_print): Likewise.
---
 gdb/ada-valprint.c | 3 +++
 gdb/valprint.c     | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 46904ec..691ea09 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -1064,6 +1064,9 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
      (Eg: an array whose bounds are not set yet).  */
   ada_ensure_varsize_limit (value_type (deref_val));
 
+  if (value_lazy (deref_val))
+    value_fetch_lazy (deref_val);
+
   val_print (value_type (deref_val),
 	     value_embedded_offset (deref_val),
 	     value_address (deref_val), stream, recurse + 1,
diff --git a/gdb/valprint.c b/gdb/valprint.c
index c3e17ff..529f9a5 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1201,6 +1201,9 @@ common_val_print (struct value *val, struct ui_file *stream, int recurse,
        get a fixed representation of our value.  */
     val = ada_to_fixed_value (val);
 
+  if (value_lazy (val))
+    value_fetch_lazy (val);
+
   val_print (value_type (val),
 	     value_embedded_offset (val), value_address (val),
 	     stream, recurse,
-- 
1.9.1

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

end of thread, other threads:[~2017-03-03 17:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23 17:13 [PATCH] Fetch lazy value before calling val_print Yao Qi
2017-03-03 17:17 ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).