This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [PATCH] Dwarf2out end prologue/begin epilogue for IVMS (Revised)


On 08/19/2009 03:12 PM, Douglas B Rupp wrote:
This patch was getting a little fuzzy, so please find attached a fresh
version incorporating comments received to date.

Justification from the HP OpenVMS DWARF Extensions Manual:

When a breakpoint is set on entry to a function, it is generally
desirable for execution to be suspended, not on the very first
instruction of the function, but rather at a point after the function's
frame has been set up, after any language defined local declaration
processing has been completed, and before execution of the first
statement of the function begins. Debuggers generally cannot properly
determine where this point is. Similarly for a breakpoint set on exit
from a function. The prologue and epilogue attributes allow a compiler
to communicate the location(s) to use.

First, let's not pretend this is standard dwarf. The standard dwarf way to represent this is with the DW_LNS_set_prologue_end and DW_LNS_set_epilogue_begin line number table ops.


As an aside, this is something that the Red Hat debugger and systemtap folk have been pushing me to implement for some time now. Only the definition they want to use for end_prologue is different from what gcc uses for end_prologue. They want "the end of the prologue is the very first insn to come from user code", whereas gcc uses "the end of the prologue is the very last insn to come from the prologue". And similarly for the definition of epilogue. These points are not the same whenever scheduling is enabled.

So lets rename dwarf2out_end_prologue and dwarf2out_begin_epilogue
to dwarf2out_vms_*.  And change the members you added to dw_fde_struct
to be dw_fde_vms_*.

+#ifndef ASM_OUTPUT_DWARF_DELTA_UNITS
+  dw2_asm_output_delta (size, lab1, lab2, comment);
+#else
+  ASM_OUTPUT_DWARF_DELTA_UNITS (asm_out_file, size, lab1, lab2, units);

Seems like you should just abort if ASM_OUTPUT_DWARF_DELTA_UNITS is not defined. Otherwise you're going to emit incorrect info. Alternately, gcc_assert (units == 1) there.

Alternately, why are you introducing this new function at all:

+        if (fde->dw_fde_end_prologue)
+          add_AT_delta (subr_die, DW_AT_HP_prologue,
+	    fde->dw_fde_begin, fde->dw_fde_end_prologue, 1);
+
+        if (fde->dw_fde_begin_epilogue)
+          add_AT_delta (subr_die, DW_AT_HP_epilogue,
+	    fde->dw_fde_begin, fde->dw_fde_begin_epilogue, 1);

You always pass units=1, so you could just as easily have used dw2_asm_output_delta directly.


+	case dw_val_class_delta:
+	  if (AT_delta_units (a))
+	    dw2_asm_output_delta_units (4, AT_delta2 (a), AT_delta1 (a),
+				        AT_delta_units (a), "%s", name);
+	  else
+	    dw2_asm_output_delta (4, AT_delta2 (a), AT_delta1 (a), "%s", name);
+	  break;

This probably ought to use DWARF_OFFSET_SIZE, just in case it ever gets reused for something else. Which also means fixing up size_of_die and value_format to match.


r~



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