From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26412 invoked by alias); 2 Feb 2002 17:57:37 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 26279 invoked from network); 2 Feb 2002 17:57:34 -0000 Received: from unknown (HELO rj.sgi.com) (204.94.215.100) by sources.redhat.com with SMTP; 2 Feb 2002 17:57:34 -0000 Received: from cthulhu.engr.sgi.com (cthulhu.engr.sgi.com [192.26.80.2]) by rj.sgi.com (8.11.4/8.11.4/linux-outbound_gateway-1.1) with ESMTP id g12HvYY16543 for ; Sat, 2 Feb 2002 09:57:34 -0800 Received: from quasar.engr.sgi.com (quasar.engr.sgi.com [130.62.180.91]) by cthulhu.engr.sgi.com (SGI-8.9.3/8.9.3) with ESMTP id JAA94536 for ; Sat, 2 Feb 2002 09:56:40 -0800 (PST) Received: (from davea@localhost) by quasar.engr.sgi.com (SGI-8.9.3/8.9.3) id JAA54477 for gdb@sources.redhat.com; Sat, 2 Feb 2002 09:57:14 -0800 (PST) Date: Sat, 02 Feb 2002 09:57:00 -0000 From: David Anderson Message-Id: <200202021757.JAA54477@quasar.engr.sgi.com> To: gdb@sources.redhat.com Subject: MIPS stack tracing X-SW-Source: 2002-02/txt/msg00051.txt.bz2 On Thu, Jan 31, 2002 at 05:27:30PM -0500, Don Bowman wrote: ... > The problem is that the compiler emits multiple returns > per function. The algorithm gdb follows is that specified > by the SYSV ABI (which the compiler is breaking). I looked The only SYSV ABI document on MIPS that I am aware of is the MIPS Processor Supplement. That document applies to what SGI calls -32 or o32, the old-32bit ABI. The section "Standard Called Function Rules" in that document gives the rule, page 3-18 in my copy. I am *presuming* that is what you refer to here. If not, then... the following is 'incomplete'. Modern gcc (for modern MIPS targets) emits code in what SGI calls the n32 or 64 ABIs (or variations thereof, for other MIPS users), and those ABIs are not defined by the SYSV ABI Mips Processor Supplement! For these other ABIs, multiple returns per function are allowed and normal. For non-SGI ABIs the rules are, well, whatever they are. MIPS is the best source of info, and "See MIPS Run" by Sweetman has been mentioned by others here as a good book on MIPS (I concur). The SGI n32 ABI document is available for anyone that wishes to see it. http://techpubs.sgi.com specifically: http://techpubs.sgi.com/library/tpl/cgi-bin/browse.cgi? coll=0650&db=bks&cmd=toc&pth=/SGI_Developer/Mpro_n32_ABI (I broke that long URL by hand: rejoin it for the URL to work) Aside: in spite of the ABI rule, the MIPS compilers for the old-32bit ABI case when -O3 was used always could generate multiple returns for a function and did at times!! (but -O3 was relatively rarely used for old-32bit ABI compiles) For SGI the n32 and 64 ABIs are defined by other SGI documents (such as the n32 book) and for other folks using MIPS processors they are defined by MIPS or whoever 'controls' (whatever that means) the particular target ABI. In short, you've been mislead by a document which no longer applies. gcc is not violating any rule I know of by generating multiple returns per function. Corrections welcome. David Anderson davea@sgi.com