From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3653 invoked by alias); 8 Feb 2002 18:03:50 -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 3465 invoked from network); 8 Feb 2002 18:03:47 -0000 Received: from unknown (HELO zwingli.cygnus.com) (208.245.165.35) by sources.redhat.com with SMTP; 8 Feb 2002 18:03:47 -0000 Received: by zwingli.cygnus.com (Postfix, from userid 442) id E7F125E9DE; Fri, 8 Feb 2002 13:05:19 -0500 (EST) To: Daniel Jacobowitz Cc: Andrew Cagney , gdb-patches@sources.redhat.com, Jason Merrill Subject: Re: RFA: MI tests: tolerate prototypes References: <20020203210609.E5E035E9DE@zwingli.cygnus.com> <20020203180133.C26302@nevyn.them.org> <20020205202132.A17384@nevyn.them.org> <20020206004829.A1357@nevyn.them.org> <3C61C6EB.5060908@cygnus.com> <20020207152709.A27386@nevyn.them.org> From: Jim Blandy Date: Fri, 08 Feb 2002 10:03:00 -0000 In-Reply-To: <20020207152709.A27386@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/msg00243.txt.bz2 Daniel Jacobowitz writes: > > GCC's STABS describe prototyped function types as if they were > > non-prototyped function types. However, it does provide accurate > > pass-as types for function definitions. This means that GDB can > > correctly call functions under STABS if it reads function definition > > types *as if* they were prototyped, using the pass-as types as the > > argument types. > > > > The downsides of this proposal: > > > > - GDB will print function argument types incorrectly. For example, > > suppose we have the following function definition: > > > > int f (short s, float f) { return s + f; } > > > > Since the arguments' pass-as types for `s' and `f' are `int' and > > `double', GDB will print f's type as `int f(int, double)'. This is > > weird, but it's a direct consequence of lying about the type. > > Clarification: If f were not prototyped, this would be true. So it's a > very small price to pay, IMHO. If it is prototyped, the pass-as type > for f will be float, right? Jeez, it's not like this isn't confusing enough already without my consistently writing the opposite of what I mean. I meant to write: int f (s, f) short s; float f; { return s + f; } That function will end up with pass-as types of `int' and `double', as required by C's rules (which are not target-specific). It will have use-as types of `short' and `float'. Seeing an apparently unprototyped function definition in STABS, GDB would (under the proposal) construct a prototyped type with `int' and `double' as its argument types. The drawback here is that GDB will print the function's type as `int f (int, double)', instead of the more correct `int f ()'. The benefit is that GDB will be able to call all functions for which it can find definitions correctly --- a benefit which my `maybe-prototyped' proposal doesn't offer.