From patchwork Thu Feb 23 17:13:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 19358 Received: (qmail 94118 invoked by alias); 23 Feb 2017 17:13:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 94108 invoked by uid 89); 23 Feb 2017 17:13:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=our X-HELO: mail-wm0-f48.google.com Received: from mail-wm0-f48.google.com (HELO mail-wm0-f48.google.com) (74.125.82.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Feb 2017 17:13:26 +0000 Received: by mail-wm0-f48.google.com with SMTP id 196so4412027wmm.1 for ; Thu, 23 Feb 2017 09:13:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=46nCbyJglURojHthI1KBfyRtBFalLkKf/vEvtibJC0A=; b=e5YMi4WW9VuW79iLBMF9UgTsd50G/PwbSRe2F5QUZDRDaUsglmz6rzqd0lPoYjXh90 je3BI0RoDyVgwL7UBe6dVplCpqiSzP9dnRpLH7zk9WdVHeEXgSBZTDRXIFH4mYr4DcRU Hdktrv+jwje39U1PM7OuWjnu8+7MinsPwEdOMnDrhXsrSzKZG1+nEj9QuM8mTfxfE25h pTRHqegOBj4FuCeE6oI6n9kPwEw0RLFTUo7rGlD/A09yucl1EPzw92GAMdLEnde8uPzG w0wF0O3c56myh5+D+VOwsgPB5PzfPw3CJOtYBOPTmF+mU5gCtLdQK7nzamw6456FHh18 ei3Q== X-Gm-Message-State: AMke39mvZ2yoyIdr152M9PfhhBm17MoYYBXB764K29xh5BApem8zryUejH5n/ZbUmEHINg== X-Received: by 10.28.37.195 with SMTP id l186mr5659405wml.73.1487870004054; Thu, 23 Feb 2017 09:13:24 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com ([194.214.185.158]) by smtp.gmail.com with ESMTPSA id e6sm6813048wrc.30.2017.02.23.09.13.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Feb 2017 09:13:23 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] Fetch lazy value before calling val_print Date: Thu, 23 Feb 2017 17:13:20 +0000 Message-Id: <1487870000-24345-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes 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 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,