summaryrefslogtreecommitdiff
blob: fe2fec6e555321827a00a90a58c3e08197101a33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--- debugedit.c.orig	2007-11-07 05:54:25.093281634 +0000
+++ debugedit.c	2007-11-07 06:23:15.481373200 +0000
@@ -723,8 +723,31 @@
 		}
 	    }
 
-	    if (t->attr[i].attr == DW_AT_comp_dir) {
-		if (form == DW_FORM_strp &&
+	  else if (t->attr[i].attr == DW_AT_comp_dir)
+	    {
+	      if (form == DW_FORM_string)
+	        {
+		  free (comp_dir);
+		  comp_dir = strdup (ptr);
+
+		  if (phase == 1 && dest_dir && has_prefix (ptr, base_dir))
+		    {
+		      base_len = strlen (base_dir);
+		      dest_len = strlen (dest_dir);
+
+		      memcpy (ptr, dest_dir, dest_len);
+		      if (dest_len < base_len)
+		        {
+			  memset (ptr + dest_len, '/',
+				  base_len - dest_len);
+
+		        }
+		      elf_flagdata (debug_sections[DEBUG_INFO].elf_data,
+				    ELF_C_SET, ELF_F_DIRTY);
+		    }
+	       }
+
+	     else if (form == DW_FORM_strp &&
 	      debug_sections[DEBUG_STR].data)
 	    {
 	      char *dir;
@@ -749,11 +772,8 @@
 				ELF_C_SET, ELF_F_DIRTY);
 		}
 	    }
-		else if (form == DW_FORM_string) {
-			free(comp_dir);
-			comp_dir = strdup (ptr);			
-		}
 	    }
+
 	  else if ((t->tag == DW_TAG_compile_unit
 		    || t->tag == DW_TAG_partial_unit)
 		   && t->attr[i].attr == DW_AT_name