This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Search .dwo in the binary directory.
- From: "Ali Tamur via gdb-patches" <gdb-patches at sourceware dot org>
- To: gdb-patches at sourceware dot org
- Cc: Nitika dot Achra at amd dot com, JiniSusan dot George at amd dot com, Ali Tamur <tamur at google dot com>
- Date: Wed, 12 Feb 2020 22:19:03 -0800
- Subject: [PATCH] Search .dwo in the binary directory.
- Reply-to: Ali Tamur <tamur at google dot com>
.dwo files generated by the compiler usually resides in the same directory as
the generated binary itself. Add that binary to the list of directories to
search when searching for the .dwo file.
gdb/ChangeLog:
* dwarf2/read.c (try_open_dwop_file): Include binary directory to
the list of directories to search. Search the path also when looking
for a .dwo file.
---
gdb/dwarf2/read.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 7edbd9d7df..39f583e758 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -12012,9 +12012,14 @@ try_open_dwop_file (struct dwarf2_per_objfile *dwarf2_per_objfile,
else
search_path = debug_file_directory;
+ /* Add the directory of the binary to the search list. */
+ search_path_holder.reset(
+ concat (ldirname (dwarf2_per_objfile->objfile->original_name).c_str (),
+ dirname_separator_string, search_path, (char *) NULL));
+ search_path = search_path_holder.get ();
+
openp_flags flags = OPF_RETURN_REALPATH;
- if (is_dwp)
- flags |= OPF_SEARCH_IN_PATH;
+ flags |= OPF_SEARCH_IN_PATH;
gdb::unique_xmalloc_ptr<char> absolute_name;
desc = openp (search_path, flags, file_name,
--
2.25.0.265.gbab2e86ba0-goog