From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26473 invoked by alias); 27 Jan 2004 05:36:42 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 26464 invoked from network); 27 Jan 2004 05:36:41 -0000 Received: from unknown (HELO zenia.home) (12.223.225.216) by sources.redhat.com with SMTP; 27 Jan 2004 05:36:41 -0000 Received: by zenia.home (Postfix, from userid 5433) id 1595C207A3; Tue, 27 Jan 2004 00:36:36 -0500 (EST) To: gdb-patches@sources.redhat.com Subject: RFA: handle zero-length types in value_from_register From: Jim Blandy Date: Tue, 27 Jan 2004 05:36:00 -0000 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-01/txt/msg00682.txt.bz2 2004-01-27 Jim Blandy * findvar.c (value_from_register): If the type has no length, just return an acceptable value --- don't report an internal error. Index: gdb/findvar.c =================================================================== RCS file: /cvs/src/src/gdb/findvar.c,v retrieving revision 1.66 diff -c -r1.66 findvar.c *** gdb/findvar.c 30 Sep 2003 19:12:18 -0000 1.66 --- gdb/findvar.c 27 Jan 2004 05:28:52 -0000 *************** *** 617,623 **** struct value *v = allocate_value (type); CHECK_TYPEDEF (type); ! if (CONVERT_REGISTER_P (regnum, type)) { /* The ISA/ABI need to something weird when obtaining the specified value from this register. It might need to --- 617,641 ---- struct value *v = allocate_value (type); CHECK_TYPEDEF (type); ! if (TYPE_LENGTH (type) == 0) ! { ! /* It doesn't matter much what we return for this: since the ! length is zero, it could be anything. But if allowed to see ! a zero-length type, the register-finding loop below will set ! neither mem_stor nor reg_stor, and then report an internal ! error. ! ! Zero-length types can legitimately arise from declarations ! like 'struct {}'. GDB also creates them when it finds bogus ! debugging information (for example, TYPE_CODE_UNDEF has a ! length of zero). ! ! We'll just attribute the value to the original register. */ ! VALUE_LVAL (v) = lval_register; ! VALUE_ADDRESS (v) = regnum; ! VALUE_REGNO (v) = regnum; ! } ! else if (CONVERT_REGISTER_P (regnum, type)) { /* The ISA/ABI need to something weird when obtaining the specified value from this register. It might need to