* gdb.base/find.exp: Set newline variable
[deliverable/binutils-gdb.git] / gas / dwarf2dbg.c
index b1c96b5f30d7f2cf49603787a5d74178c54b3f08..2bcba9b41eaaecb9c3610fe00ebf0afbc9aea3d3 100644 (file)
 # define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8)
 #endif
 
+#ifndef DWARF2_FILE_NAME
+#define DWARF2_FILE_NAME(FILENAME, DIRNAME) FILENAME
+#endif
+
+#ifndef DWARF2_FILE_TIME_NAME
+#define DWARF2_FILE_TIME_NAME(FILENAME,DIRNAME) 0
+#endif
+
+#ifndef DWARF2_FILE_SIZE_NAME
+#define DWARF2_FILE_SIZE_NAME(FILENAME,DIRNAME) 0
+#endif
+
 #include "subsegs.h"
 
 #include "elf/dwarf2.h"
@@ -434,7 +446,9 @@ get_filenum (const char *filename, unsigned int num)
   dir = 0;
   if (dir_len)
     {
+#ifndef DWARF2_DIR_SHOULD_END_WITH_SEPARATOR
       --dir_len;
+#endif
       for (dir = 1; dir < dirs_in_use; ++dir)
        if (strncmp (filename, dirs[dir], dir_len) == 0
            && dirs[dir][dir_len] == '\0')
@@ -525,6 +539,10 @@ dwarf2_directive_file (int dummy ATTRIBUTE_UNUSED)
       return NULL;
     }
 
+  /* A .file directive implies compiler generated debug information is
+     being supplied.  Turn off gas generated debug info.  */
+  debug_type = DEBUG_NONE;
+
   if (num < (int) files_in_use && files[num].filename != 0)
     {
       as_bad (_("file number %ld already allocated"), (long) num);
@@ -543,7 +561,7 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
 
   /* If we see two .loc directives in a row, force the first one to be
      output now.  */
-  if (dwarf2_loc_directive_seen && debug_type != DEBUG_DWARF2)
+  if (dwarf2_loc_directive_seen)
     dwarf2_emit_insn (0);
 
   filenum = get_absolute_expression ();
@@ -653,6 +671,7 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
 
   demand_empty_rest_of_line ();
   dwarf2_loc_directive_seen = TRUE;
+  debug_type = DEBUG_NONE;
 }
 
 void
@@ -1276,6 +1295,8 @@ out_file_list (void)
 
   for (i = 1; i < files_in_use; ++i)
     {
+      const char *fullfilename;
+
       if (files[i].filename == NULL)
        {
          as_bad (_("unassigned file number %ld"), (long) i);
@@ -1284,13 +1305,19 @@ out_file_list (void)
          continue;
        }
 
-      size = strlen (files[i].filename) + 1;
+      fullfilename = DWARF2_FILE_NAME (files[i].filename,
+                                      files[i].dir ? dirs [files [i].dir] : "");
+      size = strlen (fullfilename) + 1;
       cp = frag_more (size);
-      memcpy (cp, files[i].filename, size);
+      memcpy (cp, fullfilename, size);
 
       out_uleb128 (files[i].dir);      /* directory number */
-      out_uleb128 (0);                 /* last modification timestamp */
-      out_uleb128 (0);                 /* filesize */
+      /* Output the last modification timestamp.  */
+      out_uleb128 (DWARF2_FILE_TIME_NAME (files[i].filename,
+                                         files[i].dir ? dirs [files [i].dir] : ""));
+      /* Output the filesize.  */
+      out_uleb128 (DWARF2_FILE_SIZE_NAME (files[i].filename,
+                                         files[i].dir ? dirs [files [i].dir] : ""));
     }
 
   /* Terminate filename list.  */
This page took 0.024093 seconds and 4 git commands to generate.