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: ptx debugging patch


Hi!

Approved long ago:

On Fri, 05 Dec 2014 16:38:32 -0700, Jeff Law <law@redhat.com> wrote:
> On 11/14/14 11:17, Bernd Schmidt wrote:
> > The situation with debugging on ptx is a little strange - it allows
> > .file and .loc directives for line numbers, and it provides a way to
> > define dwarf2 debug sections - but as far as I can tell, there's no way
> > of putting useful or accurate information into the latter. There's also
> > the slight problem that the data output directives used within those
> > sections differ from the ones used everywhere else in ptx code.
> >
> > The following patch adds a variant of dwarf2 debugging that supports
> > just line numbers. [...]
> >
> > How does this look? [...]

> I'll resist the temptation to bikeshed on the name :-)
> 
> OK.

..., and -- after minor modifiations a while ago, to adjust to current
trunk, and re-testing -- now actually committed in r226890.  I'm
confirming this does placate GCC's testsuite some more, but have not
actually done any tests with a consumer of PTX debug information.

commit a328e031d5e328eab6a2697b95f5c5e89d396604
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Aug 14 10:37:14 2015 +0000

    Add DWARF2_LINENO_DEBUGGING_INFO, and use it for nvptx
    
    	gcc/
    	* config/nvptx/nvptx.c (nvptx_option_override): Don't override
    	debug options.
    	* config/nvptx/nvptx.h (DWARF2_LINENO_DEBUGGING_INFO): Define.
    	(DWARF2_DEBUGGING_INFO): Don't define.
    	* debug.h (dwarf2_lineno_debug_hooks): Declare.
    	* toplev.c (process_options): Add a case for it.
    	* dwarf2out.c (dwarf2_lineno_debug_hooks): New variable.
    	(dwarf2out_init): Skip most initializations if
    	DWARF2_LINENO_DEBUGGING_INFO, but set cur_line_info_table in that
    	case.
    	* defaults.h (PREFERRED_DEBUGGING_TYPE): Also use DWARF2_DEBUG if
    	DWARF2_LINENO_DEBUGGING_INFO.
    	* opts.c (set_debug_level): Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226890 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog            |   17 +++++++++++++++++
 gcc/config/nvptx/nvptx.c |    2 --
 gcc/config/nvptx/nvptx.h |    2 +-
 gcc/debug.h              |    1 +
 gcc/defaults.h           |    2 +-
 gcc/dwarf2out.c          |   43 +++++++++++++++++++++++++++++++++++++++++++
 gcc/opts.c               |    2 +-
 gcc/toplev.c             |    4 ++++
 8 files changed, 68 insertions(+), 5 deletions(-)

diff --git gcc/ChangeLog gcc/ChangeLog
index af5e73c..154c077 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,3 +1,20 @@
+2015-08-14  Thomas Schwinge  <thomas@codesourcery.com>
+	    Bernd Schmidt  <bernds@codesourcery.com>
+
+	* config/nvptx/nvptx.c (nvptx_option_override): Don't override
+	debug options.
+	* config/nvptx/nvptx.h (DWARF2_LINENO_DEBUGGING_INFO): Define.
+	(DWARF2_DEBUGGING_INFO): Don't define.
+	* debug.h (dwarf2_lineno_debug_hooks): Declare.
+	* toplev.c (process_options): Add a case for it.
+	* dwarf2out.c (dwarf2_lineno_debug_hooks): New variable.
+	(dwarf2out_init): Skip most initializations if
+	DWARF2_LINENO_DEBUGGING_INFO, but set cur_line_info_table in that
+	case.
+	* defaults.h (PREFERRED_DEBUGGING_TYPE): Also use DWARF2_DEBUG if
+	DWARF2_LINENO_DEBUGGING_INFO.
+	* opts.c (set_debug_level): Likewise.
+
 2015-08-14  James Greenhalgh  <james.greenhalgh@arm.com>
 
 	* config/arm/types.md (is_neon_type): Add missing types.
diff --git gcc/config/nvptx/nvptx.c gcc/config/nvptx/nvptx.c
index 5d9b41f..a356967 100644
--- gcc/config/nvptx/nvptx.c
+++ gcc/config/nvptx/nvptx.c
@@ -103,8 +103,6 @@ nvptx_option_override (void)
   flag_toplevel_reorder = 1;
   /* Assumes that it will see only hard registers.  */
   flag_var_tracking = 0;
-  write_symbols = NO_DEBUG;
-  debug_info_level = DINFO_LEVEL_NONE;
 
   declared_fndecls_htab = hash_table<tree_hasher>::create_ggc (17);
   needed_fndecls_htab = hash_table<tree_hasher>::create_ggc (17);
diff --git gcc/config/nvptx/nvptx.h gcc/config/nvptx/nvptx.h
index 9cb46cc..afe4fcd 100644
--- gcc/config/nvptx/nvptx.h
+++ gcc/config/nvptx/nvptx.h
@@ -339,7 +339,7 @@ struct GTY(()) machine_function
 
 /* Misc.  */
 
-#define DWARF2_DEBUGGING_INFO 1
+#define DWARF2_LINENO_DEBUGGING_INFO 1
 
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
   ((VALUE) = GET_MODE_BITSIZE ((MODE)), 2)
diff --git gcc/debug.h gcc/debug.h
index 269c4d8..9784300 100644
--- gcc/debug.h
+++ gcc/debug.h
@@ -207,6 +207,7 @@ extern const struct gcc_debug_hooks dbx_debug_hooks;
 extern const struct gcc_debug_hooks sdb_debug_hooks;
 extern const struct gcc_debug_hooks xcoff_debug_hooks;
 extern const struct gcc_debug_hooks dwarf2_debug_hooks;
+extern const struct gcc_debug_hooks dwarf2_lineno_debug_hooks;
 extern const struct gcc_debug_hooks vmsdbg_debug_hooks;
 
 /* Dwarf2 frame information.  */
diff --git gcc/defaults.h gcc/defaults.h
index 9d38ba1..713ca07 100644
--- gcc/defaults.h
+++ gcc/defaults.h
@@ -932,7 +932,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #elif defined SDB_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
 
-#elif defined DWARF2_DEBUGGING_INFO
+#elif defined DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
 
 #elif defined VMS_DEBUGGING_INFO
diff --git gcc/dwarf2out.c gcc/dwarf2out.c
index 2c7dc71..92903f8 100644
--- gcc/dwarf2out.c
+++ gcc/dwarf2out.c
@@ -2489,6 +2489,43 @@ const struct gcc_debug_hooks dwarf2_debug_hooks =
   1,                            /* start_end_main_source_file */
   TYPE_SYMTAB_IS_DIE            /* tree_type_symtab_field */
 };
+
+const struct gcc_debug_hooks dwarf2_lineno_debug_hooks =
+{
+  dwarf2out_init,
+  debug_nothing_charstar,
+  debug_nothing_void,
+  debug_nothing_void,
+  debug_nothing_int_charstar,
+  debug_nothing_int_charstar,
+  debug_nothing_int_charstar,
+  debug_nothing_int,
+  debug_nothing_int_int,	         /* begin_block */
+  debug_nothing_int_int,	         /* end_block */
+  debug_true_const_tree,	         /* ignore_block */
+  dwarf2out_source_line,	 /* source_line */
+  debug_nothing_int_charstar,	         /* begin_prologue */
+  debug_nothing_int_charstar,	         /* end_prologue */
+  debug_nothing_int_charstar,	         /* begin_epilogue */
+  debug_nothing_int_charstar,	         /* end_epilogue */
+  debug_nothing_tree,		         /* begin_function */
+  debug_nothing_int,		         /* end_function */
+  debug_nothing_tree,			 /* register_main_translation_unit */
+  debug_nothing_tree,		         /* function_decl */
+  debug_nothing_tree,		         /* early_global_decl */
+  debug_nothing_tree,		         /* late_global_decl */
+  debug_nothing_tree_int,		 /* type_decl */
+  debug_nothing_tree_tree_tree_bool,	 /* imported_module_or_decl */
+  debug_nothing_tree,		         /* deferred_inline_function */
+  debug_nothing_tree,		         /* outlining_inline_function */
+  debug_nothing_rtx_code_label,	         /* label */
+  debug_nothing_int,		         /* handle_pch */
+  debug_nothing_rtx_insn,	         /* var_location */
+  debug_nothing_void,                    /* switch_text_section */
+  debug_nothing_tree_tree,		 /* set_name */
+  0,                                     /* start_end_main_source_file */
+  TYPE_SYMTAB_IS_ADDRESS                 /* tree_type_symtab_field */
+};
 
 /* NOTE: In the comments in this file, many references are made to
    "Debugging Information Entries".  This term is abbreviated as `DIE'
@@ -23183,6 +23220,7 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
   /* Allocate the file_table.  */
   file_table = hash_table<dwarf_file_hasher>::create_ggc (50);
 
+#ifndef DWARF2_LINENO_DEBUGGING_INFO
   /* Allocate the decl_die_table.  */
   decl_die_table = hash_table<decl_die_hasher>::create_ggc (10);
 
@@ -23298,11 +23336,16 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
 
   switch_to_section (text_section);
   ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
+#endif
 
   /* Make sure the line number table for .text always exists.  */
   text_section_line_info = new_line_info_table ();
   text_section_line_info->end_label = text_end_label;
 
+#ifdef DWARF2_LINENO_DEBUGGING_INFO
+  cur_line_info_table = text_section_line_info;
+#endif
+
   /* If front-ends already registered a main translation unit but we were not
      ready to perform the association, do this now.  */
   if (main_translation_unit != NULL_TREE)
diff --git gcc/opts.c gcc/opts.c
index 468a802..9d5de96 100644
--- gcc/opts.c
+++ gcc/opts.c
@@ -2223,7 +2223,7 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg,
 
 	  if (extended == 2)
 	    {
-#ifdef DWARF2_DEBUGGING_INFO
+#if defined DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO
 	      opts->x_write_symbols = DWARF2_DEBUG;
 #elif defined DBX_DEBUGGING_INFO
 	      opts->x_write_symbols = DBX_DEBUG;
diff --git gcc/toplev.c gcc/toplev.c
index 0b0c7f1..d6efd0e 100644
--- gcc/toplev.c
+++ gcc/toplev.c
@@ -1482,6 +1482,10 @@ process_options (void)
   else if (write_symbols == VMS_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
     debug_hooks = &vmsdbg_debug_hooks;
 #endif
+#ifdef DWARF2_LINENO_DEBUGGING_INFO
+  else if (write_symbols == DWARF2_DEBUG)
+    debug_hooks = &dwarf2_lineno_debug_hooks;
+#endif
   else
     error ("target system does not support the %qs debug format",
 	   debug_type_names[write_symbols]);


GrÃÃe,
 Thomas

Attachment: signature.asc
Description: PGP signature


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