From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30030 invoked by alias); 8 Feb 2002 22:51: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 29883 invoked from network); 8 Feb 2002 22:51:37 -0000 Received: from unknown (HELO zwingli.cygnus.com) (208.245.165.35) by sources.redhat.com with SMTP; 8 Feb 2002 22:51:37 -0000 Received: by zwingli.cygnus.com (Postfix, from userid 442) id 1B92F5E9DE; Fri, 8 Feb 2002 17:53:11 -0500 (EST) To: Daniel Jacobowitz Cc: Jason Merrill , gdb-patches@sources.redhat.com Subject: Re: function pointer stabs (was Re: RFA: MI tests: tolerate prototypes) References: <20020203210609.E5E035E9DE@zwingli.cygnus.com> <20020203180133.C26302@nevyn.them.org> <20020205202132.A17384@nevyn.them.org> <20020208104402.A15801@nevyn.them.org> From: Jim Blandy Date: Fri, 08 Feb 2002 14:51:00 -0000 In-Reply-To: <20020208104402.A15801@nevyn.them.org> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-02/txt/msg00254.txt.bz2 I've been looking at Sun's STABS manual, which seems to only be available from: http://www.cs.ucsb.edu/facilities/software/cc-info/stabs.ps That manual suggests that Sun's compiler emits an N_FUN stab of the form: .stabs "foo:F;;;..." even for non-prototyped functions. So the presence of argument types separated by semicolons still doesn't reliably tell us that the function was defined in prototype form, as I (and apparently stabsread.c) assumed it did. It seems to me that this duplicates the information provided by the N_RSYM and N_PSYM stabs. Whatever. GDB parses this form already. We just need to be aware that its presence does *not* mean "This function was declared in prototype form." For types, Sun emits the 'f' type descriptor for unprototyped function types, and the 'g' type descriptor for prototyped function types. The form seems to be: "g" RETURN-TYPE ARGUMENT-TYPE * "#" The examples in the manual are: int (*fptr) (int, float) .stabs "fptr:G(0,21)=*(0,22)=g(0,3)(0,3)(0,17)#" The second (0,3) is for first argument int, and (0,17) is for second argument float. [sic] More examples: typedef int (*func_type) (int (*) (int, float), float); struct a { int x; my_type* (*fptr1) (int (*) (int, float), float); char y; }; int (*xptr) (int (*) (), int (*) (void), int); // Note int(*)() is function with unknown parameter types .stabs "func_type:t(0,22)=*(0,23)=g(0,3)(0,50)=*(0,51)= g(0,3)(0,3)(0,17)#(0,17)#", N_LSYM,0x0,0x4,0x40 .stabs "a:T(0,24)=s12x:(0,3),0,32;fptr1:(0,25)=*(0,26)=g(0,27)= *(0,3)(0,40)=*(0,41)=g(0,3)(0,3)(0,17)#(0,17)#,32,32;y:(0,1),64,8;;", N_LSYM,0x0,0xc,0x1 .stabs "xptr:G(0,28)=*(0,29)=g(0,3)(0,60)=*(0,61)=f(0,3)(0,62)=*(0,63)= g(0,3)(0,20)#(0,3)#",N_GSYM,0x0,0x4,0x0 But in this case, 'f' really does mean "non-prototyped function", and 'g' really does mean "prototyped function." So we can get accurate information here. I'd be happy if someone would double-check my reading.