Commit 53b2323e by Richard Henderson

common.opt (gdwarf-): Accept a version number.

	* common.opt (gdwarf-): Accept a version number.
	* doc/invoke.texi (gdwarf-): Update docs.
	* opth-gen.awk: Special case -gdwarf+ to OPT_gdwarfplus.
	* opts.c (common_handle_option) [OPT_gdwarf_]: Verify dwarf
	version level, and record it.

	* dwarf2.h (DW_CIE_VERSION): Remove.
	* dwarf2out.c (DWARF_VERSION): Remove.
	(add_fde_cfi): Skip DW_CFA_set_loc addition for dwarf3.
	(output_call_frame_info): Use CIE version 3 for dwarf3,
	or if the return register column is out of range for version 1.
	(dwarf_stack_op_name): Add all dwarf3 values.
	(DEBUG_PUBTYPES_SECTION): New.
	(size_of_die) [dw_val_class_die_ref]: Handle DW_FORM_ref_addr
	encoding change for dwarf3.
	(output_die) [dw_val_class_die_ref]: Likewise.
	(output_compilation_unit_header): Emit correct version for dwarf3.
	(output_line_info): Likewise.
	(output_pubnames): Update for DWARF_VERSION removal.
	(output_aranges): Likewise.
	(gen_subprogram_die): Emit DW_OP_call_frame_cfa if emitting dwarf3.
	(dwarf2out_init): Don't ifdef DEBUG_PUBTYPES_SECTION.
	(dwarf2out_finish): Likewise.

ada/
	* gcc-interface/misc.c (gnat_handle_option): Rename
	OPT_gdwarf_ to OPT_gdwarfplus.

From-SVN: r148408
parent 1c3bbaa7
2009-06-11 Richard Henderson <rth@redhat.com>
* gcc-interface/misc.c (gnat_handle_option): Rename
OPT_gdwarf_ to OPT_gdwarfplus.
2009-06-11 Ed Schonberg <schonberg@adacore.com> 2009-06-11 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Resolve_Attribute, case 'access): Add missing * sem_attr.adb (Resolve_Attribute, case 'access): Add missing
...@@ -105,7 +110,7 @@ ...@@ -105,7 +110,7 @@
* gcc-interface/Make-lang.in: Fix formatting. * gcc-interface/Make-lang.in: Fix formatting.
2009-06-01 Olivier Hainque <hainque@adacore.com> 2009-06-01 Olivier Hainque <hainque@adacore.com>
Eric Botcazou <ebotcazou@adacore.com> Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (convert) <CONSTRUCTOR case>: When converting * gcc-interface/utils.c (convert) <CONSTRUCTOR case>: When converting
to the packable version of the type, clear TREE_STATIC/TREE_CONSTANT to the packable version of the type, clear TREE_STATIC/TREE_CONSTANT
...@@ -113,7 +118,7 @@ ...@@ -113,7 +118,7 @@
as a static constant any more. as a static constant any more.
2009-06-01 Olivier Hainque <hainque@adacore.com> 2009-06-01 Olivier Hainque <hainque@adacore.com>
Eric Botcazou <ebotcazou@adacore.com> Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils2.c (gnat_build_constructor): Factor * gcc-interface/utils2.c (gnat_build_constructor): Factor
out code. Use initializer_constant_valid_for_bitfield_p and out code. Use initializer_constant_valid_for_bitfield_p and
...@@ -293,7 +298,7 @@ ...@@ -293,7 +298,7 @@
GPS. GPS.
* sinput.ads, sinput.adb (Expr_First_Char): New function * sinput.ads, sinput.adb (Expr_First_Char): New function
(Expr_Last_Char): New function (Expr_Last_Char): New function
2009-05-06 Sergey Rybin <rybin@adacore.com> 2009-05-06 Sergey Rybin <rybin@adacore.com>
...@@ -1313,9 +1318,9 @@ ...@@ -1313,9 +1318,9 @@
* prj-proc.adb, prj.adb, prj.ads, prj-nmsc.adb, prj-env.adb * prj-proc.adb, prj.adb, prj.ads, prj-nmsc.adb, prj-env.adb
(Source_Iterator): new type. (Source_Iterator): new type.
This removes the need for having the sources on three different This removes the need for having the sources on three different
lists at the project tree, project and language level. They are now lists at the project tree, project and language level. They are now
on a single list. on a single list.
2009-04-24 Emmanuel Briot <briot@adacore.com> 2009-04-24 Emmanuel Briot <briot@adacore.com>
...@@ -1344,7 +1349,7 @@ ...@@ -1344,7 +1349,7 @@
efficient. efficient.
2009-04-24 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> 2009-04-24 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
Thomas Quinot <quinot@adacore.com> Thomas Quinot <quinot@adacore.com>
* fe.h (Set_Identifier_Casing): Add const to second parameter. * fe.h (Set_Identifier_Casing): Add const to second parameter.
* gcc-interface/misc.c (internal_error_function): Make copy of return * gcc-interface/misc.c (internal_error_function): Make copy of return
...@@ -5522,17 +5527,17 @@ ...@@ -5522,17 +5527,17 @@
2009-04-09 Robert Dewar <dewar@adacore.com> 2009-04-09 Robert Dewar <dewar@adacore.com>
* checks.adb: * checks.adb:
(Insert_Valid_Check): Avoid unnecessary generation of junk declaration (Insert_Valid_Check): Avoid unnecessary generation of junk declaration
when no invalid values exist, Avoid duplicate read of atomic variable. when no invalid values exist, Avoid duplicate read of atomic variable.
* cstand.adb (Build_Signed_Integer_Type): Set Is_Known_Valid * cstand.adb (Build_Signed_Integer_Type): Set Is_Known_Valid
(Standard_Unsigned): Set Is_Known_Valid (Standard_Unsigned): Set Is_Known_Valid
* sem_ch3.adb (Analyze_Subtype_Declaration): Copy Is_Known_Valid on * sem_ch3.adb (Analyze_Subtype_Declaration): Copy Is_Known_Valid on
subtype declaration if no constraint. subtype declaration if no constraint.
(Set_Modular_Size): Set Is_Known_Valid if appropriate (Set_Modular_Size): Set Is_Known_Valid if appropriate
(Build_Derived_Numeric_Type): Copy Is_Known_Valid if no constraint (Build_Derived_Numeric_Type): Copy Is_Known_Valid if no constraint
2009-04-09 Robert Dewar <dewar@adacore.com> 2009-04-09 Robert Dewar <dewar@adacore.com>
......
...@@ -272,8 +272,8 @@ gnat_handle_option (size_t scode, const char *arg, int value) ...@@ -272,8 +272,8 @@ gnat_handle_option (size_t scode, const char *arg, int value)
gnat_argc++; gnat_argc++;
break; break;
case OPT_gdwarf_: case OPT_gdwarfplus:
gnat_dwarf_extensions ++; gnat_dwarf_extensions = 1;
break; break;
default: default:
......
...@@ -1410,12 +1410,12 @@ Common JoinedOrMissing ...@@ -1410,12 +1410,12 @@ Common JoinedOrMissing
Generate debug information in default format Generate debug information in default format
gcoff gcoff
Common JoinedOrMissing Negative(gdwarf-2) Common JoinedOrMissing Negative(gdwarf-)
Generate debug information in COFF format Generate debug information in COFF format
gdwarf-2 gdwarf-
Common JoinedOrMissing Negative(gstabs) Common Joined UInteger Var(dwarf_version) Init(2) Negative(gstabs)
Generate debug information in DWARF v2 format Generate debug information in DWARF v2 (or later) format
ggdb ggdb
Common JoinedOrMissing Common JoinedOrMissing
......
...@@ -310,7 +310,7 @@ Objective-C and Objective-C++ Dialects}. ...@@ -310,7 +310,7 @@ Objective-C and Objective-C++ Dialects}.
-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
-ftest-coverage -ftime-report -fvar-tracking @gol -ftest-coverage -ftime-report -fvar-tracking @gol
-g -g@var{level} -gtoggle -gcoff -gdwarf-2 @gol -g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol -ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol
-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
-fdebug-prefix-map=@var{old}=@var{new} @gol -fdebug-prefix-map=@var{old}=@var{new} @gol
...@@ -4344,13 +4344,14 @@ use of these extensions is likely to make other debuggers crash or ...@@ -4344,13 +4344,14 @@ use of these extensions is likely to make other debuggers crash or
refuse to read the program, and may cause assemblers other than the GNU refuse to read the program, and may cause assemblers other than the GNU
assembler (GAS) to fail with an error. assembler (GAS) to fail with an error.
@item -gdwarf-2 @item -gdwarf-@var{version}
@opindex gdwarf-2 @opindex gdwarf-@var{version}
Produce debugging information in DWARF version 2 format (if that is Produce debugging information in DWARF format (if that is
supported). This is the format used by DBX on IRIX 6. With this supported). This is the format used by DBX on IRIX 6. The value
option, GCC uses features of DWARF version 3 when they are useful; of @var{version} may be either 2 or 3; the default version is 2.
version 3 is upward compatible with version 2, but may still cause
problems for older debuggers. Note that with DWARF version 2 some ports require, and will always
use, some non-conflicting DWARF 3 extensions in the unwind tables.
@item -gvms @item -gvms
@opindex gvms @opindex gvms
...@@ -4384,7 +4385,7 @@ debug information in version 1 of the DWARF format (which is very ...@@ -4384,7 +4385,7 @@ debug information in version 1 of the DWARF format (which is very
different from version 2), and it would have been too confusing. That different from version 2), and it would have been too confusing. That
debug format is long obsolete, but the option cannot be changed now. debug format is long obsolete, but the option cannot be changed now.
Instead use an additional @option{-g@var{level}} option to change the Instead use an additional @option{-g@var{level}} option to change the
debug level for DWARF2. debug level for DWARF.
@item -gtoggle @item -gtoggle
@opindex gtoggle @opindex gtoggle
......
...@@ -782,7 +782,6 @@ enum dwarf_call_frame_info ...@@ -782,7 +782,6 @@ enum dwarf_call_frame_info
#define DW_CIE_ID 0xffffffff #define DW_CIE_ID 0xffffffff
#define DW64_CIE_ID 0xffffffffffffffffULL #define DW64_CIE_ID 0xffffffffffffffffULL
#define DW_CIE_VERSION 1
#define DW_CFA_extended 0 #define DW_CFA_extended 0
......
...@@ -317,8 +317,6 @@ dw_fde_node; ...@@ -317,8 +317,6 @@ dw_fde_node;
#define DWARF_INITIAL_LENGTH_SIZE (DWARF_OFFSET_SIZE == 4 ? 4 : 12) #define DWARF_INITIAL_LENGTH_SIZE (DWARF_OFFSET_SIZE == 4 ? 4 : 12)
#endif #endif
#define DWARF_VERSION 2
/* Round SIZE up to the nearest BOUNDARY. */ /* Round SIZE up to the nearest BOUNDARY. */
#define DWARF_ROUND(SIZE,BOUNDARY) \ #define DWARF_ROUND(SIZE,BOUNDARY) \
((((SIZE) + (BOUNDARY) - 1) / (BOUNDARY)) * (BOUNDARY)) ((((SIZE) + (BOUNDARY) - 1) / (BOUNDARY)) * (BOUNDARY))
...@@ -749,50 +747,51 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi) ...@@ -749,50 +747,51 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi)
gcc_assert (fde != NULL); gcc_assert (fde != NULL);
/* We still have to add the cfi to the list so that /* We still have to add the cfi to the list so that lookup_cfa
lookup_cfa works later on. When -g2 and above we works later on. When -g2 and above we even need to force
even need to force emitting of CFI labels and emitting of CFI labels and add to list a DW_CFA_set_loc for
add to list a DW_CFA_set_loc for convert_cfa_to_fb_loc_list convert_cfa_to_fb_loc_list purposes. If we're generating
purposes. */ DWARF3 output we use DW_OP_call_frame_cfa and so don't use
switch (cfi->dw_cfi_opc) convert_cfa_to_fb_loc_list. */
if (dwarf_version == 2
&& debug_info_level > DINFO_LEVEL_TERSE
&& (write_symbols == DWARF2_DEBUG
|| write_symbols == VMS_AND_DWARF2_DEBUG))
{ {
case DW_CFA_def_cfa_offset: switch (cfi->dw_cfi_opc)
case DW_CFA_def_cfa_offset_sf:
case DW_CFA_def_cfa_register:
case DW_CFA_def_cfa:
case DW_CFA_def_cfa_sf:
case DW_CFA_def_cfa_expression:
case DW_CFA_restore_state:
if (write_symbols != DWARF2_DEBUG
&& write_symbols != VMS_AND_DWARF2_DEBUG)
break;
if (debug_info_level <= DINFO_LEVEL_TERSE)
break;
if (*label == 0 || strcmp (label, "<do not output>") == 0)
label = dwarf2out_cfi_label (true);
if (fde->dw_fde_current_label == NULL
|| strcmp (label, fde->dw_fde_current_label) != 0)
{ {
dw_cfi_ref xcfi; case DW_CFA_def_cfa_offset:
case DW_CFA_def_cfa_offset_sf:
label = xstrdup (label); case DW_CFA_def_cfa_register:
case DW_CFA_def_cfa:
/* Set the location counter to the new label. */ case DW_CFA_def_cfa_sf:
xcfi = new_cfi (); case DW_CFA_def_cfa_expression:
/* It doesn't metter whether DW_CFA_set_loc case DW_CFA_restore_state:
or DW_CFA_advance_loc4 is added here, those aren't if (*label == 0 || strcmp (label, "<do not output>") == 0)
emitted into assembly, only looked up by label = dwarf2out_cfi_label (true);
convert_cfa_to_fb_loc_list. */
xcfi->dw_cfi_opc = DW_CFA_set_loc; if (fde->dw_fde_current_label == NULL
xcfi->dw_cfi_oprnd1.dw_cfi_addr = label; || strcmp (label, fde->dw_fde_current_label) != 0)
add_cfi (&fde->dw_fde_cfi, xcfi); {
fde->dw_fde_current_label = label; dw_cfi_ref xcfi;
}
break; label = xstrdup (label);
default:
break; /* Set the location counter to the new label. */
xcfi = new_cfi ();
/* It doesn't metter whether DW_CFA_set_loc
or DW_CFA_advance_loc4 is added here, those aren't
emitted into assembly, only looked up by
convert_cfa_to_fb_loc_list. */
xcfi->dw_cfi_opc = DW_CFA_set_loc;
xcfi->dw_cfi_oprnd1.dw_cfi_addr = label;
add_cfi (&fde->dw_fde_cfi, xcfi);
fde->dw_fde_current_label = label;
}
break;
default:
break;
}
} }
output_cfi_directive (cfi); output_cfi_directive (cfi);
...@@ -3197,6 +3196,7 @@ output_call_frame_info (int for_eh) ...@@ -3197,6 +3196,7 @@ output_call_frame_info (int for_eh)
int per_encoding = DW_EH_PE_absptr; int per_encoding = DW_EH_PE_absptr;
int lsda_encoding = DW_EH_PE_absptr; int lsda_encoding = DW_EH_PE_absptr;
int return_reg; int return_reg;
int dw_cie_version;
/* Don't emit a CIE if there won't be any FDEs. */ /* Don't emit a CIE if there won't be any FDEs. */
if (fde_table_in_use == 0) if (fde_table_in_use == 0)
...@@ -3277,7 +3277,14 @@ output_call_frame_info (int for_eh) ...@@ -3277,7 +3277,14 @@ output_call_frame_info (int for_eh)
(for_eh ? 0 : DWARF_CIE_ID), (for_eh ? 0 : DWARF_CIE_ID),
"CIE Identifier Tag"); "CIE Identifier Tag");
dw2_asm_output_data (1, DW_CIE_VERSION, "CIE Version"); /* Use the CIE version 3 for DWARF3; allow DWARF2 to continue to
use CIE version 1, unless that would produce incorrect results
due to overflowing the return register column. */
return_reg = DWARF2_FRAME_REG_OUT (DWARF_FRAME_RETURN_COLUMN, for_eh);
dw_cie_version = 1;
if (return_reg >= 256 || dwarf_version > 2)
dw_cie_version = 3;
dw2_asm_output_data (1, dw_cie_version, "CIE Version");
augmentation[0] = 0; augmentation[0] = 0;
augmentation_size = 0; augmentation_size = 0;
...@@ -3349,8 +3356,7 @@ output_call_frame_info (int for_eh) ...@@ -3349,8 +3356,7 @@ output_call_frame_info (int for_eh)
dw2_asm_output_data_sleb128 (DWARF_CIE_DATA_ALIGNMENT, dw2_asm_output_data_sleb128 (DWARF_CIE_DATA_ALIGNMENT,
"CIE Data Alignment Factor"); "CIE Data Alignment Factor");
return_reg = DWARF2_FRAME_REG_OUT (DWARF_FRAME_RETURN_COLUMN, for_eh); if (dw_cie_version == 1)
if (DW_CIE_VERSION == 1)
dw2_asm_output_data (1, return_reg, "CIE RA Column"); dw2_asm_output_data (1, return_reg, "CIE RA Column");
else else
dw2_asm_output_data_uleb128 (return_reg, "CIE RA Column"); dw2_asm_output_data_uleb128 (return_reg, "CIE RA Column");
...@@ -4187,6 +4193,7 @@ dwarf_stack_op_name (unsigned int op) ...@@ -4187,6 +4193,7 @@ dwarf_stack_op_name (unsigned int op)
return "DW_OP_xderef_size"; return "DW_OP_xderef_size";
case DW_OP_nop: case DW_OP_nop:
return "DW_OP_nop"; return "DW_OP_nop";
case DW_OP_push_object_address: case DW_OP_push_object_address:
return "DW_OP_push_object_address"; return "DW_OP_push_object_address";
case DW_OP_call2: case DW_OP_call2:
...@@ -4195,10 +4202,20 @@ dwarf_stack_op_name (unsigned int op) ...@@ -4195,10 +4202,20 @@ dwarf_stack_op_name (unsigned int op)
return "DW_OP_call4"; return "DW_OP_call4";
case DW_OP_call_ref: case DW_OP_call_ref:
return "DW_OP_call_ref"; return "DW_OP_call_ref";
case DW_OP_form_tls_address:
return "DW_OP_form_tls_address";
case DW_OP_call_frame_cfa:
return "DW_OP_call_frame_cfa";
case DW_OP_bit_piece:
return "DW_OP_bit_piece";
case DW_OP_GNU_push_tls_address: case DW_OP_GNU_push_tls_address:
return "DW_OP_GNU_push_tls_address"; return "DW_OP_GNU_push_tls_address";
case DW_OP_GNU_uninit: case DW_OP_GNU_uninit:
return "DW_OP_GNU_uninit"; return "DW_OP_GNU_uninit";
case DW_OP_GNU_encoded_addr:
return "DW_OP_GNU_encoded_addr";
default: default:
return "OP_<unknown>"; return "OP_<unknown>";
} }
...@@ -5617,6 +5634,9 @@ static int maybe_emit_file (struct dwarf_file_data *fd); ...@@ -5617,6 +5634,9 @@ static int maybe_emit_file (struct dwarf_file_data *fd);
#ifndef DEBUG_PUBNAMES_SECTION #ifndef DEBUG_PUBNAMES_SECTION
#define DEBUG_PUBNAMES_SECTION ".debug_pubnames" #define DEBUG_PUBNAMES_SECTION ".debug_pubnames"
#endif #endif
#ifndef DEBUG_PUBTYPES_SECTION
#define DEBUG_PUBTYPES_SECTION ".debug_pubtypes"
#endif
#ifndef DEBUG_STR_SECTION #ifndef DEBUG_STR_SECTION
#define DEBUG_STR_SECTION ".debug_str" #define DEBUG_STR_SECTION ".debug_str"
#endif #endif
...@@ -7869,7 +7889,6 @@ build_abbrev_table (dw_die_ref die) ...@@ -7869,7 +7889,6 @@ build_abbrev_table (dw_die_ref die)
&& AT_ref (a)->die_mark == 0) && AT_ref (a)->die_mark == 0)
{ {
gcc_assert (AT_ref (a)->die_symbol); gcc_assert (AT_ref (a)->die_symbol);
set_AT_ref_external (a, 1); set_AT_ref_external (a, 1);
} }
...@@ -7997,7 +8016,9 @@ size_of_die (dw_die_ref die) ...@@ -7997,7 +8016,9 @@ size_of_die (dw_die_ref die)
size += 1; size += 1;
break; break;
case dw_val_class_die_ref: case dw_val_class_die_ref:
if (AT_ref_external (a)) /* In DWARF2, DW_FORM_ref_addr is sized by target address length,
whereas in DWARF3 it's always sized as an offset. */
if (AT_ref_external (a) && dwarf_version == 2)
size += DWARF2_ADDR_SIZE; size += DWARF2_ADDR_SIZE;
else else
size += DWARF_OFFSET_SIZE; size += DWARF_OFFSET_SIZE;
...@@ -8526,10 +8547,17 @@ output_die (dw_die_ref die) ...@@ -8526,10 +8547,17 @@ output_die (dw_die_ref die)
if (AT_ref_external (a)) if (AT_ref_external (a))
{ {
char *sym = AT_ref (a)->die_symbol; char *sym = AT_ref (a)->die_symbol;
int size;
gcc_assert (sym); gcc_assert (sym);
dw2_asm_output_offset (DWARF2_ADDR_SIZE, sym, debug_info_section,
"%s", name); /* In DWARF2, DW_FORM_ref_addr is sized by target address
length, whereas in DWARF3 it's always sized as an offset. */
if (dwarf_version == 2)
size = DWARF2_ADDR_SIZE;
else
size = DWARF_OFFSET_SIZE;
dw2_asm_output_offset (size, sym, debug_info_section, "%s", name);
} }
else else
{ {
...@@ -8608,7 +8636,7 @@ output_compilation_unit_header (void) ...@@ -8608,7 +8636,7 @@ output_compilation_unit_header (void)
dw2_asm_output_data (DWARF_OFFSET_SIZE, dw2_asm_output_data (DWARF_OFFSET_SIZE,
next_die_offset - DWARF_INITIAL_LENGTH_SIZE, next_die_offset - DWARF_INITIAL_LENGTH_SIZE,
"Length of Compilation Unit Info"); "Length of Compilation Unit Info");
dw2_asm_output_data (2, DWARF_VERSION, "DWARF version number"); dw2_asm_output_data (2, dwarf_version, "DWARF version number");
dw2_asm_output_offset (DWARF_OFFSET_SIZE, abbrev_section_label, dw2_asm_output_offset (DWARF_OFFSET_SIZE, abbrev_section_label,
debug_abbrev_section, debug_abbrev_section,
"Offset Into Abbrev. Section"); "Offset Into Abbrev. Section");
...@@ -8689,7 +8717,6 @@ add_pubname_string (const char *str, dw_die_ref die) ...@@ -8689,7 +8717,6 @@ add_pubname_string (const char *str, dw_die_ref die)
static void static void
add_pubname (tree decl, dw_die_ref die) add_pubname (tree decl, dw_die_ref die)
{ {
if (TREE_PUBLIC (decl)) if (TREE_PUBLIC (decl))
add_pubname_string (dwarf2_name (decl, 1), die); add_pubname_string (dwarf2_name (decl, 1), die);
} }
...@@ -8749,7 +8776,8 @@ output_pubnames (VEC (pubname_entry, gc) * names) ...@@ -8749,7 +8776,8 @@ output_pubnames (VEC (pubname_entry, gc) * names)
else else
dw2_asm_output_data (DWARF_OFFSET_SIZE, pubnames_length, dw2_asm_output_data (DWARF_OFFSET_SIZE, pubnames_length,
"Length of Public Type Names Info"); "Length of Public Type Names Info");
dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version"); /* Version number for pubnames/pubtypes is still 2, even in DWARF3. */
dw2_asm_output_data (2, 2, "DWARF Version");
dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label, dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label,
debug_info_section, debug_info_section,
"Offset of Compilation Unit Info"); "Offset of Compilation Unit Info");
...@@ -8811,7 +8839,8 @@ output_aranges (void) ...@@ -8811,7 +8839,8 @@ output_aranges (void)
"Initial length escape value indicating 64-bit DWARF extension"); "Initial length escape value indicating 64-bit DWARF extension");
dw2_asm_output_data (DWARF_OFFSET_SIZE, aranges_length, dw2_asm_output_data (DWARF_OFFSET_SIZE, aranges_length,
"Length of Address Ranges Info"); "Length of Address Ranges Info");
dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version"); /* Version number for aranges is still 2, even in DWARF3. */
dw2_asm_output_data (2, 2, "DWARF Version");
dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label, dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label,
debug_info_section, debug_info_section,
"Offset of Compilation Unit Info"); "Offset of Compilation Unit Info");
...@@ -9356,7 +9385,7 @@ output_line_info (void) ...@@ -9356,7 +9385,7 @@ output_line_info (void)
"Length of Source Line Info"); "Length of Source Line Info");
ASM_OUTPUT_LABEL (asm_out_file, l1); ASM_OUTPUT_LABEL (asm_out_file, l1);
dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version"); dw2_asm_output_data (2, dwarf_version, "DWARF Version");
dw2_asm_output_delta (DWARF_OFFSET_SIZE, p2, p1, "Prolog Length"); dw2_asm_output_delta (DWARF_OFFSET_SIZE, p2, p1, "Prolog Length");
ASM_OUTPUT_LABEL (asm_out_file, p1); ASM_OUTPUT_LABEL (asm_out_file, p1);
...@@ -14079,17 +14108,19 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) ...@@ -14079,17 +14108,19 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
(3) We can at least reuse the code inspection and interpretation (3) We can at least reuse the code inspection and interpretation
code that determines the CFA position at various points in the code that determines the CFA position at various points in the
function. */ function. */
/* ??? Use some command-line or configury switch to enable the use if (dwarf_version >= 3)
of dwarf3 DW_OP_call_frame_cfa. At present there are no dwarf {
consumers that understand it; fall back to "pure" dwarf2 and dw_loc_descr_ref op = new_loc_descr (DW_OP_call_frame_cfa, 0, 0);
convert the CFA data into a location list. */ add_AT_loc (subr_die, DW_AT_frame_base, op);
{ }
dw_loc_list_ref list = convert_cfa_to_fb_loc_list (cfa_fb_offset); else
if (list->dw_loc_next) {
add_AT_loc_list (subr_die, DW_AT_frame_base, list); dw_loc_list_ref list = convert_cfa_to_fb_loc_list (cfa_fb_offset);
else if (list->dw_loc_next)
add_AT_loc (subr_die, DW_AT_frame_base, list->expr); add_AT_loc_list (subr_die, DW_AT_frame_base, list);
} else
add_AT_loc (subr_die, DW_AT_frame_base, list->expr);
}
/* Compute a displacement from the "steady-state frame pointer" to /* Compute a displacement from the "steady-state frame pointer" to
the CFA. The former is what all stack slots and argument slots the CFA. The former is what all stack slots and argument slots
...@@ -16457,10 +16488,8 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED) ...@@ -16457,10 +16488,8 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
SECTION_DEBUG, NULL); SECTION_DEBUG, NULL);
debug_pubnames_section = get_section (DEBUG_PUBNAMES_SECTION, debug_pubnames_section = get_section (DEBUG_PUBNAMES_SECTION,
SECTION_DEBUG, NULL); SECTION_DEBUG, NULL);
#ifdef DEBUG_PUBTYPES_SECTION
debug_pubtypes_section = get_section (DEBUG_PUBTYPES_SECTION, debug_pubtypes_section = get_section (DEBUG_PUBTYPES_SECTION,
SECTION_DEBUG, NULL); SECTION_DEBUG, NULL);
#endif
debug_str_section = get_section (DEBUG_STR_SECTION, debug_str_section = get_section (DEBUG_STR_SECTION,
DEBUG_STR_SECTION_FLAGS, NULL); DEBUG_STR_SECTION_FLAGS, NULL);
debug_ranges_section = get_section (DEBUG_RANGES_SECTION, debug_ranges_section = get_section (DEBUG_RANGES_SECTION,
...@@ -17092,14 +17121,15 @@ dwarf2out_finish (const char *filename) ...@@ -17092,14 +17121,15 @@ dwarf2out_finish (const char *filename)
output_pubnames (pubname_table); output_pubnames (pubname_table);
} }
#ifdef DEBUG_PUBTYPES_SECTION
/* Output public types table if necessary. */ /* Output public types table if necessary. */
/* ??? Only defined by DWARF3, but emitted by Darwin for DWARF2.
It shouldn't hurt to emit it always, since pure DWARF2 consumers
simply won't look for the section. */
if (!VEC_empty (pubname_entry, pubtype_table)) if (!VEC_empty (pubname_entry, pubtype_table))
{ {
switch_to_section (debug_pubtypes_section); switch_to_section (debug_pubtypes_section);
output_pubnames (pubtype_table); output_pubnames (pubtype_table);
} }
#endif
/* Output the address range information. We only put functions in the arange /* Output the address range information. We only put functions in the arange
table, so don't write it out if we don't have any. */ table, so don't write it out if we don't have any. */
......
...@@ -333,6 +333,8 @@ for (i = 0; i < n_opts; i++) { ...@@ -333,6 +333,8 @@ for (i = 0; i < n_opts; i++) {
enum = "OPT_" opts[i] enum = "OPT_" opts[i]
if (opts[i] == "finline-limit=" || opts[i] == "Wlarger-than=") if (opts[i] == "finline-limit=" || opts[i] == "Wlarger-than=")
enum = enum "eq" enum = enum "eq"
if (opts[i] == "gdwarf+")
enum = "OPT_gdwarfplus"
gsub ("[^A-Za-z0-9]", "_", enum) gsub ("[^A-Za-z0-9]", "_", enum)
# If this switch takes joined arguments, back-chain all # If this switch takes joined arguments, back-chain all
...@@ -348,7 +350,7 @@ for (i = 0; i < n_opts; i++) { ...@@ -348,7 +350,7 @@ for (i = 0; i < n_opts; i++) {
} }
} }
s = substr(" ", length (opts[i])) s = substr(" ", length (enum))
if (i + 1 == n_opts) if (i + 1 == n_opts)
comma = "" comma = ""
......
...@@ -2033,8 +2033,12 @@ common_handle_option (size_t scode, const char *arg, int value, ...@@ -2033,8 +2033,12 @@ common_handle_option (size_t scode, const char *arg, int value,
set_debug_level (SDB_DEBUG, false, arg); set_debug_level (SDB_DEBUG, false, arg);
break; break;
case OPT_gdwarf_2: case OPT_gdwarf_:
set_debug_level (DWARF2_DEBUG, false, arg); if (value < 2 || value > 3)
error ("dwarf version %d is not supported", value);
else
dwarf_version = value;
set_debug_level (DWARF2_DEBUG, false, "");
break; break;
case OPT_ggdb: case OPT_ggdb:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment