This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Dwarf2 directory terminator for VMS
- From: Douglas B Rupp <rupp at gnat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 23 Jul 2009 13:23:36 -0700
- Subject: [PATCH] Dwarf2 directory terminator for VMS
The VMS debugger needs this.
Tested on x86_64-linux-gnu
OK to commit?
--Douglas Rupp
AdaCore
2009-07-23 Douglas B Rupp <rupp@gnat.com>
* dwarf2out.c (output_file_names): Test new macro
DWARF2_DIR_SHOULD_END_WITH_SEPARATOR.
(add_comp_dir_attribute): Likewise.
* doc/tm.texi (DWARF2_DIR_SHOULD_END_WITH_SEPARATOR): Document.
diff -rupN gcc/dwarf2out.c gcc/dwarf2out.c
--- gcc/dwarf2out.c 2008-12-10 09:31:07.000000000 -0800
+++ gcc/dwarf2out.c 2009-01-21 18:27:55.000000000 -0800
@@ -8923,7 +9094,12 @@ output_file_names (void)
idx = 1;
idx_offset = dirs[0].length > 0 ? 1 : 0;
for (i = 1 - idx_offset; i < ndirs; i++)
- dw2_asm_output_nstring (dirs[i].path, dirs[i].length - 1,
+ dw2_asm_output_nstring (dirs[i].path,
+#ifdef DWARF2_DIR_SHOULD_END_WITH_SEPARATOR
+ dirs[i].length,
+#else
+ dirs[i].length - 1,
+#endif
"Directory Entry: 0x%x", i + idx_offset);
dw2_asm_output_data (1, 0, "End directory table");
@@ -12230,8 +12409,21 @@ static void
add_comp_dir_attribute (dw_die_ref die)
{
const char *wd = get_src_pwd ();
+
if (wd != NULL)
- add_AT_string (die, DW_AT_comp_dir, remap_debug_filename (wd));
+ {
+ int wdlen;
+ char *wd1;
+
+ wdlen = strlen (wd);
+ wd1 = (char *) alloca (wdlen + 2);
+ strcpy (wd1, wd);
+#ifdef DWARF2_DIR_SHOULD_END_WITH_SEPARATOR
+ wd1 [wdlen] = DIR_SEPARATOR;
+ wd1 [wdlen + 1] = 0;
+#endif
+ add_AT_string (die, DW_AT_comp_dir, remap_debug_filename (wd1));
+ }
}
/* Given a tree node describing an array bound (either lower or upper) output
--- gcc/doc/tm.texi 2009-02-14 16:44:31.819916658 -0800
+++ gcc/doc/tm.texi 2009-02-14 16:46:44.409223139 -0800
@@ -8953,6 +8953,11 @@ line debug info sections. This will res
tables, and hence is desirable if it works.
@end defmac
+@defmac DWARF2_DIR_SHOULD_END_WITH_SEPARATOR
+Define this macro to be a nonzero value if the directory specifications which
+are output in the debug info should end with a separator.
+@end defmac
+
@defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2})
A C statement to issue assembly directives that create a difference
@var{lab1} minus @var{lab2}, using an integer of the given @var{size}.