Annotation of /trunk/gdb/patches/gdb-6.4-relative-paths.patch
Parent Directory | Revision Log
Revision 144 -
(hide annotations)
(download)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 3147 byte(s)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 3147 byte(s)
-import
1 | niro | 144 | --- gdb-6.4/gdb/dwarf2read.c |
2 | +++ gdb-6.4/gdb/dwarf2read.c | ||
3 | @@ -838,7 +838,7 @@ static struct line_header *(dwarf_decode | ||
4 | static void dwarf_decode_lines (struct line_header *, char *, bfd *, | ||
5 | struct dwarf2_cu *, struct partial_symtab *); | ||
6 | |||
7 | -static void dwarf2_start_subfile (char *, char *); | ||
8 | +static void dwarf2_start_subfile (char *, char *, char *); | ||
9 | |||
10 | static struct symbol *new_symbol (struct die_info *, struct type *, | ||
11 | struct dwarf2_cu *); | ||
12 | @@ -6474,13 +6474,11 @@ dwarf_decode_lines (struct line_header * | ||
13 | directory and file name numbers in the statement program | ||
14 | are 1-based. */ | ||
15 | struct file_entry *fe = &lh->file_names[file - 1]; | ||
16 | - char *dir; | ||
17 | + char *dir = NULL; | ||
18 | |||
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 | @@ -6582,7 +6580,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 | @@ -6662,7 +6660,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 | @@ -6681,8 +6680,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 | @@ -6690,19 +6700,20 @@ dwarf2_start_subfile (char *filename, ch | ||
69 | { | ||
70 | struct subfile *subfile; | ||
71 | char *fullname = concat (dirname, "/", filename, (char *)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 |