Panu Matilainen d25c1c
diff -r f531397e7635 -r 751cf2c7614e tools/debugedit.c
Panu Matilainen d25c1c
--- a/tools/debugedit.c	Sun Oct 14 12:49:18 2007 +0300
Panu Matilainen d25c1c
+++ b/tools/debugedit.c	Thu Oct 18 09:34:54 2007 +0300
Panu Matilainen d25c1c
@@ -560,11 +560,16 @@ edit_dwarf2_line (DSO *dso, uint_32 off,
Panu Matilainen d25c1c
 	}
Panu Matilainen d25c1c
       else
Panu Matilainen d25c1c
 	{
Panu Matilainen d25c1c
-	  memcpy (s, comp_dir, comp_dir_len);
Panu Matilainen d25c1c
-	  s[comp_dir_len] = '/';
Panu Matilainen d25c1c
-	  memcpy (s + comp_dir_len + 1, dirt[value], dir_len);
Panu Matilainen d25c1c
-	  s[comp_dir_len + 1 + dir_len] = '/';
Panu Matilainen d25c1c
-	  memcpy (s + comp_dir_len + 1 + dir_len + 1, file, file_len + 1);
Panu Matilainen d25c1c
+	  char *p = s;
Panu Matilainen d25c1c
+	  if (comp_dir_len != 0)
Panu Matilainen d25c1c
+	    {
Panu Matilainen d25c1c
+	      memcpy (s, comp_dir, comp_dir_len);
Panu Matilainen d25c1c
+	      s[comp_dir_len] = '/';
Panu Matilainen d25c1c
+	      p += comp_dir_len + 1;
Panu Matilainen d25c1c
+	    }
Panu Matilainen d25c1c
+	  memcpy (p, dirt[value], dir_len);
Panu Matilainen d25c1c
+	  p[dir_len] = '/';
Panu Matilainen d25c1c
+	  memcpy (p + dir_len + 1, file, file_len + 1);
Panu Matilainen d25c1c
 	}
Panu Matilainen d25c1c
       canonicalize_path (s, s);
Panu Matilainen d25c1c
       if (list_file_fd != -1)
Panu Matilainen d25c1c
@@ -822,6 +827,7 @@ edit_attributes (DSO *dso, unsigned char
Panu Matilainen d25c1c
 
Panu Matilainen d25c1c
 	  switch (form)
Panu Matilainen d25c1c
 	    {
Panu Matilainen d25c1c
+	    case DW_FORM_ref_addr: /* ptr_size in DWARF 2, offset in DWARF 3 */
Panu Matilainen d25c1c
 	    case DW_FORM_addr:
Panu Matilainen d25c1c
 	      ptr += ptr_size;
Panu Matilainen d25c1c
 	      break;
Panu Matilainen d25c1c
@@ -847,7 +853,6 @@ edit_attributes (DSO *dso, unsigned char
Panu Matilainen d25c1c
 	    case DW_FORM_udata:
Panu Matilainen d25c1c
 	      read_uleb128 (ptr);
Panu Matilainen d25c1c
 	      break;
Panu Matilainen d25c1c
-	    case DW_FORM_ref_addr:
Panu Matilainen d25c1c
 	    case DW_FORM_strp:
Panu Matilainen d25c1c
 	      ptr += 4;
Panu Matilainen d25c1c
 	      break;