Panu Matilainen 6d40e7
From roland@redhat.com Sun Aug 12 15:45:49 2007
Panu Matilainen 6d40e7
Date: Sun, 12 Aug 2007 05:45:16 -0700 (PDT)
Panu Matilainen 6d40e7
From: Roland McGrath <roland@redhat.com>
Panu Matilainen 6d40e7
To: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 6d40e7
Cc: Paul Nasrat <pnasrat@redhat.com>
Panu Matilainen 6d40e7
Subject: Re: debugedit.c goof
Panu Matilainen 6d40e7
Panu Matilainen 6d40e7
> No need, already applied upstream HEAD, 4.4.x branch and rawhide build 
Panu Matilainen 6d40e7
> with the fix triggered.
Panu Matilainen 6d40e7
Panu Matilainen 6d40e7
Too quick!  I have another fix. ;-)
Panu Matilainen 6d40e7
Panu Matilainen 6d40e7
This one is less trivial, and not tested.  It should make it put names in
Panu Matilainen 6d40e7
the -l file when they match the edit replace directory name as well as the
Panu Matilainen 6d40e7
edit match directory name, the point being that it emits the same names
Panu Matilainen 6d40e7
when run twice in a row.
Panu Matilainen 6d40e7
Panu Matilainen 6d40e7
Thanks,
Panu Matilainen 6d40e7
Roland
Panu Matilainen 6d40e7
Panu Matilainen 6d40e7
Panu Matilainen 6d40e7
diff -r fb1ee4c438c9 tools/debugedit.c
Panu Matilainen 6d40e7
--- a/tools/debugedit.c	Sun Aug 12 15:27:46 2007 +0300
Panu Matilainen 6d40e7
+++ b/tools/debugedit.c	Sun Aug 12 05:42:13 2007 -0700
Panu Matilainen 6d40e7
@@ -567,23 +567,22 @@ edit_dwarf2_line (DSO *dso, uint_32 off,
Panu Matilainen 6d40e7
 	  memcpy (s + comp_dir_len + 1 + dir_len + 1, file, file_len + 1);
Panu Matilainen 6d40e7
 	}
Panu Matilainen 6d40e7
       canonicalize_path (s, s);
Panu Matilainen 6d40e7
-      if (base_dir == NULL ||
Panu Matilainen 6d40e7
-	  has_prefix (s, base_dir))
Panu Matilainen 6d40e7
-	{
Panu Matilainen 6d40e7
-	  char *p;
Panu Matilainen 6d40e7
-	  size_t size;
Panu Matilainen 6d40e7
-	  ssize_t ret;
Panu Matilainen 6d40e7
-	  if (base_dir)
Panu Matilainen 6d40e7
+      if (list_file_fd != -1)
Panu Matilainen 6d40e7
+	{
Panu Matilainen 6d40e7
+	  char *p = NULL;
Panu Matilainen 6d40e7
+	  if (base_dir == NULL)
Panu Matilainen 6d40e7
+	    p = s;
Panu Matilainen 6d40e7
+	  else if (has_prefix (s, base_dir))
Panu Matilainen 6d40e7
 	    p = s + strlen (base_dir);
Panu Matilainen 6d40e7
-	  else
Panu Matilainen 6d40e7
-	    p = s;
Panu Matilainen 6d40e7
-	  
Panu Matilainen 6d40e7
-	  if (list_file_fd != -1)
Panu Matilainen 6d40e7
+	  else if (has_prefix (s, dest_dir))
Panu Matilainen 6d40e7
+	    p = s + strlen (dest_dir);
Panu Matilainen 6d40e7
+
Panu Matilainen 6d40e7
+	  if (p)
Panu Matilainen 6d40e7
 	    {
Panu Matilainen 6d40e7
-	      size = strlen (p) + 1;
Panu Matilainen 6d40e7
+	      size_t size = strlen (p) + 1;
Panu Matilainen 6d40e7
 	      while (size > 0)
Panu Matilainen 6d40e7
 		{
Panu Matilainen 6d40e7
-		  ret = write (list_file_fd, p, size);
Panu Matilainen 6d40e7
+		  ssize_t ret = write (list_file_fd, p, size);
Panu Matilainen 6d40e7
 		  if (ret == -1)
Panu Matilainen 6d40e7
 		    break;
Panu Matilainen 6d40e7
 		  size -= ret;