This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 0/4] Some fixes for debug files and sysroots
- From: John Baldwin <jhb at FreeBSD dot org>
- To: gdb-patches at sourceware dot org
- Date: Mon, 28 Jan 2019 12:47:01 -0800
- Subject: [PATCH v2 0/4] Some fixes for debug files and sysroots
Relative to the first series:
1) I combined the duplicate checks for "are we in a sysroot" in the
first patch as as suggested by Simon.
2) I dropped the second patch (trim trailing '/' from sysroot).
3) Patches 2 and 3 are a different take on solving the issue when the
sysroot ends in '/'. Patch 2 adds a 'child_path' function to
determine if a child path is a child of a parent (requiring the child
to have at least one component "below" the parent). It also returns
a pointer to the first component below the parent (but after the
directory separator). Patch 3 uses child_path in
find_separate_debug_file which fixes it in the case that the sysroot
ends in a /.
4) The 4th patch is a new patch for a different issue I ran into while
testing this some more today. The paths to object files are always
canonical paths with symlinks resolved. If the sysroot entered by
the user is a path containing symlinks, the filename_ncmp will
never match. To handle sysroot paths that traverse symlinks,
use gdb_realpath to generate a canonical sysroot path and use that
instead of gdb_sysroot with child_path.
As an aside, it's not clear to me when one should use gdb_realpath
instead of lrealpath. gdb_realpath seems more widespread and also
returns an RAII-friendly type, so I used that.
John Baldwin (4):
Look for separate debug files in debug directories under a sysroot.
Add a new function child_path.
Use child_path to determine if an object file is under a sysroot.
Try to use the canonical version of a sysroot for debug file links.
gdb/ChangeLog | 23 ++++++++++
gdb/Makefile.in | 1 +
gdb/common/pathstuff.c | 52 ++++++++++++++++++++++
gdb/common/pathstuff.h | 6 +++
gdb/symfile.c | 36 +++++++++++++---
gdb/unittests/child-path-selftests.c | 64 ++++++++++++++++++++++++++++
6 files changed, 175 insertions(+), 7 deletions(-)
create mode 100644 gdb/unittests/child-path-selftests.c
--
2.19.2