aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/corelow.c3
-rw-r--r--gdb/testsuite/gdb.base/batch-exit-status.exp4
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/corelow.c b/gdb/corelow.c
index eb785a0..711e86c 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -428,7 +428,8 @@ core_target_open (const char *arg, int from_tty)
}
gdb::unique_xmalloc_ptr<char> filename (tilde_expand (arg));
- if (!IS_ABSOLUTE_PATH (filename.get ()))
+ if (strlen (filename.get ()) != 0
+ && !IS_ABSOLUTE_PATH (filename.get ()))
filename = gdb_abspath (filename.get ());
flags = O_BINARY | O_LARGEFILE;
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]