From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 331 invoked by alias); 16 Oct 2013 14:26:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 322 invoked by uid 89); 16 Oct 2013 14:26:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mms3.broadcom.com Received: from mms3.broadcom.com (HELO mms3.broadcom.com) (216.31.210.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Oct 2013 14:26:30 +0000 Received: from [10.9.208.53] by mms3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Wed, 16 Oct 2013 07:26:05 -0700 X-Server-Uuid: B86B6450-0931-4310-942E-F00ED04CA7AF Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.1.438.0; Wed, 16 Oct 2013 07:26:18 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.1.438.0; Wed, 16 Oct 2013 07:26:18 -0700 Received: from [10.177.73.67] (unknown [10.177.73.67]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 84659246A7; Wed, 16 Oct 2013 07:26:17 -0700 (PDT) Message-ID: <525EA208.7000107@broadcom.com> Date: Wed, 16 Oct 2013 14:26:00 -0000 From: "Andrew Burgess" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: gdb-patches@sourceware.org cc: "Pedro Alves" Subject: Re: PING: Re: [PATCH] Print for unavailable registers References: <5200F594.3050402@broadcom.com> <5239BD47.2020101@broadcom.com> <5239CF96.4050800@redhat.com> In-Reply-To: <5239CF96.4050800@redhat.com> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00486.txt.bz2 On 18/09/2013 5:06 PM, Pedro Alves wrote: >> Index: ./gdb/infcmd.c >> =================================================================== >> RCS file: /cvs/src/src/gdb/infcmd.c,v >> retrieving revision 1.335 >> diff -u -p -r1.335 infcmd.c >> --- ./gdb/infcmd.c 18 Sep 2013 14:02:31 -0000 1.335 >> +++ ./gdb/infcmd.c 18 Sep 2013 14:43:13 -0000 >> @@ -2030,7 +2030,8 @@ default_print_one_register_info (struct >> >> if (!value_entirely_available (val)) >> { >> - fprintf_filtered (file, "*value not available*\n"); >> + val_print_unavailable (file); >> + fprintf_filtered (file, "\n"); >> return; >> } >> else if (value_optimized_out (val)) > > Why do we do this instead of just deferring to val_print though? > val_print would be able to print partially available registers, > for instance. > > (We'd need to do something about the "raw" printing bits below > though.) OK that's a reasonable point. I've rewritten this patch to make use of the val_print call to print the / . For now I unconditionally skip the second attempt to print the value, the "raw" form, for optimized-out and unavailable values, we might be able to do better in the future but I was keen to avoid output like this: "rax: " with the being repeated. If the value of a register is partially unavailable, and so we did manage to print something then it might make sense to try and print the raw form... Is this OK to apply? Thanks, Andrew gdb/ChangeLog 2013-10-16 Andrew Burgess * infcmd.c (default_print_one_register_info): Use val_print to print all values even optimized out or unavailable ones. Don't try to print a raw form of optimized out or unavailable values. gdb/testsuite/ChangeLog 2013-10-16 Andrew Burgess * gdb.trace/unavailable.exp (gdb_unavailable_registers_test): Expect pattern. diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 20f8857..3b41837 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -2024,21 +2024,13 @@ default_print_one_register_info (struct ui_file *file, struct value *val) { struct type *regtype = value_type (val); + int print_raw_format; fputs_filtered (name, file); print_spaces_filtered (15 - strlen (name), file); - if (!value_entirely_available (val)) - { - fprintf_filtered (file, "*value not available*\n"); - return; - } - else if (value_optimized_out (val)) - { - val_print_optimized_out (val, file); - fprintf_filtered (file, "\n"); - return; - } + print_raw_format = (value_entirely_available (val) + && !value_optimized_out (val)); /* If virtual format is floating, print it that way, and in raw hex. */ @@ -2058,9 +2050,12 @@ default_print_one_register_info (struct ui_file *file, value_embedded_offset (val), 0, file, 0, val, &opts, current_language); - fprintf_filtered (file, "\t(raw "); - print_hex_chars (file, valaddr, TYPE_LENGTH (regtype), byte_order); - fprintf_filtered (file, ")"); + if (print_raw_format) + { + fprintf_filtered (file, "\t(raw "); + print_hex_chars (file, valaddr, TYPE_LENGTH (regtype), byte_order); + fprintf_filtered (file, ")"); + } } else { @@ -2075,7 +2070,7 @@ default_print_one_register_info (struct ui_file *file, file, 0, val, &opts, current_language); /* If not a vector register, print it also according to its natural format. */ - if (TYPE_VECTOR (regtype) == 0) + if (print_raw_format && TYPE_VECTOR (regtype) == 0) { get_user_print_options (&opts); opts.deref_ref = 1; diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp index 8e2e105..ed14798 100644 --- a/gdb/testsuite/gdb.trace/unavailable.exp +++ b/gdb/testsuite/gdb.trace/unavailable.exp @@ -297,11 +297,11 @@ proc gdb_unavailable_registers_test { } { test_register "\$pc" gdb_test "info registers" \ - "\\*value not available\\*.*\\*value not available\\*" \ + ".*" \ "info registers, multiple registers not available" gdb_test "info registers \$$spreg" \ - "\\*value not available\\*" \ + "" \ "info registers \$$spreg reports not available" gdb_test "tfind none" "#0 end .*" "cease trace debugging"