diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2013-02-03 16:22:29 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2013-02-03 16:22:29 +0000 |
commit | da235a7c2183d92f9be66642d5b357729078a39b (patch) | |
tree | a65d3c15271ac50f2402fbedbf0c0c8eb4d00d9c /gdb | |
parent | fbd9ab743390e50f3f829f4d634deb931cc2b819 (diff) | |
download | gdb-da235a7c2183d92f9be66642d5b357729078a39b.zip gdb-da235a7c2183d92f9be66642d5b357729078a39b.tar.gz gdb-da235a7c2183d92f9be66642d5b357729078a39b.tar.bz2 |
gdb/
* dwarf2read.c (dw2_map_symtabs_matching_filename): Move variable
this_real_name to outer block. Use it also for
compare_filenames_for_search.
(dw2_expand_symtabs_matching): New variable this_real_name. Use it
with dw2_get_real_path for file_matcher, considering also
BASENAMES_MAY_DIFFER.
(file_full_name): Prepend COMP_DIR even for relative lh->INCLUDE_DIRS.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 50 |
2 files changed, 44 insertions, 16 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 831ebe8..53ee3c4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2013-02-03 Jan Kratochvil <jan.kratochvil@redhat.com> + * dwarf2read.c (dw2_map_symtabs_matching_filename): Move variable + this_real_name to outer block. Use it also for + compare_filenames_for_search. + (dw2_expand_symtabs_matching): New variable this_real_name. Use it + with dw2_get_real_path for file_matcher, considering also + BASENAMES_MAY_DIFFER. + (file_full_name): Prepend COMP_DIR even for relative lh->INCLUDE_DIRS. + +2013-02-03 Jan Kratochvil <jan.kratochvil@redhat.com> + * dwarf2read.c (dw2_expand_symtabs_matching): Add basenames parameter to the file_matcher parameter. Pass 0 to it. (dwarf2_create_include_psymtab): Copy also DIRNAME. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 9e8c01b..e017586 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -3072,6 +3072,7 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name, for (j = 0; j < file_data->num_file_names; ++j) { const char *this_name = file_data->file_names[j]; + const char *this_real_name; if (compare_filenames_for_search (this_name, name)) { @@ -3086,11 +3087,16 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name, && FILENAME_CMP (lbasename (this_name), name_basename) != 0) continue; - if (real_path != NULL) + this_real_name = dw2_get_real_path (objfile, file_data, j); + if (compare_filenames_for_search (this_real_name, name)) { - const char *this_real_name = dw2_get_real_path (objfile, - file_data, j); + if (dw2_map_expand_apply (objfile, per_cu, name, real_path, + callback, data)) + return 1; + } + if (real_path != NULL) + { gdb_assert (IS_ABSOLUTE_PATH (real_path)); gdb_assert (IS_ABSOLUTE_PATH (name)); if (this_real_name != NULL @@ -3533,11 +3539,27 @@ dw2_expand_symtabs_matching for (j = 0; j < file_data->num_file_names; ++j) { + const char *this_real_name; + if (file_matcher (file_data->file_names[j], data, 0)) { per_cu->v.quick->mark = 1; break; } + + /* Before we invoke realpath, which can get expensive when many + files are involved, do a quick comparison of the basenames. */ + if (!basenames_may_differ + && !file_matcher (lbasename (file_data->file_names[j]), + data, 1)) + continue; + + this_real_name = dw2_get_real_path (objfile, file_data, j); + if (file_matcher (this_real_name, data, 0)) + { + per_cu->v.quick->mark = 1; + break; + } } slot = htab_find_slot (per_cu->v.quick->mark @@ -18030,23 +18052,19 @@ file_full_name (int file, struct line_header *lh, const char *comp_dir) else { const char *dir; - int dir_len; - char *full_name; - if (fe->dir_index) - dir = lh->include_dirs[fe->dir_index - 1]; - else + if (fe->dir_index == 0) dir = comp_dir; + else + { + dir = lh->include_dirs[fe->dir_index - 1]; + if (!IS_ABSOLUTE_PATH (dir)) + return concat (comp_dir, SLASH_STRING, dir, SLASH_STRING, + fe->name, NULL); + } if (dir) - { - dir_len = strlen (dir); - full_name = xmalloc (dir_len + 1 + strlen (fe->name) + 1); - strcpy (full_name, dir); - full_name[dir_len] = '/'; - strcpy (full_name + dir_len + 1, fe->name); - return full_name; - } + return concat (dir, SLASH_STRING, fe->name, NULL); else return xstrdup (fe->name); } |