This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using -gstabs may miss some stabs


In message <200202121853.g1CIrAX06737@fred.ninemoons.com>, Fred Fish writes:
 > I just noticed something.  Using the gcc released with Redhat Linux
 > 7.2 (gcc version 2.96 20000731) if you give it the option -gstabs, the
 > FUN stabs that terminate functions are missing:
 > 
 >   $ /usr/bin/g++ -g -S p1.cpp
 >   $ grep ,36, p1.s
 >   .stabs "main__9MainClass:F(0,21)",36,0,12,main__9MainClass
 >   .stabs "",36,0,0,.Lscope0-main__9MainClass
 >   .stabs "main:F(0,1)",36,0,16,main
 >   .stabs "",36,0,0,.Lscope1-main
 >   .stabs "__tf9MainClass:F(0,37)=&(0,38)=xstype_info:",36,0,9,__tf9MainClass
 >   .stabs "",36,0,0,.Lscope2-__tf9MainClass
 >   .stabs "__9MainClass:F(0,25)",36,0,6,__9MainClass
 >   .stabs "",36,0,0,.Lscope3-__9MainClass
 >   .stabs "_._9MainClass:F(0,21)",36,0,7,_._9MainClass
 >   .stabs "",36,0,0,.Lscope4-_._9MainClass
 >   $ /usr/bin/g++ -gstabs -S p1.cpp
 >   $ grep ,36, p1.s
 >   .stabs "main__9MainClass:F(0,21)",36,0,0,main__9MainClass
 >   .stabs "main:F(0,1)",36,0,0,main
 >   .stabs "__tf9MainClass:F(0,31)=*(0,32)=xstype_info:",36,0,0,__tf9MainClass
 >   .stabs "__9MainClass:F(0,25)",36,0,0,__9MainClass
 >   .stabs "_._9MainClass:F(0,21)",36,0,0,_._9MainClass
 >   $
 > 
 > Notice in the first compile, the default is stabs, and each function
 > generates a leading and trailing FUN stab.
 > 
 > However when explicitly specifying stabs via "-gstabs", the trailing
 > stabs are missing.
I believe "-gstabs" puts the compiler into stabs, but without GNU extensions
mode?  The trailing N_FUN is a GNU extension.

The trailing N_FUN extension was created to deal with debugging issues that
arise when functions that are contiguous in a .o file are not necessarily
contiguous in the final executable.  This can happen with ctors/dtors, or
-ffunction-sections or explicit sectioning support.  In theory, GDB should
be able to cope without the trailing N_FUN -- with the caveat that if the
functions in a .o are not contiguous in the final executable then, well,
you're pretty much hosed.

jeff



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]