Created
June 29, 2019 10:57
-
-
Save danielhams/ea11a50562c38bce2776bb486a676cff to your computer and use it in GitHub Desktop.
Re-introduce MIPS_DEBUGGING_INFO as SGUG_DEBUGGING_INFO (to avoid clashes)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcc/config/mips/iris6.h | 1 + | |
gcc/dwarf2cfi.c | 6 +++++ | |
gcc/dwarf2out.c | 60 +++++++++++++++++++++++++++++++++++++++++ | |
3 files changed, 67 insertions(+) | |
diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h | |
index 54d27aa6be4..1ecde02b3eb 100644 | |
--- a/gcc/config/mips/iris6.h | |
+++ b/gcc/config/mips/iris6.h | |
@@ -62,6 +62,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); | |
/* MIPS specific debugging info */ | |
/* #define MIPS_DEBUGGING_INFO 1 */ | |
+#define SGUG_DEBUGGING_INFO 1 | |
/* Force the generation of dwarf .debug_frame sections even if not | |
compiling -g. This guarantees that we can unwind the stack. */ | |
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c | |
index 07e6a5a2887..3c211453e95 100644 | |
--- a/gcc/dwarf2cfi.c | |
+++ b/gcc/dwarf2cfi.c | |
@@ -797,6 +797,7 @@ def_cfa_0 (dw_cfa_location *old_cfa, dw_cfa_location *new_cfa) | |
cfi->dw_cfi_opc = DW_CFA_def_cfa_offset; | |
cfi->dw_cfi_oprnd1.dw_cfi_offset = const_offset; | |
} | |
+#ifndef SGUG_DEBUGGING_INFO /* SGI dbx thinks this means no offset. */ | |
else if (new_cfa->offset.is_constant () | |
&& known_eq (new_cfa->offset, old_cfa->offset) | |
&& old_cfa->reg != INVALID_REGNUM | |
@@ -811,6 +812,7 @@ def_cfa_0 (dw_cfa_location *old_cfa, dw_cfa_location *new_cfa) | |
cfi->dw_cfi_opc = DW_CFA_def_cfa_register; | |
cfi->dw_cfi_oprnd1.dw_cfi_reg_num = new_cfa->reg; | |
} | |
+#endif | |
else if (new_cfa->indirect == 0 | |
&& new_cfa->offset.is_constant (&const_offset)) | |
{ | |
@@ -3488,6 +3490,10 @@ dwarf2out_do_cfi_asm (void) | |
{ | |
int enc; | |
+#ifdef SGUG_DEBUGGING_INFO | |
+ return false; | |
+#endif | |
+ | |
if (saved_do_cfi_asm != 0) | |
return saved_do_cfi_asm > 0; | |
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c | |
index d94cf7dc928..ee118c4254e 100644 | |
--- a/gcc/dwarf2out.c | |
+++ b/gcc/dwarf2out.c | |
@@ -956,6 +956,11 @@ output_call_frame_info (int for_eh) | |
if (for_eh && targetm.terminate_dw2_eh_frame_info) | |
dw2_asm_output_data (4, 0, "End of Table"); | |
+#ifdef SGUG_DEBUGGING_INFO | |
+ /* Work around Irix 6 assembler bug whereby labels at the end of a section | |
+ get a value of 0. Putting .align 0 after the label fixes it. */ | |
+ ASM_OUTPUT_ALIGN (asm_out_file, 0); | |
+#endif | |
/* Turn off app to make assembly quicker. */ | |
if (flag_debug_asm) | |
app_disable (); | |
@@ -19311,7 +19316,15 @@ add_data_member_location_attribute (dw_die_ref die, | |
/* The DWARF2 standard says that we should assume that the structure | |
address is already on the stack, so we can specify a structure | |
field address by using DW_OP_plus_uconst. */ | |
+ | |
+#ifdef SGUG_DEBUGGING_INFO | |
+ /* ??? The SGI dwarf reader does not handle the DW_OP_plus_uconst | |
+ operator correctly. It works only if we leave the offset on the | |
+ stack. */ | |
+ op = DW_OP_constu; | |
+#else | |
op = DW_OP_plus_uconst; | |
+#endif | |
loc_descr = new_loc_descr (op, offset, 0); | |
} | |
} | |
@@ -21698,6 +21711,17 @@ gen_array_type_die (tree type, dw_die_ref context_die) | |
return; | |
} | |
+ /* ??? The SGI dwarf reader fails for array of array of enum types | |
+ (e.g. const enum machine_mode insn_operand_mode[2][10]) unless the inner | |
+ array type comes before the outer array type. We thus call gen_type_die | |
+ before we new_die and must prevent nested array types collapsing for this | |
+ target. */ | |
+ | |
+#ifdef SGUG_DEBUGGING_INFO | |
+ gen_type_die (TREE_TYPE (type), context_die); | |
+ collapse_nested_arrays = false; | |
+#endif | |
+ | |
array_die = new_die (DW_TAG_array_type, scope_die, type); | |
add_name_attribute (array_die, type_tag (type)); | |
equate_type_number_to_die (type, array_die); | |
@@ -21723,6 +21747,15 @@ gen_array_type_die (tree type, dw_die_ref context_die) | |
add_AT_unsigned (array_die, DW_AT_ordering, DW_ORD_row_major); | |
#endif | |
+#ifdef SGUG_DEBUGGING_INFO | |
+ /* The SGI compilers handle arrays of unknown bound by setting | |
+ AT_declaration and not emitting any subrange DIEs. */ | |
+ if (TREE_CODE (type) == ARRAY_TYPE | |
+ && ! TYPE_DOMAIN (type)) | |
+ add_AT_flag (array_die, DW_AT_declaration, 1); | |
+ else | |
+#endif | |
+ | |
if (TREE_CODE (type) == VECTOR_TYPE) | |
{ | |
/* For VECTOR_TYPEs we use an array die with appropriate bounds. */ | |
@@ -21745,6 +21778,10 @@ gen_array_type_die (tree type, dw_die_ref context_die) | |
element_type = TREE_TYPE (element_type); | |
} | |
+#ifndef SGUG_DEBUGGING_INFO | |
+ gen_type_die (element_type, context_die); | |
+#endif | |
+ | |
add_type_attribute (array_die, element_type, TYPE_UNQUALIFIED, | |
TREE_CODE (type) == ARRAY_TYPE | |
&& TYPE_REVERSE_STORAGE_ORDER (type), | |
@@ -23031,6 +23068,11 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) | |
false); | |
} | |
+#ifdef SGUG_DEBUGGING_INFO | |
+ /* Add a reference to the FDE for this routine. */ | |
+ add_AT_fde_ref (subr_die, DW_AT_MIPS_fde, cfun->fde->fde_index); | |
+#endif | |
+ | |
cfa_fb_offset = CFA_FRAME_BASE_OFFSET (decl); | |
/* We define the "frame base" as the function's CFA. This is more | |
@@ -24267,6 +24309,24 @@ gen_producer_string (void) | |
break; | |
} | |
+ if (!dwarf_record_gcc_switches) | |
+ { | |
+#ifdef SGUG_DEBUGGING_INFO | |
+ /* The MIPS/SGI compilers place the 'cc' command line options in the | |
+ producer string. The SGI debugger looks for -g, -g1, -g2, or -g3; | |
+ if they do not appear in the producer string, the debugger reaches | |
+ the conclusion that the object file is stripped and has no debugging | |
+ information. To get the MIPS/SGI debugger to believe that there is | |
+ debugging information in the object file, we add a -g to the producer | |
+ string. */ | |
+ if (debug_info_level > DINFO_LEVEL_TERSE) | |
+ { | |
+ memcpy (tail, " -g", 3); | |
+ tail += 3; | |
+ } | |
+#endif | |
+ } | |
+ | |
producer = XNEWVEC (char, plen + 1 + len + 1); | |
tail = producer; | |
sprintf (tail, "%s %s", language_string, version_string); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment