Contents of /trunk/gdb/patches/gdb-6.3-relative-paths.patch
Parent Directory | Revision Log
Revision 144 -
(show annotations)
(download)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 3286 byte(s)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 3286 byte(s)
-import
1 | diff -Nrup gdb-6.3.orig/gdb/dwarf2read.c gdb-6.3/gdb/dwarf2read.c |
2 | --- gdb-6.3.orig/gdb/dwarf2read.c 2004-10-15 20:41:00.000000000 -0400 |
3 | +++ gdb-6.3/gdb/dwarf2read.c 2004-11-27 20:35:38.000000000 -0500 |
4 | @@ -840,7 +840,7 @@ static struct line_header *(dwarf_decode |
5 | static void dwarf_decode_lines (struct line_header *, char *, bfd *, |
6 | struct dwarf2_cu *, struct partial_symtab *); |
7 | |
8 | -static void dwarf2_start_subfile (char *, char *); |
9 | +static void dwarf2_start_subfile (char *, char *, char *); |
10 | |
11 | static struct symbol *new_symbol (struct die_info *, struct type *, |
12 | struct dwarf2_cu *); |
13 | @@ -6456,12 +6456,10 @@ dwarf_decode_lines (struct line_header * |
14 | directory and file name numbers in the statement program |
15 | are 1-based. */ |
16 | struct file_entry *fe = &lh->file_names[file - 1]; |
17 | - char *dir; |
18 | + char *dir = NULL; |
19 | if (fe->dir_index) |
20 | dir = lh->include_dirs[fe->dir_index - 1]; |
21 | - else |
22 | - dir = comp_dir; |
23 | - dwarf2_start_subfile (fe->name, dir); |
24 | + dwarf2_start_subfile (fe->name, dir, comp_dir); |
25 | } |
26 | |
27 | /* Decode the table. */ |
28 | @@ -6561,7 +6559,7 @@ dwarf_decode_lines (struct line_header * |
29 | else |
30 | dir = comp_dir; |
31 | if (!decode_for_pst_p) |
32 | - dwarf2_start_subfile (fe->name, dir); |
33 | + dwarf2_start_subfile (fe->name, dir, comp_dir); |
34 | } |
35 | break; |
36 | case DW_LNS_set_column: |
37 | @@ -6619,7 +6617,8 @@ dwarf_decode_lines (struct line_header * |
38 | |
39 | /* Start a subfile for DWARF. FILENAME is the name of the file and |
40 | DIRNAME the name of the source directory which contains FILENAME |
41 | - or NULL if not known. |
42 | + or NULL if not known. COMP_DIR is the value of DW_AT_comp_dir. If |
43 | + DIRNAME specifies a relative path, it is appended to COMP_DIR. |
44 | This routine tries to keep line numbers from identical absolute and |
45 | relative file names in a common subfile. |
46 | |
47 | @@ -6638,8 +6637,19 @@ dwarf_decode_lines (struct line_header * |
48 | subfile, so that `break /srcdir/list0.c:1' works as expected. */ |
49 | |
50 | static void |
51 | -dwarf2_start_subfile (char *filename, char *dirname) |
52 | +dwarf2_start_subfile (char *filename, char *dirname, char *comp_dir) |
53 | { |
54 | + struct cleanup *back_to = make_cleanup (null_cleanup, 0); |
55 | + |
56 | + /* If we have a relative dirname, append it to comp_dir. */ |
57 | + if (dirname != NULL && !IS_ABSOLUTE_PATH (dirname) && comp_dir != NULL) |
58 | + { |
59 | + dirname = concat (comp_dir, "/", dirname, NULL); |
60 | + make_cleanup (xfree, dirname); |
61 | + } |
62 | + else if (dirname == NULL) |
63 | + dirname = comp_dir; |
64 | + |
65 | /* If the filename isn't absolute, try to match an existing subfile |
66 | with the full pathname. */ |
67 | |
68 | @@ -6647,19 +6657,20 @@ dwarf2_start_subfile (char *filename, ch |
69 | { |
70 | struct subfile *subfile; |
71 | char *fullname = concat (dirname, "/", filename, NULL); |
72 | + make_cleanup (xfree, fullname); |
73 | |
74 | for (subfile = subfiles; subfile; subfile = subfile->next) |
75 | { |
76 | if (FILENAME_CMP (subfile->name, fullname) == 0) |
77 | { |
78 | current_subfile = subfile; |
79 | - xfree (fullname); |
80 | + do_cleanups (back_to); |
81 | return; |
82 | } |
83 | } |
84 | - xfree (fullname); |
85 | } |
86 | start_subfile (filename, dirname); |
87 | + do_cleanups (back_to); |
88 | } |
89 | |
90 | static void |