diff options
author | Tom Tromey <tom@tromey.com> | 2021-07-04 13:26:15 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-07-17 10:41:42 -0600 |
commit | 4584f33d68b79c362ce9f3543052027b1676f30e (patch) | |
tree | 70a1be2b98dff96f47a37bb1df0bcfcbc97ba34b /gdb/psymtab.c | |
parent | d030267c9cc0fb594d3dda264b78114afc6eb214 (diff) | |
download | gdb-4584f33d68b79c362ce9f3543052027b1676f30e.zip gdb-4584f33d68b79c362ce9f3543052027b1676f30e.tar.gz gdb-4584f33d68b79c362ce9f3543052027b1676f30e.tar.bz2 |
Introduce find_source_or_rewrite
The final bug fix in this series would duplicate the logic in
psymtab_to_fullname, so this patch extracts the body of this function
into a new function.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r-- | gdb/psymtab.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 7c3017d..4c5b100 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -953,26 +953,9 @@ psymtab_to_fullname (struct partial_symtab *ps) to handle cases like the file being moved. */ if (ps->fullname == NULL) { - gdb::unique_xmalloc_ptr<char> fullname; - scoped_fd fd = find_and_open_source (ps->filename, ps->dirname, - &fullname); + gdb::unique_xmalloc_ptr<char> fullname + = find_source_or_rewrite (ps->filename, ps->dirname); ps->fullname = fullname.release (); - - if (fd.get () < 0) - { - /* rewrite_source_path would be applied by find_and_open_source, we - should report the pathname where GDB tried to find the file. */ - - if (ps->dirname == NULL || IS_ABSOLUTE_PATH (ps->filename)) - fullname.reset (xstrdup (ps->filename)); - else - fullname.reset (concat (ps->dirname, SLASH_STRING, - ps->filename, (char *) NULL)); - - ps->fullname = rewrite_source_path (fullname.get ()).release (); - if (ps->fullname == NULL) - ps->fullname = fullname.release (); - } } return ps->fullname; |