No debug information is generated to describe function arguments for function pointers. This can be seen with gdb, as well as examining the stabs output in the assembly file. The specification for stabs appears to support lists of function arguments for any function types and since a function pointer is just a pointer to a function type this information should be included. Apologies if I misinterpreted what the "debug" category is for. Release: gcc (GCC) 3.2 20020927 (prerelease) Environment: cygwin How-To-Repeat: Compile something like "int (g_pf*)(); char (g_pf2*)(int,char*,int*);" with gcc -g option. Load the resulting executable into gdb, but don't run it - instead just type whatis g_pf (it will say "int (*)(void)") and then type whatis g_pf2 (it will sat "char (*)(void)" !!) The function argument information is completely missing from the debug info. The argument info is also missing from gcc -gdump-translation-unit
Fix: The stabs information for g_pf2 generated by gcc contains just .stabs "g_pf2:G(1,7)=*(1,8)=f(0,1)",32,0,4,0 but it should include function argument type information as described in the Type section for stabs type "f" in 'info stabs'.
From: Daniel Jacobowitz <drow@mvista.com> To: bangerth@dealii.org, dave@rebuzz.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org Cc: Subject: Re: debug/9161: stabs: No function argument debug info for function pointers Date: Fri, 14 Mar 2003 16:26:45 -0500 On Fri, Mar 14, 2003 at 09:23:34PM -0000, bangerth@dealii.org wrote: > Old Synopsis: No function argument debug info for function pointers > New Synopsis: stabs: No function argument debug info for function pointers > > State-Changed-From-To: open->analyzed > State-Changed-By: bangerth > State-Changed-When: Fri Mar 14 21:23:33 2003 > State-Changed-Why: > Confirmed also on x86-linux with mainline, when using > -gstabs: > > g/x> cat x.cc > int (*p1) (); > int (*p2) (int); > > int main () > {} > > g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -gstabs x.cc > > g/x> gdb a.out > GNU gdb 5.1.1 > Copyright 2002 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and you are > welcome to change it and/or distribute copies of it under certain conditions. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. Type "show warranty" for details. > This GDB was configured as "i386-suse-linux"... > (gdb) ptype p1 > type = int (*)(void) > (gdb) ptype p2 > type = int (*)(void) Yes. There's a stabs syntax for this that GCC doesn't support. I think GDB would recognize it if we generated it, but I don't really remember. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed also on x86-linux with mainline, when using -gstabs: g/x> cat x.cc int (*p1) (); int (*p2) (int); int main () {} g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -gstabs x.cc g/x> gdb a.out GNU gdb 5.1.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-suse-linux"... (gdb) ptype p1 type = int (*)(void) (gdb) ptype p2 type = int (*)(void) W.
stabs debugging support was removed: r13-2361-g7e0db0cdf01e9c so closing as won't fix.