From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9796 invoked by alias); 18 May 2012 15:26:39 -0000 Received: (qmail 9787 invoked by uid 22791); 18 May 2012 15:26:36 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 May 2012 15:26:23 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4IFQMj5014873 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 18 May 2012 11:26:22 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q4IFQK9n019777 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 18 May 2012 11:26:21 -0400 From: Tom Tromey To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [2/5] make print_address_demangle use hex for 0 References: <873972wnii.fsf@fleche.redhat.com> <4FB414DF.8050603@redhat.com> <87ehqjn8h8.fsf@fleche.redhat.com> Date: Fri, 18 May 2012 15:26:00 -0000 In-Reply-To: <87ehqjn8h8.fsf@fleche.redhat.com> (Tom Tromey's message of "Wed, 16 May 2012 15:04:19 -0600") Message-ID: <87ehqhik83.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.95 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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 X-SW-Source: 2012-05/txt/msg00689.txt.bz2 >>>>> "Tom" == Tom Tromey writes: Tom> I can try dropping the condition entirely if you want. Tom> I don't think I have ready access to a target where 0 is valid, though. I tried this. It seemed to work ok; I didn't need to find a funny target since a couple of test cases (expand-psymtabs-cxx.exp and cp-relocate.exp) exercise this code. Here's the updated patch. Tom 2012-05-18 Tom Tromey * printcmd.c (print_address_demangle): Remove special case for 0. 2012-05-18 Tom Tromey * gdb.mi/mi2-var-display.exp: Update. * gdb.mi/mi-var-display.exp: Update. * gdb.mi/mi-var-child.exp: Update. * gdb.cp/expand-psymtabs-cxx.exp: Update. * gdb.cp/cp-relocate.exp (get_func_address): Update. >From c8816c37c023be94e77afc21fcf0dd0b3fc07df2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 11 May 2012 12:59:31 -0600 Subject: [PATCH 2/4] remove print_address_demangle special case for 0 * printcmd.c (print_address_demangle): Remove special case for 0. * gdb.mi/mi2-var-display.exp: Update. * gdb.mi/mi-var-display.exp: Update. * gdb.mi/mi-var-child.exp: Update. * gdb.cp/expand-psymtabs-cxx.exp: Update. * gdb.cp/cp-relocate.exp (get_func_address): Update. --- gdb/ChangeLog | 4 ++++ gdb/printcmd.c | 6 +----- gdb/testsuite/ChangeLog | 8 ++++++++ gdb/testsuite/gdb.cp/cp-relocate.exp | 4 ++-- gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp | 9 ++++++--- gdb/testsuite/gdb.mi/mi-var-child.exp | 4 ++-- gdb/testsuite/gdb.mi/mi-var-display.exp | 2 +- gdb/testsuite/gdb.mi/mi2-var-display.exp | 2 +- 8 files changed, 25 insertions(+), 14 deletions(-) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 3bb43bd..523fad2 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -771,11 +771,7 @@ print_address_demangle (const struct value_print_options *opts, struct gdbarch *gdbarch, CORE_ADDR addr, struct ui_file *stream, int do_demangle) { - if (addr == 0) - { - fprintf_filtered (stream, "0"); - } - else if (opts->addressprint) + if (opts->addressprint) { fputs_filtered (paddress (gdbarch, addr), stream); print_address_symbolic (gdbarch, addr, stream, do_demangle, " "); diff --git a/gdb/testsuite/gdb.cp/cp-relocate.exp b/gdb/testsuite/gdb.cp/cp-relocate.exp index 172f24e..2981228 100644 --- a/gdb/testsuite/gdb.cp/cp-relocate.exp +++ b/gdb/testsuite/gdb.cp/cp-relocate.exp @@ -31,11 +31,11 @@ proc get_func_address { func } { set rfunc [string_to_regexp $func] gdb_test_multiple "print ${func}" "get address of ${func}" { - -re "\\\$\[0-9\]+ = \\{.*\\} (0|($hex) <${rfunc}>)\[\r\n\]+${gdb_prompt} $" { + -re "\\\$\[0-9\]+ = \\{.*\\} (($hex) <${rfunc}.*>)\[\r\n\]+${gdb_prompt} $" { # $1 = {int ()} 0x24 # But if the function is at zero, the name may be omitted. pass "get address of ${func}" - if { $expect_out(1,string) == "0" } { + if { $expect_out(1,string) == "0x0" } { return "0x0" } else { return $expect_out(2,string) diff --git a/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp b/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp index 226d0b8..2614fb7 100644 --- a/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp +++ b/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp @@ -32,6 +32,9 @@ gdb_test_no_output "set language c++" # FAIL was: # $1 = {} 0 -gdb_test "p 'method(long)'" { = {void \(long\)} 0} "before expand" -gdb_test "p method" { = {void \(long\)} 0} "force expand" -gdb_test "p 'method(long)'" { = {void \(long\)} 0} "after expand" +gdb_test "p 'method(long)'" { = {void \(long\)} 0x0 } \ + "before expand" +gdb_test "p method" { = {void \(long\)} 0x0 } \ + "force expand" +gdb_test "p 'method(long)'" { = {void \(long\)} 0x0 } \ + "after expand" diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index 7e58ad7..fb98c1d 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -808,9 +808,9 @@ mi_list_varobj_children {struct_declarations --simple-values} \ {struct_declarations.long_array long_array 12 "long int \\[12\\]"} \ [list struct_declarations.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)" "(@$hex: |)$hex "] \ {struct_declarations.func_ptr_struct func_ptr_struct 0 \ - "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?" 0} \ + "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?" 0x0} \ {struct_declarations.func_ptr_ptr func_ptr_ptr 0 \ - "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)" 0} \ + "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)" 0x0} \ {struct_declarations.u1 u1 4 "union \\{\\.\\.\\.\\}"} \ {struct_declarations.s2 s2 4 "struct \\{\\.\\.\\.\\}"} \ ] "listing of children, simple types: names, type and values, complex types: names and types" diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp index b3ae2c5..bc770d9 100644 --- a/gdb/testsuite/gdb.mi/mi-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi-var-display.exp @@ -286,7 +286,7 @@ mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \ "set format variable weird.func_ptr_struct" mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \ - "\\^done,format=\"natural\",value=\"0\"" \ + "\\^done,format=\"natural\",value=\"0x0\"" \ "set format variable weird.func_ptr_ptr" mi_gdb_test "-var-set-format weird.u1 natural" \ diff --git a/gdb/testsuite/gdb.mi/mi2-var-display.exp b/gdb/testsuite/gdb.mi/mi2-var-display.exp index f5c69ab..d1429c8 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-display.exp @@ -285,7 +285,7 @@ mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \ "set format variable weird.func_ptr_struct" mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \ - "\\^done,format=\"natural\",value=\"0\"" \ + "\\^done,format=\"natural\",value=\"0x0\"" \ "set format variable weird.func_ptr_ptr" mi_gdb_test "-var-set-format weird.u1 natural" \ -- 1.7.7.6