This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB 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: Section .debug_info in object file


At 01:49 PM 14-09-02 +0200, Pierre Habraken wrote:
>In any case, I wonder what is the exact purpose of the option --gdwarf2
>of gas ? :
>On one hand, if it is supposed to make the .debug_info section be
>generated, the latter should include all relevant debugging information.
>On the other hand, if it not supposed to make the .debug_info section be
>created, what is its use ?

When the assembler is invoked by the compiler to assemble the code
generated for compiled sources the assembler should NOT be invoked with the
-gdwarf2.    The compiler supplies the DWARF2 debugging information for the
sources being compiled by the compiler.    It is therefore the
responsibility of the compiler to supply the DWARF2 information to describe
the source file being compiled.

When the assembler is being invoked to assembler user supplied assembler
files then the -gdwarf2 flag can be used to make the assembler generate the
DWARF2 debugging information which describes the assembler file.     [This
is primarily the line to address table.]    In this case it is the
responsibility of the assembler to supply the DWARF2 information to
describe the  file being assembled.

>I also noticed that option -g passed to the C compiler is sufficient for
>getting a .debug_info section. So my question is : why would I use the
>option -gdwarf-2 instead of -g ?...

gcc can be build for different targets (e.g. arm-elf-gcc, arm-linux-gcc).
  When you use -g the compiler will generate the debugging information in
the default format for the appropriate target.     For arm-elf-gcc this is
usually DWARF2 and for arm-linux-gcc this is usually STABS.        The
-gdwarf2 flag therefore overides the default format and explicitly
specifies that DWARF2 debuggging information is required.

Keith

Keith Walker		keith.walker@arm.com		Tel:+44 (1628) 427732
ARM Ltd		http://www.arm.com


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