#15 Backported 2 bugfixes from upstream to fedora34
Merged a month ago by kevinb. Opened a month ago by blarsen.
rpms/ blarsen/gdb f34  into  f34

file modified
+8
@@ -384,3 +384,11 @@ 

  # (Tom de Vries)

  Patch093: gdb-dont-overwrite-fsgsbase-m32.patch

  

+ # Backport "[gdb/cli] Don't assert on empty string for core-file"

+ # (Tom de Vries)

+ Patch094: gdb-rhbz1916516-pathstuff.cc132-internal-error.patch

+ 

+ #[gdb] Improve early exits for env var in debuginfod-support.c

+ #(Tom de Vries)

+ Patch095: gdb-rhbz1970741-early-exit-for-empty-debuginfod-url.patch

+ 

file modified
+2
@@ -91,3 +91,5 @@ 

  %patch091 -p1

  %patch092 -p1

  %patch093 -p1

+ %patch094 -p1

+ %patch095 -p1

file modified
+2
@@ -91,3 +91,5 @@ 

  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

+ gdb-rhbz1970741-early-exit-for-empty-debuginfod-url.patch

@@ -0,0 +1,67 @@ 

+ From FEDORA_PATCHES Mon Sep 17 00:00:00 2001

+ From: Bruno Larsen <blarsen@redhat.com>

+ Date: Fri, 17 Sep 2021 11:39:31 -0300

+ Subject: gdb-rhbz1916516-pathstuff.cc132-internal-error.patch

+ 

+ ;; Backport "[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<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.

+ 

+ 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<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

+ --- 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]

@@ -0,0 +1,51 @@ 

+ From FEDORA_PATCHES Mon Sep 17 00:00:00 2001

+ From: Bruno Larsen <blarsen@redhat.com>

+ Date: Mon, 20 Sep 2021 16:47:10 -0300

+ Subject: gdb-rhbz1970741-early-exit-for-empty-debuginfod-url.patch

+ 

+ ;;[gdb] Improve early exits for env var in debuginfod-support.c

+ ;;(Tom de Vries)

+ 

+ There's an early exit in libdebuginfod's debuginfod_query_server, which checks

+ both for:

+ - getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL, and

+ - (getenv (DEBUGINFOD_URLS_ENV_VAR))[0] == '\0'.

+ 

+ In debuginfod_source_query and debuginfod_debuginfo_query (which both

+ end up calling debuginfod_query_server) there are also early exits checking

+ the same env var, but those just check for NULL.

+ 

+ Make the early exit tests in debuginfod-support.c match those in

+ libdebuginfod.

+ 

+ gdb/ChangeLog:

+ 

+ 2020-11-18  Tom de Vries  <tdevries@suse.de>

+ 

+ 	* debuginfod-support.c (debuginfod_source_query)

+ 	(debuginfod_debuginfo_query): Also do early exit if

+ 	"(getenv (DEBUGINFOD_URLS_ENV_VAR))[0] == '\0'".

+ 

+ diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c

+ --- a/gdb/debuginfod-support.c

+ +++ b/gdb/debuginfod-support.c

+ @@ -98,7 +98,8 @@ debuginfod_source_query (const unsigned char *build_id,

+  			 const char *srcpath,

+  			 gdb::unique_xmalloc_ptr<char> *destname)

+  {

+ -  if (getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL)

+ +  const char *urls_env_var = getenv (DEBUGINFOD_URLS_ENV_VAR);

+ +  if (urls_env_var == NULL || urls_env_var[0] == '\0')

+      return scoped_fd (-ENOSYS);

+  

+    debuginfod_client *c = debuginfod_init ();

+ @@ -135,7 +136,8 @@ debuginfod_debuginfo_query (const unsigned char *build_id,

+  			    const char *filename,

+  			    gdb::unique_xmalloc_ptr<char> *destname)

+  {

+ -  if (getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL)

+ +  const char *urls_env_var = getenv (DEBUGINFOD_URLS_ENV_VAR);

+ +  if (urls_env_var == NULL || urls_env_var[0] == '\0')

+      return scoped_fd (-ENOSYS);

+  

+    debuginfod_client *c = debuginfod_init ();

file modified
+9 -1
@@ -37,7 +37,7 @@ 

  

  # 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: 3%{?dist}

+ Release: 5%{?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.
@@ -1154,6 +1154,14 @@ 

  %endif

  

  %changelog

+ * Mon Sep 20 2021 Bruno Larsen <blarsen@redhat.com> - 10.2-5

+ - Backport "[gdb] Improve early exits for env var in debuginfod-support.c"

+   (Tom de Vries)

+ 

+ * Fri Sep 17 2021 Bruno Larsen <blarsen@redhat.com> - 10.2-4

+ - Backport "[gdb/cli] Don't assert on empty string for core-file".

+   (Tom de Vries)

+ 

  * Wed Jun  2 2021 Keith Seitz <keiths@redhat.com> - 10.2-3

  - Rebuilt.