From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20891 invoked by alias); 21 Nov 2008 00:17:45 -0000 Received: (qmail 20791 invoked by uid 22791); 21 Nov 2008 00:17:44 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 21 Nov 2008 00:17:03 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id mAL0H1uV021692 for ; Thu, 20 Nov 2008 19:17:01 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mAL0H153022851; Thu, 20 Nov 2008 19:17:01 -0500 Received: from opsy.redhat.com (vpn-13-160.rdu.redhat.com [10.11.13.160]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id mAL0H0cN005907; Thu, 20 Nov 2008 19:17:00 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 397803787AB; Thu, 20 Nov 2008 17:16:58 -0700 (MST) To: gdb-patches@sourceware.org Subject: RFA: fix address in call to val_print From: Tom Tromey Reply-To: tromey@redhat.com X-Attribution: Tom Date: Fri, 21 Nov 2008 16:22:00 -0000 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2008-11/txt/msg00570.txt.bz2 This has been on the Python branch for a while. Paul wrote it, but since I ran into it today while doing a merge, I decided to submit it. val_print_array_elements passes 0 as the address to val_print. However, this is not correct, and will cause problems if val_print ever uses this value. I don't have a test case for this against the trunk. I would still like to check it in, as I think it is fairly obviously correct. Built and regtested on x86-64 (compile farm). Ok? Tom 2008-11-20 Paul Pluzhnikov * valprint.c (val_print_array_elements): Pass correct element address to val_print. diff --git a/gdb/valprint.c b/gdb/valprint.c index 5086a70..6bcb2f8 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1112,8 +1112,8 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, if (reps > options->repeat_count_threshold) { - val_print (elttype, valaddr + i * eltlen, 0, 0, stream, - recurse + 1, options, current_language); + val_print (elttype, valaddr + i * eltlen, 0, address + i * eltlen, + stream, recurse + 1, options, current_language); annotate_elt_rep (reps); fprintf_filtered (stream, " ", reps); annotate_elt_rep_end (); @@ -1123,8 +1123,8 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, } else { - val_print (elttype, valaddr + i * eltlen, 0, 0, stream, - recurse + 1, options, current_language); + val_print (elttype, valaddr + i * eltlen, 0, address + i * eltlen, + stream, recurse + 1, options, current_language); annotate_elt (); things_printed++; }