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