binutils-gdb/gdb/unittests
Lancelot SIX d3ee35dbf7 Improve gdb_tilde_expand logic.
Before this patch, gdb_tilde_expand would use glob(3) in order to expand
tilde at the begining of a path. This implementation has limitation when
expanding a tilde leading path to a non existing file since glob fails to
expand.

This patch proposes to use glob only to expand the tilde component of the
path and leaves the rest of the path unchanged.

This patch is a followup to the following discution:
https://sourceware.org/pipermail/gdb-patches/2021-January/174776.html

Before the patch:

	gdb_tilde_expand("~") -> "/home/lsix"
	gdb_tilde_expand("~/a/c/b") -> error() is called

After the patch:

	gdb_tilde_expand("~") -> "/home/lsix"
	gdb_tilde_expand("~/a/c/b") -> "/home/lsix/a/c/b"

Tested on x84_64 linux.

gdb/ChangeLog:

	* Makefile.in (SELFTESTS_SRCS): Add
	unittests/gdb_tilde_expand-selftests.c.
	* unittests/gdb_tilde_expand-selftests.c: New file.

gdbsupport/ChangeLog:

	* gdb_tilde_expand.cc (gdb_tilde_expand): Improve
	implementation.
	(gdb_tilde_expand_up): Delegate logic to gdb_tilde_expand.
	* gdb_tilde_expand.h (gdb_tilde_expand): Update description.
2021-01-23 17:17:38 +00:00
..
basic_string_view Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
optional gdb: make some variables static 2021-01-20 20:55:05 -05:00
array-view-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
child-path-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-utils-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
command-def-selftests.c gdb: make some variables static 2021-01-20 20:55:05 -05:00
common-utils-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
copy_bitwise-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
enum-flags-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
environ-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
filtered_iterator-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
format_pieces-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
function-view-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
gdb_tilde_expand-selftests.c Improve gdb_tilde_expand logic. 2021-01-23 17:17:38 +00:00
gmp-utils-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
lookup_name_info-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
main-thread-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
memory-map-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
memrange-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
mkdir-recursive-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
observable-selftests.c gdb: make some variables static 2021-01-20 20:55:05 -05:00
offset-type-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
optional-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
parse-connection-spec-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
ptid-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
rsp-low-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
scoped_fd-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
scoped_mmap-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
scoped_restore-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
search-memory-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
string_view-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
style-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tracepoint-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
unpack-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
utils-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
vec-utils-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
xml-utils-selftests.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00