diff options
author | Tom de Vries <tdevries@suse.de> | 2021-08-30 14:34:03 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-08-30 14:34:03 +0200 |
commit | f947f96797f8ec33aabf9cd7234c850778068445 (patch) | |
tree | 56d89d721def8c3a0c43d1e6a37c29cfb0bd7038 /gdb/testsuite | |
parent | 9b9b1092f0a8e6b7d240ea05a74968a883b8a05c (diff) | |
download | gdb-f947f96797f8ec33aabf9cd7234c850778068445.zip gdb-f947f96797f8ec33aabf9cd7234c850778068445.tar.gz gdb-f947f96797f8ec33aabf9cd7234c850778068445.tar.bz2 |
[gdb/cli] Don't assert on empty string for core-file
With current gdb we run into:
...
$ gdb -batch '' ''
: No such file or directory.
pathstuff.cc:132: internal-error: \
gdb::unique_xmalloc_ptr<char> gdb_abspath(const char*): \
Assertion `path != NULL && path[0] != '\0'' failed.
...
Fix this by skipping the call to gdb_abspath in core_target_open in the
empty-string case, such that we have instead:
...
$ gdb -batch '' ''
: No such file or directory.
: No such file or directory.
$
...
Tested on x86_64-linux.
gdb/ChangeLog:
2021-08-30 Tom de Vries <tdevries@suse.de>
PR cli/28290
* gdb/corelow.c (core_target_open): Skip call to gdb_abspath in the
empty-string case.
gdb/testsuite/ChangeLog:
2021-08-30 Tom de Vries <tdevries@suse.de>
PR cli/28290
* gdb.base/batch-exit-status.exp: Add gdb '' and gdb '' '' tests.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.base/batch-exit-status.exp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp index 085dfc6..9a08019 100644 --- a/gdb/testsuite/gdb.base/batch-exit-status.exp +++ b/gdb/testsuite/gdb.base/batch-exit-status.exp @@ -76,3 +76,7 @@ test_exit_status 1 "-batch -x $good_commands -x $bad_commands" \ "-batch -x good-commands -x bad-commands" test_exit_status 1 "-batch -x $good_commands -ex \"set not-a-thing 4\"" \ "-batch -x good-commands -ex \"set not-a-thing 4\"" + +set no_such_re ": No such file or directory\\." +test_exit_status 1 "-batch \"\"" $no_such_re +test_exit_status 1 "-batch \"\" \"\"" [multi_line $no_such_re $no_such_re] |