diff options
-rw-r--r-- | gcc/config/mips/mips.h | 9 | ||||
-rw-r--r-- | gcc/dwarf2.h | 80 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 68 |
3 files changed, 55 insertions, 102 deletions
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 0093ed5..f1b4d05 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -920,10 +920,17 @@ while (0) since the length can run past this up to a continuation point. */ #define DBX_CONTIN_LENGTH 1500 - /* How to renumber registers for dbx and gdb. */ #define DBX_REGISTER_NUMBER(REGNO) mips_dbx_regno[ (REGNO) ] +/* The mapping from gcc register number to DWARF 2 CFA column number. + This mapping does not allow for tracking DBX register 0, since column 0 + is used for the frame address, but since register 0 is fixed this is + not really a problem. */ +#define DWARF_FRAME_REGNUM(REG) (DBX_REGISTER_NUMBER (REG)) + +/* The DWARF 2 CFA column which tracks the return address. */ +#define DWARF_FRAME_RETURN_COLUMN (FP_REG_LAST + 1) /* Overrides for the COFF debug format. */ #define PUT_SDB_SCL(a) \ diff --git a/gcc/dwarf2.h b/gcc/dwarf2.h index 98556cd..b16c4a3 100644 --- a/gcc/dwarf2.h +++ b/gcc/dwarf2.h @@ -503,82 +503,6 @@ enum dwarf_call_frame_info #define DW_CFA_low_user 0x1c #define DW_CFA_high_user 0x3f -/* SGI/MIPS call frame register usage information */ -enum dwarf_call_reg_usage - { - DW_FRAME_CFA_COL = 0, - DW_FRAME_REG1 = 1, - DW_FRAME_REG2 = 2, - DW_FRAME_REG3 = 3, - DW_FRAME_REG4 = 4, - DW_FRAME_REG5 = 5, - DW_FRAME_REG6 = 6, - DW_FRAME_REG7 = 7, - DW_FRAME_REG8 = 8, - DW_FRAME_REG9 = 9, - DW_FRAME_REG10 = 10, - DW_FRAME_REG11 = 11, - DW_FRAME_REG12 = 12, - DW_FRAME_REG13 = 13, - DW_FRAME_REG14 = 14, - DW_FRAME_REG15 = 15, - DW_FRAME_REG16 = 16, - DW_FRAME_REG17 = 17, - DW_FRAME_REG18 = 18, - DW_FRAME_REG19 = 19, - DW_FRAME_REG20 = 20, - DW_FRAME_REG21 = 21, - DW_FRAME_REG22 = 22, - DW_FRAME_REG23 = 23, - DW_FRAME_REG24 = 24, - DW_FRAME_REG25 = 25, - DW_FRAME_REG26 = 26, - DW_FRAME_REG27 = 27, - DW_FRAME_REG28 = 28, - DW_FRAME_REG29 = 29, - DW_FRAME_REG30 = 30, - DW_FRAME_REG31 = 31, - DW_FRAME_FREG0 = 32, - DW_FRAME_FREG1 = 33, - DW_FRAME_FREG2 = 34, - DW_FRAME_FREG3 = 35, - DW_FRAME_FREG4 = 36, - DW_FRAME_FREG5 = 37, - DW_FRAME_FREG6 = 38, - DW_FRAME_FREG7 = 39, - DW_FRAME_FREG8 = 40, - DW_FRAME_FREG9 = 41, - DW_FRAME_FREG10 = 42, - DW_FRAME_FREG11 = 43, - DW_FRAME_FREG12 = 44, - DW_FRAME_FREG13 = 45, - DW_FRAME_FREG14 = 46, - DW_FRAME_FREG15 = 47, - DW_FRAME_FREG16 = 48, - DW_FRAME_FREG17 = 49, - DW_FRAME_FREG18 = 50, - DW_FRAME_FREG19 = 51, - DW_FRAME_FREG20 = 52, - DW_FRAME_FREG21 = 53, - DW_FRAME_FREG22 = 54, - DW_FRAME_FREG23 = 55, - DW_FRAME_FREG24 = 56, - DW_FRAME_FREG25 = 57, - DW_FRAME_FREG26 = 58, - DW_FRAME_FREG27 = 59, - DW_FRAME_FREG28 = 60, - DW_FRAME_FREG29 = 61, - DW_FRAME_FREG30 = 62, - DW_FRAME_FREG31 = 63, - DW_FRAME_RA_COL = 64, - DW_FRAME_STATIC_LINK = 65 - }; - -/* This is the number of columns in the Frame Table. */ -#define DW_FRAME_LAST_REG_NUM 66 - - - #define DW_CHILDREN_no 0x00 #define DW_CHILDREN_yes 0x01 @@ -605,7 +529,7 @@ enum dwarf_source_language #define DW_LANG_lo_user 0x8000 /* implementation-defined range start */ #define DW_LANG_hi_user 0xffff /* implementation-defined range start */ -/* Names and codes for GNU "macinfo" extension. */ +/* Names and codes for macro information. */ enum dwarf_macinfo_record_type { @@ -613,5 +537,5 @@ enum dwarf_macinfo_record_type DW_MACINFO_undef = 2, DW_MACINFO_start_file = 3, DW_MACINFO_end_file = 4, - DW_MACINFO_vend_ext = 255 + DW_MACINFO_vendor_ext = 255 }; diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index c6a025b..439ee1e 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -310,9 +310,19 @@ extern char *language_string; #define DWARF_ARANGES_HEADER_SIZE \ (DWARF_ROUND (2 * DWARF_OFFSET_SIZE + 4, PTR_SIZE * 2) - DWARF_OFFSET_SIZE) -/* Fixed size portion of the Common Information Entry (including - the length field). */ -#define DWARF_CIE_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 8) +/* Length of the target-dependent instructions in the + Common Information Entry (CIE). + ??? This should be computed when the frame info is genericized. */ +#ifdef MIPS_DEBUGGING_INFO +#define DWARF_CIE_INSN_SIZE (2*3) +#endif + +#ifndef DWARF_CIE_INSN_SIZE +#define DWARF_CIE_INSN_SIZE 0 +#endif + +/* Fixed size portion of the CIE (including the length field). */ +#define DWARF_CIE_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 5 + DWARF_CIE_INSN_SIZE) /* Fixed size of the Common Information Entry in the call frame information (.debug_frame) section rounded up to a word boundary. */ @@ -828,6 +838,17 @@ char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES]; while (0) #endif +/* The DWARF 2 CFA column which tracks the return address. Normally this + is the first column after all of the hard registers. */ +#ifndef DWARF_FRAME_RETURN_COLUMN +#define DWARF_FRAME_RETURN_COLUMN FIRST_PSEUDO_REGISTER +#endif + +/* The mapping from gcc register number to DWARF 2 CFA column number. By + default, we provide columns for all registers after the CFA column. */ +#ifndef DWARF_FRAME_REGNUM +#define DWARF_FRAME_REGNUM(REG) (DBX_REGISTER_NUMBER (REG) + 1) +#endif /************************ general utility functions **************************/ @@ -3920,7 +3941,7 @@ output_call_frame_info () ASM_COMMENT_START); } fputc ('\n', asm_out_file); - ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_FRAME_RA_COL); + ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DWARF_FRAME_RETURN_COLUMN); if (flag_verbose_asm) { fprintf (asm_out_file, "\t%s CIE RA Column", @@ -3932,12 +3953,21 @@ output_call_frame_info () #ifdef MIPS_DEBUGGING_INFO - /* Set the RA on entry to be the contents of r31. */ bzero (&cfi_node, sizeof (dw_cfi_node)); cfi = &cfi_node; + + /* On entry, the Call Frame Address is in the stack pointer register. */ + cfi->dw_cfi_opc = DW_CFA_def_cfa; + cfi->dw_cfi_oprnd1.dw_cfi_reg_num + = DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM); + cfi->dw_cfi_oprnd2.dw_cfi_offset = 0; + output_cfi (cfi); + + /* Set the RA on entry to be the contents of r31. */ cfi->dw_cfi_opc = DW_CFA_register; - cfi->dw_cfi_oprnd1.dw_cfi_reg_num = DW_FRAME_RA_COL; - cfi->dw_cfi_oprnd2.dw_cfi_reg_num = DW_FRAME_REG31; + cfi->dw_cfi_oprnd1.dw_cfi_reg_num = DWARF_FRAME_RETURN_COLUMN; + cfi->dw_cfi_oprnd2.dw_cfi_reg_num + = DWARF_FRAME_REGNUM (GP_REG_FIRST + 31); output_cfi (cfi); #endif @@ -7654,27 +7684,19 @@ dwarf2out_begin_function () #ifdef MIPS_DEBUGGING_INFO - /* On entry, the Call Frame Address is in the stack pointer register. */ - cfi = new_cfi (); - cfi->dw_cfi_opc = DW_CFA_def_cfa; - cfi->dw_cfi_oprnd1.dw_cfi_reg_num - = DBX_REGISTER_NUMBER (STACK_POINTER_REGNUM); - cfi->dw_cfi_oprnd2.dw_cfi_offset = 0; - add_cfi (&fde->dw_fde_cfi, cfi); - /* Set the location counter to the end of the function prolog. */ cfi = new_cfi (); cfi->dw_cfi_opc = DW_CFA_advance_loc4; cfi->dw_cfi_oprnd1.dw_cfi_addr = xstrdup (label); add_cfi (&fde->dw_fde_cfi, cfi); - /* Define the CFA as either an explicit frame pointer register, - or an offset from the stack pointer. */ + /* Define the CFA as an offset from either the frame pointer + or the stack pointer. */ cfi = new_cfi (); cfi->dw_cfi_opc = DW_CFA_def_cfa; cfi->dw_cfi_oprnd1.dw_cfi_reg_num - = DBX_REGISTER_NUMBER (frame_pointer_needed ? FRAME_POINTER_REGNUM - : STACK_POINTER_REGNUM); + = DWARF_FRAME_REGNUM (frame_pointer_needed ? FRAME_POINTER_REGNUM + : STACK_POINTER_REGNUM); offset = current_frame_info.total_size; cfi->dw_cfi_oprnd2.dw_cfi_offset = offset; add_cfi (&fde->dw_fde_cfi, cfi); @@ -7690,9 +7712,9 @@ dwarf2out_begin_function () cfi = new_cfi (); cfi->dw_cfi_opc = DW_CFA_register; cfi->dw_cfi_oprnd1.dw_cfi_reg_num - = DBX_REGISTER_NUMBER (STACK_POINTER_REGNUM); + = DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM); cfi->dw_cfi_oprnd2.dw_cfi_reg_num - = DBX_REGISTER_NUMBER (FRAME_POINTER_REGNUM); + = DWARF_FRAME_REGNUM (FRAME_POINTER_REGNUM); add_cfi (&fde->dw_fde_cfi, cfi); } @@ -7703,7 +7725,7 @@ dwarf2out_begin_function () assert (offset >= 0); cfi = new_cfi (); cfi->dw_cfi_opc = DW_CFA_offset_extended; - cfi->dw_cfi_oprnd1.dw_cfi_reg_num = DW_FRAME_RA_COL; + cfi->dw_cfi_oprnd1.dw_cfi_reg_num = DWARF_FRAME_RETURN_COLUMN; cfi->dw_cfi_oprnd2.dw_cfi_offset = offset; add_cfi (&fde->dw_fde_cfi, cfi); } @@ -7718,7 +7740,7 @@ dwarf2out_begin_function () cfi = new_cfi (); cfi->dw_cfi_opc = DW_CFA_offset; cfi->dw_cfi_oprnd1.dw_cfi_reg_num - = DBX_REGISTER_NUMBER (FRAME_POINTER_REGNUM); + = DWARF_FRAME_REGNUM (FRAME_POINTER_REGNUM); cfi->dw_cfi_oprnd2.dw_cfi_offset = offset; add_cfi (&fde->dw_fde_cfi, cfi); } |