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]

Add support for VMS debugging format


This adds support for VMS debugging format and also to write both VMS and
Dwarf2 debugging output.  The former is useful for traceback even if using
Dwarf2 with GDB.

Sun Dec  2 09:22:25 2001  Douglas B. Rupp  <rupp@gnat.com>

	* config/alpha/vms.h (VMS_DEBUGGING_INFO): New macro.
	(PREFERRED_DEBUGGING_TYPE): Define as VMS_AND_DWARF2_DEBUG.
	(ASM_SPEC): Don't redefine.
	(OPTIMIZATION_OPTIONS, OVERRIDE_OPTIONS, LINK_SPEC): Define.
	* config/alpha/t-vms (EXTRA_PARTS): Use; add rule for vms-dwarf2.asm.
	* config/alpha/vms-dwarf2.asm: New file.

	* Makefile.in (OBJS): Add vmsdbgout.c and its rule.
	* c-lex.c (init_c_lex): Test for VMS_AND_DWARF2_DEBUG.
	* debug.h (gcc_debug_hooks): Add vmsdbg_debug_hooks.
	(vmsdbgout_after_prologue): New declaration.
	* defaults.h (VMS_DEBUGGING_INFO): Add to PREFERRED_DEBUGGING_TYPE.
	* dwarf2.h (dwarf_attribute): New DW_AT_VMS_rtnbeg_pd_address.
	* dwarf2out.c (dwarf2out_do_frame): Test for VMS_AND_DWARF2_DEBUG.
	(dwarf2out_frame_finish): Test for VMS_AND_DWARF2_DEBUG.
	(dwarf_attr_name): Use DW_AT_VMS_rtnbeg_pd_address.
	(add_name_and_src_coords_attributes): Test VMS_DEBUGGING_INFO
	* final.c (final_start_function): Test for VMS_AND_DWARF2_DEBUG.
	Test VMS_DEBUGGING_INFO.
	(final_end_function): Test for VMS_AND_DWARF2_DEBUG.
	(final_scan_insn): Test for VMS_AND_DWARF2_DEBUG and VMS_DEBUG.
	* flags.h (debug_info_type): Add VMS_DEBUG and VMS_AND_DWARF2_DEBUG.
	* toplev.c (compile_file): Test VMS_DEBUGGING_INFO, VMS_DEBUG, and
	VMS_AND_DWARF2_DEBUG.
	(rest_of_type_compilation): Test for VMS_AND_DWARF2_DEBUG.
	(decode_g_option): Add "vms" to debug_type_names.
	(process_options): Set vmsdbg_debug_hooks if -gvms.
	(lang_independent_init): Emit line number for VMS unless -g0.
	* tree.c: (build_complex_type): Test for VMS_AND_DWARF2_DEBUG.
	* vmsdbg.h, vmsdbgout.c: New files.

*** Makefile.in	2001/11/30 04:38:41	1.796
--- Makefile.in	2001/12/02 14:19:17
*************** OBJS = alias.o bb-reorder.o bitmap.o bui
*** 729,733 ****
   sibcall.o simplify-rtx.o ssa.o ssa-ccp.o ssa-dce.o stmt.o	\
   stor-layout.o stringpool.o timevar.o toplev.o tree.o tree-dump.o 	\
!  tree-inline.o unroll.o varasm.o varray.o version.o xcoffout.o 		\
   $(GGC) $(out_object_file) $(EXTRA_OBJS)
  
--- 729,733 ----
   sibcall.o simplify-rtx.o ssa.o ssa-ccp.o ssa-dce.o stmt.o	\
   stor-layout.o stringpool.o timevar.o toplev.o tree.o tree-dump.o 	\
!  tree-inline.o unroll.o varasm.o varray.o version.o vmsdbgout.o xcoffout.o \
   $(GGC) $(out_object_file) $(EXTRA_OBJS)
  
*************** dwarf2out.o : dwarf2out.c $(CONFIG_H) $(
*** 1396,1399 ****
--- 1396,1401 ----
  dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) flags.h $(RTL_H) $(TREE_H) \
     output.h dwarf2asm.h $(TM_P_H)
+ vmsdbgout.o : vmsdbgout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \
+    output.h vmsdbg.h debug.h langhooks.h
  xcoffout.o : xcoffout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) xcoffout.h \
     flags.h toplev.h output.h dbxout.h $(GGC_H)
*** c-lex.c	2001/12/02 00:04:16	1.158
--- c-lex.c	2001/12/02 14:19:18
*************** init_c_lex (filename)
*** 134,138 ****
    /* Set the debug callbacks if we can use them.  */
    if (debug_info_level == DINFO_LEVEL_VERBOSE
!       && (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG))
      {
        cb->define = cb_define;
--- 134,139 ----
    /* Set the debug callbacks if we can use them.  */
    if (debug_info_level == DINFO_LEVEL_VERBOSE
!       && (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG
!           || write_symbols == VMS_AND_DWARF2_DEBUG))
      {
        cb->define = cb_define;
*** debug.h	2001/07/19 21:17:07	1.7
--- debug.h	2001/12/02 14:30:33
*************** extern struct gcc_debug_hooks xcoff_debu
*** 134,154 ****
  extern struct gcc_debug_hooks dwarf_debug_hooks;
  extern struct gcc_debug_hooks dwarf2_debug_hooks;
  
  /* Dwarf2 frame information.  */
  
! /* FILE is NULL iff being called for frame information for non-dwarf
!    debug output.  */
! extern void dwarf2out_begin_prologue
!   PARAMS ((unsigned int, const char * file));
! extern void dwarf2out_end_epilogue
!   PARAMS ((void));
! extern void dwarf2out_frame_init
!   PARAMS ((void));
! extern void dwarf2out_frame_finish
!   PARAMS ((void));
  /* Decide whether we want to emit frame unwind information for the current
     translation unit.  */
! extern int dwarf2out_do_frame
!   PARAMS ((void));
  
  #endif /* !GCC_DEBUG_H  */
--- 134,154 ----
  extern struct gcc_debug_hooks dwarf_debug_hooks;
  extern struct gcc_debug_hooks dwarf2_debug_hooks;
+ extern struct gcc_debug_hooks vmsdbg_debug_hooks;
  
  /* Dwarf2 frame information.  */
  
! extern void dwarf2out_begin_prologue	PARAMS ((unsigned int, const char *));
! extern void dwarf2out_end_epilogue	PARAMS ((void));
! extern void dwarf2out_frame_init	PARAMS ((void));
! extern void dwarf2out_frame_finish	PARAMS ((void));
  /* Decide whether we want to emit frame unwind information for the current
     translation unit.  */
! extern int dwarf2out_do_frame		PARAMS ((void));
! 
! /* When writing VMS debug info, output label after the prologue of the
!    function.  */
! extern void vmsdbgout_after_prologue	PARAMS ((void));
! 
! 
  
  #endif /* !GCC_DEBUG_H  */
*** defaults.h	2001/11/28 02:39:21	1.60
--- defaults.h	2001/12/02 14:19:18
*************** do {								\
*** 426,430 ****
  
     This is one long line cause VAXC can't handle a \-newline.  */
! #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
  #ifndef PREFERRED_DEBUGGING_TYPE
  You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
--- 426,430 ----
  
     This is one long line cause VAXC can't handle a \-newline.  */
! #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO) + defined (VMS_DEBUGGING_INFO))
  #ifndef PREFERRED_DEBUGGING_TYPE
  You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
*************** You Lose!  You must define PREFERRED_DEB
*** 443,446 ****
--- 443,449 ----
  #ifdef DWARF2_DEBUGGING_INFO
  #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+ #endif
+ #ifdef VMS_DEBUGGING_INFO
+ #define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
  #endif
  #ifdef XCOFF_DEBUGGING_INFO
*** dwarf2.h	2001/08/22 14:35:01	1.20
--- dwarf2.h	2001/12/02 14:19:19
*************** enum dwarf_attribute
*** 233,237 ****
      DW_AT_src_coords = 0x2104,
      DW_AT_body_begin = 0x2105,
!     DW_AT_body_end = 0x2106
    };
  
--- 233,239 ----
      DW_AT_src_coords = 0x2104,
      DW_AT_body_begin = 0x2105,
!     DW_AT_body_end = 0x2106,
!     /* VMS Extensions */
!     DW_AT_VMS_rtnbeg_pd_address = 0x2201
    };
  
*** dwarf2out.c	2001/12/02 13:43:10	1.335
--- dwarf2out.c	2001/12/02 14:19:26
*************** dwarf2out_do_frame ()
*** 92,95 ****
--- 92,96 ----
  {
    return (write_symbols == DWARF2_DEBUG
+ 	  || write_symbols == VMS_AND_DWARF2_DEBUG
  #ifdef DWARF2_FRAME_INFO
  	  || DWARF2_FRAME_INFO
*************** dwarf2out_frame_finish ()
*** 2116,2120 ****
  {
    /* Output call frame information.  */
!   if (write_symbols == DWARF2_DEBUG)
      output_call_frame_info (0);
    if (! USING_SJLJ_EXCEPTIONS && (flag_unwind_tables || flag_exceptions))
--- 2117,2121 ----
  {
    /* Output call frame information.  */
!   if (write_symbols == DWARF2_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
      output_call_frame_info (0);
    if (! USING_SJLJ_EXCEPTIONS && (flag_unwind_tables || flag_exceptions))
*************** dwarf_attr_name (attr)
*** 4100,4103 ****
--- 4101,4107 ----
      case DW_AT_body_end:
        return "DW_AT_body_end";
+     case DW_AT_VMS_rtnbeg_pd_address:
+       return "DW_AT_VMS_rtnbeg_pd_address";
+ 
      default:
        return "DW_AT_<unknown>";
*************** add_name_and_src_coords_attributes (die,
*** 9312,9315 ****
--- 9316,9328 ----
  		       IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
      }
+ 
+ #ifdef VMS_DEBUGGING_INFO
+ 
+   /* Get the function's name, as described by its RTL.  This may be different
+      from the DECL_NAME name used in the source file.  */
+   if (TREE_CODE (decl) == FUNCTION_DECL && TREE_ASM_WRITTEN (decl))
+     add_AT_string (die, DW_AT_VMS_rtnbeg_pd_address,
+ 		   xstrdup (XSTR (XEXP (DECL_RTL (decl), 0), 0)));
+ #endif
  }
  
*** final.c	2001/11/26 13:02:16	1.225
--- final.c	2001/12/02 14:19:38
*************** final_start_function (first, file, optim
*** 1679,1683 ****
  
  #if defined (DWARF2_UNWIND_INFO) || defined (IA64_UNWIND_INFO)
!   if (write_symbols != DWARF2_DEBUG)
      dwarf2out_begin_prologue (0, NULL);
  #endif
--- 1679,1683 ----
  
  #if defined (DWARF2_UNWIND_INFO) || defined (IA64_UNWIND_INFO)
!   if (write_symbols != DWARF2_DEBUG && write_symbols != VMS_AND_DWARF2_DEBUG)
      dwarf2out_begin_prologue (0, NULL);
  #endif
*************** final_start_function (first, file, optim
*** 1716,1719 ****
--- 1716,1725 ----
    (*targetm.asm_out.function_prologue) (file, get_frame_size ());
  
+ #ifdef VMS_DEBUGGING_INFO
+   /* Output label after the prologue of the function.  */
+   if (write_symbols == VMS_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
+     vmsdbgout_after_prologue ();
+ #endif
+ 
    /* If the machine represents the prologue as RTL, the profiling code must
       be emitted when NOTE_INSN_PROLOGUE_END is scanned.  */
*************** final_end_function ()
*** 1847,1851 ****
  
  #if defined (DWARF2_UNWIND_INFO)
!   if (write_symbols != DWARF2_DEBUG && dwarf2out_do_frame ())
      dwarf2out_end_epilogue ();
  #endif
--- 1853,1858 ----
  
  #if defined (DWARF2_UNWIND_INFO)
!   if (write_symbols != DWARF2_DEBUG && write_symbols != VMS_AND_DWARF2_DEBUG
!       && dwarf2out_do_frame ())
      dwarf2out_end_epilogue ();
  #endif
*************** final_scan_insn (insn, file, optimize, p
*** 2161,2165 ****
  	      || debug_info_level == DINFO_LEVEL_VERBOSE
  	      || write_symbols == DWARF_DEBUG
! 	      || write_symbols == DWARF2_DEBUG)
  	    {
  	      int n = BLOCK_NUMBER (NOTE_BLOCK (insn));
--- 2168,2174 ----
  	      || debug_info_level == DINFO_LEVEL_VERBOSE
  	      || write_symbols == DWARF_DEBUG
! 	      || write_symbols == DWARF2_DEBUG
! 	      || write_symbols == VMS_AND_DWARF2_DEBUG
! 	      || write_symbols == VMS_DEBUG)
  	    {
  	      int n = BLOCK_NUMBER (NOTE_BLOCK (insn));
*************** final_scan_insn (insn, file, optimize, p
*** 2181,2185 ****
  	      || debug_info_level == DINFO_LEVEL_VERBOSE
  	      || write_symbols == DWARF_DEBUG
! 	      || write_symbols == DWARF2_DEBUG)
  	    {
  	      int n = BLOCK_NUMBER (NOTE_BLOCK (insn));
--- 2190,2196 ----
  	      || debug_info_level == DINFO_LEVEL_VERBOSE
  	      || write_symbols == DWARF_DEBUG
! 	      || write_symbols == DWARF2_DEBUG
! 	      || write_symbols == VMS_AND_DWARF2_DEBUG
! 	      || write_symbols == VMS_DEBUG)
  	    {
  	      int n = BLOCK_NUMBER (NOTE_BLOCK (insn));
*** flags.h	2001/11/11 00:35:30	1.70
--- flags.h	2001/12/02 14:19:39
*************** enum debug_info_type
*** 33,37 ****
    DWARF_DEBUG,	    /* Write Dwarf debug info (using dwarfout.c).  */
    DWARF2_DEBUG,	    /* Write Dwarf v2 debug info (using dwarf2out.c).  */
!   XCOFF_DEBUG	    /* Write IBM/Xcoff debug info (using dbxout.c).  */
  };
  
--- 33,40 ----
    DWARF_DEBUG,	    /* Write Dwarf debug info (using dwarfout.c).  */
    DWARF2_DEBUG,	    /* Write Dwarf v2 debug info (using dwarf2out.c).  */
!   XCOFF_DEBUG,	    /* Write IBM/Xcoff debug info (using dbxout.c).  */
!   VMS_DEBUG,        /* Write VMS debug info (using vmsdbgout.c). */
!   VMS_AND_DWARF2_DEBUG /* Write VMS debug info (using vmsdbgout.c).
!                           and DWARF v2 debug info (using dwarf2out.c). */
  };
  
*** toplev.c	2001/12/02 00:04:21	1.549
--- toplev.c	2001/12/02 14:19:44
*************** rest_of_type_compilation (type, toplev)
*** 2333,2337 ****
  #endif
  #ifdef DWARF2_DEBUGGING_INFO
!   if (write_symbols == DWARF2_DEBUG && toplev)
      dwarf2out_decl (TYPE_STUB_DECL (type));
  #endif
--- 2333,2339 ----
  #endif
  #ifdef DWARF2_DEBUGGING_INFO
!   if ((write_symbols == DWARF2_DEBUG
!        || write_symbols == VMS_AND_DWARF2_DEBUG)
!       && toplev)
      dwarf2out_decl (TYPE_STUB_DECL (type));
  #endif
*************** decode_g_option (arg)
*** 3975,3979 ****
    static const char *const debug_type_names[] =
    {
!     "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
    };
  
--- 3977,3981 ----
    static const char *const debug_type_names[] =
    {
!     "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff", "vms"
    };
  
*************** process_options ()
*** 4938,4941 ****
--- 4940,4947 ----
      debug_hooks = &dwarf2_debug_hooks;
  #endif
+ #ifdef VMS_DEBUGGING_INFO
+   if (write_symbols == VMS_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
+     debug_hooks = &vmsdbg_debug_hooks;
+ #endif
  
    /* If auxiliary info generation is desired, open the output file.
*************** lang_independent_init ()
*** 5000,5005 ****
    init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
  		  || debug_info_level == DINFO_LEVEL_VERBOSE
! 		  || flag_test_coverage
! 		  || warn_notreached);
    init_regs ();
    init_alias_once ();
--- 5006,5015 ----
    init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
  		  || debug_info_level == DINFO_LEVEL_VERBOSE
! #ifdef VMS_DEBUGGING_INFO
! 		    /* Enable line number info for traceback */
! 		    || debug_info_level > DINFO_LEVEL_NONE
! #endif
! 		    || flag_test_coverage
! 		    || warn_notreached);
    init_regs ();
    init_alias_once ();
*** tree.c	2001/12/02 00:04:23	1.222
--- tree.c	2001/12/02 14:19:47
*************** build_complex_type (component_type)
*** 3998,4002 ****
    /* If we are writing Dwarf2 output we need to create a name,
       since complex is a fundamental type.  */
!   if (write_symbols == DWARF2_DEBUG && ! TYPE_NAME (t))
      {
        const char *name;
--- 3998,4003 ----
    /* If we are writing Dwarf2 output we need to create a name,
       since complex is a fundamental type.  */
!   if ((write_symbols == DWARF2_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
!       && ! TYPE_NAME (t))
      {
        const char *name;
*** config/alpha/t-vms	2001/11/18 04:27:50	1.4
--- config/alpha/t-vms	2001/12/02 14:19:48
***************
*** 1 ****
--- 1,7 ----
  LIB2FUNCS_EXTRA = $(srcdir)/config/alpha/vms_tramp.asm
+ EXTRA_PARTS = vms-dwarf2.o
+ 
+ # This object must be linked in in order to make the executable debuggable.
+ # vms-ld handles it automatically when passed -g.
+ vms-dwarf2.o : $(srcdir)/config/alpha/vms-dwarf2.asm
+ 	gcc -c -x assembler $<
*** config/alpha/vms.h	2001/11/18 12:35:28	1.41
--- config/alpha/vms.h	2001/12/02 14:19:51
*************** do {									\
*** 404,407 ****
--- 404,408 ----
  
  #define DWARF2_DEBUGGING_INFO
+ #define VMS_DEBUGGING_INFO
  
  /* This is how to output an assembler line
*************** do {									\
*** 426,430 ****
  
  #undef PREFERRED_DEBUGGING_TYPE
! #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
  
  #undef ASM_FORMAT_PRIVATE_NAME
--- 427,431 ----
  
  #undef PREFERRED_DEBUGGING_TYPE
! #define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
  
  #undef ASM_FORMAT_PRIVATE_NAME
*************** do {									\
*** 438,445 ****
  #undef ASM_SPEC
  #undef ASM_FINAL_SPEC
  #undef LINK_SPEC
  #undef STARTFILE_SPEC
- #define ASM_SPEC "-nocpp %{pg}"
- #define LINK_SPEC "%{g3:-g3} %{g0:-g0} %{shared:-shared} %{v:-v}"
  
  /* Define the names of the division and modulus functions.  */
--- 439,469 ----
  #undef ASM_SPEC
  #undef ASM_FINAL_SPEC
+ 
+ /* The VMS convention is to always provide minimal debug info
+    for a traceback unless specifically overridden.  Defaulting this here
+    is a kludge.  */
+ 
+ #define OPTIMIZATION_OPTIONS(OPTIMIZE, OPTIMIZE_SIZE) \
+ {                                                  \
+    write_symbols = VMS_DEBUG;                      \
+    debug_info_level = (enum debug_info_level) 1;   \
+ }
+ 
+ /* Override traceback debug info on -g0.  */
+ #undef OVERRIDE_OPTIONS
+ #define OVERRIDE_OPTIONS                           \
+ {                                                  \
+    if (write_symbols == NO_DEBUG)                  \
+      debug_info_level = (enum debug_info_level) 0; \
+    override_options ();                            \
+ }
+ 
+ /* Link with vms-dwarf2.o if -g (except -g0). This causes the
+    VMS link to pull all the dwarf2 debug sections together. */
  #undef LINK_SPEC
+ #define LINK_SPEC "%{g:-g vms-dwarf2.o%s} %{g0} %{g1:-g1 vms-dwarf2.o%s} \
+ %{g2:-g2 vms-dwarf2.o%s} %{g3:-g3 vms-dwarf2.o%s} %{shared} %{v} %{map}"
+ 
  #undef STARTFILE_SPEC
  
  /* Define the names of the division and modulus functions.  */


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