From e8f2ef5c8c926462277afb520cacaa265b7e612c Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 25 Nov 2016 11:06:15 +0100 Subject: Do not use hardcoded register number for sp. Since the dwarf register names for x86_32 and x86_64 differ it is wrong to hardcode the dwarf register number for rsp to 4. Bug 20461 --- debug/DwarfPrinter.ml | 20 ++++++++++---------- x86/Asmexpand.ml | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/debug/DwarfPrinter.ml b/debug/DwarfPrinter.ml index 43505e12..1d336965 100644 --- a/debug/DwarfPrinter.ml +++ b/debug/DwarfPrinter.ml @@ -337,21 +337,21 @@ module DwarfPrinter(Target: DWARF_TARGET): let print_loc_expr oc = function | DW_OP_bregx (a,b) -> - print_byte oc "" dw_op_bregx; - print_uleb128 oc "" a; - fprintf oc " .sleb128 %ld\n" b; + print_byte oc "DW_OP_bregx" dw_op_bregx; + print_uleb128 oc "Register number" a; + print_sleb128 oc "Offset" (Int32.to_int b); | DW_OP_plus_uconst i -> - print_byte oc "" dw_op_plus_uconst; - print_uleb128 oc "" i + print_byte oc "DW_OP_plus_uconst" dw_op_plus_uconst; + print_uleb128 oc "Constant" i | DW_OP_piece i -> - print_byte oc "" dw_op_piece; - print_uleb128 oc "" i + print_byte oc "DW_op_piece" dw_op_piece; + print_uleb128 oc "Piece" i | DW_OP_reg i -> if i < 32 then - print_byte oc "" (dw_op_reg0 + i) + print_byte oc "DW_op_reg" (dw_op_reg0 + i) else begin - print_byte oc "" dw_op_regx; - print_uleb128 oc "" i + print_byte oc "DW_op_regx" dw_op_regx; + print_uleb128 oc "Register number" i end let print_loc oc c loc = diff --git a/x86/Asmexpand.ml b/x86/Asmexpand.ml index 0436bc86..90dc0e69 100644 --- a/x86/Asmexpand.ml +++ b/x86/Asmexpand.ml @@ -618,7 +618,7 @@ let expand_function id fn = try set_current_function fn; if !Clflags.option_g then - expand_debug id 4 preg_to_dwarf expand_instruction fn.fn_code + expand_debug id (int_reg_to_dwarf RSP) preg_to_dwarf expand_instruction fn.fn_code else List.iter expand_instruction fn.fn_code; Errors.OK (get_current_function ()) -- cgit