From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13967 invoked by alias); 5 Jan 2004 11:50:19 -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 13960 invoked from network); 5 Jan 2004 11:50:18 -0000 Received: from unknown (HELO hall.mail.mindspring.net) (207.69.200.60) by sources.redhat.com with SMTP; 5 Jan 2004 11:50:18 -0000 Received: from user-119a90a.biz.mindspring.com ([66.149.36.10] helo=berman.michael-chastain.com) by hall.mail.mindspring.net with esmtp (Exim 3.33 #1) id 1AdTFR-0001Ao-00; Mon, 05 Jan 2004 06:50:17 -0500 Received: by berman.michael-chastain.com (Postfix, from userid 502) id 8376A4B35A; Mon, 5 Jan 2004 06:50:33 -0500 (EST) To: dan@debian.org, gdb-patches@sources.redhat.com Subject: [rfc/cp] take 2: method stubs asserts Message-Id: <20040105115033.8376A4B35A@berman.michael-chastain.com> Date: Mon, 05 Jan 2004 11:50:00 -0000 From: mec.gnu@mindspring.com (Michael Elizabeth Chastain) X-SW-Source: 2004-01/txt/msg00087.txt.bz2 Here's the slightly re-worked method stub patched. Tested again on: native i686-pc-linux-gnu, gcc 2.95.3 3.3.2 HEAD, dwarf-2 stabs+ full regression test native hppa2.0w-hp-hpux11.11, HP aCC++ B3910B A.03.45 one little test by hand Same analysis as before. Briefly, hpread.c does not set the domain type on a method, but methods don't actually need domain types unless they are used in pointer-to-member expressions, which are not implemented with hp SOM anyways. Is this the right idea? If it is -- okay to apply this patch? Michael C 2004-01-04 Michael Chastain * valops.c (find_overload_match): Assert that methods are not stubs. Do not assert that methods have domain types. * eval.c (evaluate_subexp_standard): Assert basetype and domain_type as needed. Index: valops.c =================================================================== RCS file: /cvs/src/src/gdb/valops.c,v retrieving revision 1.119 diff -c -3 -p -r1.119 valops.c *** valops.c 8 Nov 2003 00:13:03 -0000 1.119 --- valops.c 4 Jan 2004 23:05:43 -0000 *************** *** 1,6 **** /* Perform non-arithmetic operations on values, for GDB. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, ! 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. --- 1,6 ---- /* Perform non-arithmetic operations on values, for GDB. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, ! 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. *************** find_overload_match (struct type **arg_t *** 1939,1945 **** /* If we are dealing with stub method types, they should have been resolved by find_method_list via value_find_oload_method_list above. */ ! gdb_assert (TYPE_DOMAIN_TYPE (fns_ptr[0].type) != NULL); } else { --- 1939,1946 ---- /* If we are dealing with stub method types, they should have been resolved by find_method_list via value_find_oload_method_list above. */ ! for (ix = 0; ix < num_fns; ix++) ! gdb_assert (fns_ptr[ix].is_stub == 0); } else { Index: eval.c =================================================================== RCS file: /cvs/src/src/gdb/eval.c,v retrieving revision 1.39 diff -c -3 -p -r1.39 eval.c *** eval.c 23 Nov 2003 20:41:16 -0000 1.39 --- eval.c 4 Jan 2004 23:05:44 -0000 *************** *** 1,8 **** /* Evaluate expressions for GDB. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, ! 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software ! Foundation, Inc. This file is part of GDB. --- 1,8 ---- /* Evaluate expressions for GDB. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, ! 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 ! Free Software Foundation, Inc. This file is part of GDB. *************** *** 36,41 **** --- 36,42 ---- #include "objc-lang.h" #include "block.h" #include "parser-defs.h" + #include "gdb_assert.h" /* Defined in symtab.c */ extern int hp_som_som_object_present; *************** evaluate_subexp_standard (struct type *e *** 996,1006 **** if (METHOD_PTR_IS_VIRTUAL (fnptr)) { int fnoffset = METHOD_PTR_TO_VOFFSET (fnptr); ! struct type *basetype; struct type *domain_type = ! TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))); int i, j; ! basetype = TYPE_TARGET_TYPE (VALUE_TYPE (arg2)); if (domain_type != basetype) arg2 = value_cast (lookup_pointer_type (domain_type), arg2); basetype = TYPE_VPTR_BASETYPE (domain_type); --- 997,1011 ---- if (METHOD_PTR_IS_VIRTUAL (fnptr)) { int fnoffset = METHOD_PTR_TO_VOFFSET (fnptr); ! struct type *basetype = ! TYPE_TARGET_TYPE (VALUE_TYPE (arg2)); struct type *domain_type = ! TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))); int i, j; ! ! gdb_assert (basetype != NULL); ! gdb_assert (domain_type != NULL); ! if (domain_type != basetype) arg2 = value_cast (lookup_pointer_type (domain_type), arg2); basetype = TYPE_VPTR_BASETYPE (domain_type);