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]

PATCH: dwarf source type for java language



This patch adds java language support for dwarf debug info.  There are
corresponding changes for both binutils (already applied) and gdb.

The magic number was chosen to be 1 greater than the one used for
Chill.


Thu Jun  3 19:01:16 1999  Anthony Green  <green@cygnus.com>

	* dwarf2out.c (gen_compile_unit_die): Add java language support.
	* dwarfout.c (output_compile_unit_die): Ditto.

	* dwarf2out.c (add_bound_info): Check for java language.

	* dwarf2out.c (is_java): New function.

	* dwarf.h (dwarf_source_language): Add java source language type.
	* dwarf2.h (dwarf_source_language): Ditto.


Index: dwarf.h
===================================================================
RCS file: /cvs/egcs/egcs/gcc/dwarf.h,v
retrieving revision 1.3
diff -u -p -u -r1.3 dwarf.h
--- dwarf.h	1998/12/16 20:54:59	1.3
+++ dwarf.h	1999/06/04 02:05:05
@@ -299,7 +299,8 @@ enum dwarf_source_language {
     LANG_FORTRAN77	= 0x00000007,
     LANG_FORTRAN90	= 0x00000008,
     LANG_PASCAL83	= 0x00000009,
-    LANG_MODULA2	= 0x0000000a
+    LANG_MODULA2	= 0x0000000a,
+    LANG_JAVA		= 0x00009af4
 };
 
 #define LANG_lo_user	0x00008000  /* implementation-defined range start */
Index: dwarf2.h
===================================================================
RCS file: /cvs/egcs/egcs/gcc/dwarf2.h,v
retrieving revision 1.11
diff -u -p -u -r1.11 dwarf2.h
--- dwarf2.h	1999/01/11 13:43:21	1.11
+++ dwarf2.h	1999/06/04 02:05:05
@@ -530,7 +530,8 @@ enum dwarf_source_language
     DW_LANG_Fortran90 = 0x0008,
     DW_LANG_Pascal83 = 0x0009,
     DW_LANG_Modula2 = 0x000a,
-    DW_LANG_Mips_Assembler = 0x8001
+    DW_LANG_Mips_Assembler = 0x8001,
+    DW_LANG_Java = 0x9af4
   };
 
 
Index: dwarf2out.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/dwarf2out.c,v
retrieving revision 1.93
diff -u -p -u -r1.93 dwarf2out.c
--- dwarf2out.c	1999/06/03 02:31:22	1.93
+++ dwarf2out.c	1999/06/04 02:05:05
@@ -2516,6 +2516,7 @@ static unsigned get_AT_unsigned		PROTO((
 					       enum dwarf_attribute));
 static int is_c_family			PROTO((void));
 static int is_fortran			PROTO((void));
+static int is_java			PROTO((void));
 static void remove_AT			PROTO((dw_die_ref,
 					       enum dwarf_attribute));
 static void remove_children		PROTO((dw_die_ref));
@@ -4074,6 +4075,14 @@ is_fortran ()
   return (lang == DW_LANG_Fortran77 || lang == DW_LANG_Fortran90);
 } 
 
+static inline int
+is_java ()
+{
+  register unsigned lang = get_AT_unsigned (comp_unit_die, DW_AT_language);
+
+  return (lang == DW_LANG_Java);
+}
+
 /* Remove the specified attribute if present.  */
 
 static inline void
@@ -7297,7 +7306,7 @@ add_bound_info (subrange_die, bound_attr
     case INTEGER_CST:
       bound_value = TREE_INT_CST_LOW (bound);
       if (bound_attr == DW_AT_lower_bound
-	  && ((is_c_family () && bound_value == 0)
+	  && (((is_c_family () || is_java ()) && bound_value == 0)
 	      || (is_fortran () && bound_value == 1)))
 	/* use the default */;
       else
@@ -8907,6 +8916,9 @@ gen_compile_unit_die (main_input_filenam
 
   else if (strcmp (language_string, "GNU Pascal") == 0)
     add_AT_unsigned (comp_unit_die, DW_AT_language, DW_LANG_Pascal83);
+
+  else if (strcmp (language_string, "GNU Java") == 0)
+    add_AT_unsigned (comp_unit_die, DW_AT_language, DW_LANG_Java);
 
   else if (flag_traditional)
     add_AT_unsigned (comp_unit_die, DW_AT_language, DW_LANG_C);
Index: dwarfout.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/dwarfout.c,v
retrieving revision 1.35
diff -u -p -u -r1.35 dwarfout.c
--- dwarfout.c	1999/04/18 13:09:27	1.35
+++ dwarfout.c	1999/06/04 02:05:05
@@ -3710,6 +3710,8 @@ output_compile_unit_die (arg)
     language_attribute (LANG_FORTRAN77);
   else if (strcmp (language_string, "GNU Pascal") == 0)
     language_attribute (LANG_PASCAL83);
+  else if (strcmp (language_string, "GNU Java") == 0)
+    language_attribute (LANG_JAVA);
   else if (flag_traditional)
     language_attribute (LANG_C);
   else

-- 
Anthony Green                                               Cygnus Solutions
                                                       Sunnyvale, California


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