diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index 6374bfc..b8a5eae 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -364,3 +364,7 @@ Patch087: gdb-gdb27743-psymtab-imported-unit.patch # (Tom de Vries) Patch088: gdb-dont-overwrite-fsgsbase-m32.patch +#[gdb/cli] Don't assert on empty string for core-file +#(Tom de Vries) +Patch089: gdb-rhbz1916516-pathstuff.cc132-internal-error.patch + diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index b6c1352..dd1a19f 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -86,3 +86,4 @@ %patch086 -p1 %patch087 -p1 %patch088 -p1 +%patch089 -p1 diff --git a/_patch_order b/_patch_order index 1293fad..b171f1b 100644 --- a/_patch_order +++ b/_patch_order @@ -86,3 +86,4 @@ gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch gdb-gdb27743-psymtab-imported-unit.patch gdb-dont-overwrite-fsgsbase-m32.patch +gdb-rhbz1916516-pathstuff.cc132-internal-error.patch diff --git a/gdb-rhbz1916516-pathstuff.cc132-internal-error.patch b/gdb-rhbz1916516-pathstuff.cc132-internal-error.patch new file mode 100644 index 0000000..6801743 --- /dev/null +++ b/gdb-rhbz1916516-pathstuff.cc132-internal-error.patch @@ -0,0 +1,67 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 30 Aug 2021 16:03:15 +0200 +Subject: gdb-rhbz1916516-pathstuff.cc132-internal-error.patch + +;;[gdb/cli] Don't assert on empty string for core-file +;;(Tom de Vries) + +With current gdb we run into: +... +$ gdb -batch '' '' +: No such file or directory. +pathstuff.cc:132: internal-error: \ + gdb::unique_xmalloc_ptr 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 + + 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 + + PR cli/28290 + * gdb.base/batch-exit-status.exp: Add gdb '' and gdb '' '' tests. + +diff --git a/gdb/corelow.c b/gdb/corelow.c +--- a/gdb/corelow.c ++++ b/gdb/corelow.c +@@ -446,7 +446,8 @@ core_target_open (const char *arg, int from_tty) + } + + gdb::unique_xmalloc_ptr 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 +--- 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] diff --git a/gdb.spec b/gdb.spec index 45528d1..30b5488 100644 --- a/gdb.spec +++ b/gdb.spec @@ -37,7 +37,7 @@ Version: 10.2 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL # Do not provide URL for snapshots as the file lasts there only for 2 days. @@ -1148,6 +1148,10 @@ fi %endif %changelog +* Thu Sep 23 2021 Bruno Larsen - 10.2-2 +- Backport "[gdb/cli] Don't assert on empty string for core-file" + (Tom de Vries) + * Thu Jun 24 2021 Kevin Buettner - 10.2-1 - Rebase to FSF GDB 10.2. - Drop gdb-6.3-test-pie-20050107.patch.