From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11826 invoked by alias); 4 Jan 2008 10:50:24 -0000 Received: (qmail 11816 invoked by uid 22791); 4 Jan 2008 10:50:24 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 04 Jan 2008 10:49:54 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4E5992A963A; Fri, 4 Jan 2008 05:49:52 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2UjsnnYUzgjw; Fri, 4 Jan 2008 05:49:52 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 58DF12A9637; Fri, 4 Jan 2008 05:49:51 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id BE818E7ACB; Fri, 4 Jan 2008 02:49:43 -0800 (PST) Date: Fri, 04 Jan 2008 10:50:00 -0000 From: Joel Brobecker To: Andreas Schwab Cc: gdb-patches@sourceware.org Subject: Re: [RFA] fix "ptype $pc" internal-error Message-ID: <20080104104943.GA5975@adacore.com> References: <20080104094316.GO2179@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="liOOAslEiF7prFVr" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i 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-01/txt/msg00052.txt.bz2 --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 551 > Indentation is off here. > > if (noside == EVAL_AVOID_SIDE_EFFECTS > && regno < (gdbarch_num_regs (current_gdbarch) > + gdbarch_num_pseudo_regs (current_gdbarch))) Oops, you are right, of course. Thanks! Fixed in the attached patch. 2008-01-04 Joel Brobecker * eval.c (evaluate_subexp_standard): Add handling of user registers when in EVAL_AVOID_SIDE_EFFECTS mode. 2008-01-04 Joel Brobecker * gdb.base/ptype.exp: Add testing of "ptype $pc". -- Joel --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ptype.diff" Content-length: 1418 Index: eval.c =================================================================== --- eval.c (revision 65) +++ eval.c (revision 68) @@ -512,7 +512,15 @@ evaluate_subexp_standard (struct type *e name, strlen (name)); if (regno == -1) error (_("Register $%s not available."), name); - if (noside == EVAL_AVOID_SIDE_EFFECTS) + + /* In EVAL_AVOID_SIDE_EFFECTS mode, we only need to return + a value with the appropriate register type. Unfortunately, + we don't have easy access to the type of user registers. + So for these registers, we fetch the register value regardless + of the evaluation mode. */ + if (noside == EVAL_AVOID_SIDE_EFFECTS + && regno < (gdbarch_num_regs (current_gdbarch) + + gdbarch_num_pseudo_regs (current_gdbarch))) val = value_zero (register_type (current_gdbarch, regno), not_lval); else val = value_of_register (regno, get_selected_frame (NULL)); Index: testsuite/gdb.base/ptype.exp =================================================================== --- testsuite/gdb.base/ptype.exp (revision 65) +++ testsuite/gdb.base/ptype.exp (revision 68) @@ -639,4 +639,7 @@ if [runto_main] then { gdb_test "ptype {{0,1,2},{3,4,5}}" "type = int \\\[2\\\]\\\[3\\\]" gdb_test "ptype {4,5,6}\[2\]" "type = int" gdb_test "ptype *&{4,5,6}\[1\]" "type = int" + + # Test ptype of user register + gdb_test "ptype \$pc" "void \\(\\*\\)\\(\\)" "ptype \$pc" } --liOOAslEiF7prFVr--