From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23530 invoked by alias); 9 Dec 2009 15:10:53 -0000 Received: (qmail 23401 invoked by uid 22791); 9 Dec 2009 15:10:50 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS 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; Wed, 09 Dec 2009 15:10:46 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nB9FAjm5026635 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 9 Dec 2009 10:10:45 -0500 Received: from qcore.mollernet.net (vpn-9-13.rdu.redhat.com [10.11.9.13]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nB9FAi4D013690 for ; Wed, 9 Dec 2009 10:10:44 -0500 Message-ID: <4B1FBDF4.4040801@redhat.com> Date: Wed, 09 Dec 2009 15:10:00 -0000 From: Chris Moller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: Patch for PR 9399 References: <4B1FA6F2.1060105@redhat.com> <20091209140534.GA12330@caradoc.them.org> In-Reply-To: <20091209140534.GA12330@caradoc.them.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2009-12/txt/msg00135.txt.bz2 On 12/09/09 09:05, Daniel Jacobowitz wrote: > On Wed, Dec 09, 2009 at 08:32:34AM -0500, Chris Moller wrote: > >> The patch file includes the patch to gdb/valops.c, gdb/ChangeLog, >> gdb/testsuite/ChangeLog, gdb/testsuite/gdb.cp/Makefile.in, and >> mc-log.diffs. (The patch to Makefile.in is to incorporate the >> testcase for 'make check'; mc-log.diffs are the diffs between before >> and after runs of 'make check') >> > > Next time, please diff -u gdb.sum files; the rest is just noise. > Okay--if I ever do this again. :-) > Those do vary a little bit but they're more stable. It looks like > your only change is mi-nsmoribund.exp, which is sometimes flaky. > > >> I can't do a 'cvs add' so the the >> testcase expects and .cc file are attached separately as >> gdb/testsuite/gdb.cp/virtfunc2.cc and >> gdb/testsuite/gdb.cp/virtfunc2.exp. >> > > Take a look at cvsutils; "cvsdo add" works. > > (Or, nowadays, I suppose you could use the git mirror! :-) > Didn't know you had a git mirror--I just pulled the CVS version because it was pointed to on http://sourceware.org/gdb/ > >> You can see what the patch does by compiling -g virtfunc.cc, gdb-ing >> it, breaking in the return stmt at // marker1, and doing things like >> "print o.do_print()". Without the patch, gdb tries to access >> location 0x0; with the patch it does the right thing. (There are >> more tests in virtfunc2.exp) >> > > Where does the access to 0x0 come from? Is it inside > search_struct_field? Ultimately, yes. Without the patch, the thread ultimately gets to if (BASETYPE_VIA_VIRTUAL (type, i)) in search_struct_field and then to the memcpy about 30 lines later that extracts a new value struct. That main_type of that value doesn't include a field for the virtual function, so it's never found, and ultimately returns a null pointer. I haven't a clue why it works that way--for a while I was working on the assumption that the DWARF reader was screwing up, but if it is, it's too subtle for me. > I wouldn't expect value_cast_structs to do any > cast in this case, value_cast_structs only does nothing if both TYPE_NAME()s are null. I was wondering if, back when the code was originally written, if there never was a case when both TYPE_NAME()s were non-null--it's the only way, other than simple oversight, I can account for that case not being covered. > but it does do a little extra work. > > >> + if ((TYPE_NAME (t1) != NULL)&& >> + (TYPE_NAME (t2) != NULL)&& >> + !strcmp (TYPE_NAME (t1), TYPE_NAME (t2))) >> > > && on the beginning of the line, please. > >