From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12345 invoked by alias); 5 Dec 2003 23:57:24 -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 12328 invoked from network); 5 Dec 2003 23:57:23 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 5 Dec 2003 23:57:23 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id hB5NvM213989 for ; Fri, 5 Dec 2003 18:57:22 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id hB5NvLb18929; Fri, 5 Dec 2003 18:57:21 -0500 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id hB5NvK628068; Fri, 5 Dec 2003 15:57:20 -0800 Message-ID: <3FD11B60.2040008@redhat.com> Date: Fri, 05 Dec 2003 23:57:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Joel Brobecker CC: gdb-patches@sources.redhat.com Subject: Re: [RFC] Unexpected automatic language switch - get_frame_language() References: <20031205224807.GE716@gnat.com> In-Reply-To: <20031205224807.GE716@gnat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-12/txt/msg00230.txt.bz2 Joel Brobecker wrote: > > So we determine the language by looking up the symtab associated to > the given frame pc. Unfortunately, we were not very lucky in our case > because the call instruction was the last instruction of the function. > And because get_frame_pc actually gives a return address (except for > the bottom frame), the pc return is actually pointing to a different > function. And this is where we're not lucky for the second time, because > the next function is in a different unit written in a different > language! Sounds kinda like a debugging-optimized-code problem. Your function is tail-return optimized -- doesn't really return. That's outside the expected API. I think you have to do "special" things for non-returning functions. I've seen the same sort of thing for eg. _exit. [...] > > So I think the correct way of doing this is to use a decremented PC > for any frame but the bottom one. I think that's fixing the wrong problem. And it's not really portable. [...] > PS: I couldn't reduce the testcase more, the test is too sensitive > to code generation and placement... That's generally a good sign of an optimization problem.