[gdb/cli] Don't assert on empty string for core-file
authorTom de Vries <tdevries@suse.de>
Mon, 30 Aug 2021 14:03:15 +0000 (16:03 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 30 Aug 2021 14:03:15 +0000 (16:03 +0200)
commite1652de24afa57d8a66d5f37642d1922dbf9c984
tree60f7971a8f95ad7f7b91a57025c7a8aabdb2748e
parent897254e07337dec60b215cd4441b213eb2eb1f5d
[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.
gdb/ChangeLog
gdb/corelow.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/batch-exit-status.exp
This page took 0.025135 seconds and 4 git commands to generate.