From 7b6a78398f6db8e9cb74ef418ddf5bbfea184a67 Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Tue, 28 Mar 2023 12:33:20 -0400 Subject: [PATCH] Backport portion of "Fix crash in new DWARF indexer" Resolves: rhbz#2150363 --- _gdb.spec.Patch.include | 5 +++ _gdb.spec.patch.include | 1 + _patch_order | 1 + ...arn-dw2_find_pc_sect_compunit_symtab.patch | 40 +++++++++++++++++++ gdb.spec | 4 ++ 5 files changed, 51 insertions(+) create mode 100644 gdb-rhbz2150363-warn-dw2_find_pc_sect_compunit_symtab.patch diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index cdcadc2..ef032e7 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -815,3 +815,8 @@ Patch199: gdb-rhbz2015131-restore-inferior-terminal-1of2.patch # (Simon Marchi, related to RHBZ 2015131) Patch200: gdb-rhbz2015131-avoid-sigttou-forks-2of2.patch +# Change assertion to warning in dw2_find_pc_sect_compunit_symtab +# Based on "Fix crash in new DWARF indexer" +# (Tom Tromey, RHBZ 2150363) +Patch201: gdb-rhbz2150363-warn-dw2_find_pc_sect_compunit_symtab.patch + diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index eba9d45..de30be0 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -198,3 +198,4 @@ %patch198 -p1 %patch199 -p1 %patch200 -p1 +%patch201 -p1 diff --git a/_patch_order b/_patch_order index 533f942..5e9106d 100644 --- a/_patch_order +++ b/_patch_order @@ -198,3 +198,4 @@ gdb-rhbz2012818-ibmz-update-5of5.patch gdb-rhbz2018504-do-not-update-elf-headers.patch gdb-rhbz2015131-restore-inferior-terminal-1of2.patch gdb-rhbz2015131-avoid-sigttou-forks-2of2.patch +gdb-rhbz2150363-warn-dw2_find_pc_sect_compunit_symtab.patch diff --git a/gdb-rhbz2150363-warn-dw2_find_pc_sect_compunit_symtab.patch b/gdb-rhbz2150363-warn-dw2_find_pc_sect_compunit_symtab.patch new file mode 100644 index 0000000..2b4c7d6 --- /dev/null +++ b/gdb-rhbz2150363-warn-dw2_find_pc_sect_compunit_symtab.patch @@ -0,0 +1,40 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Mon, 27 Mar 2023 16:05:48 -0400 +Subject: gdb-rhbz2150363-warn-dw2_find_pc_sect_compunit_symtab.patch + +;; Change assertion to warning in dw2_find_pc_sect_compunit_symtab +;; Based on "Fix crash in new DWARF indexer" +;; (Tom Tromey, RHBZ 2150363) + +The assertion: + +../../gdb/dwarf2read.c:5272: internal-error: compunit_symtab* dw2_find_pc_sect_compunit_symtab(objfile*, bound_minimal_symbol, CORE_ADDR, obj_section*, int): Assertion `result != NULL' failed. + +was removed with the "Fix crash in new DWARF indexer" patch. Backport +this assertion removal from this patch. + +diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c +--- a/gdb/dwarf2read.c ++++ b/gdb/dwarf2read.c +@@ -5261,15 +5261,15 @@ dw2_find_pc_sect_compunit_symtab (struct objfile *objfile, + if (!data) + return NULL; + +- if (warn_if_readin && data->v.quick->compunit_symtab) +- warning (_("(Internal error: pc %s in read in CU, but not in symtab.)"), +- paddress (get_objfile_arch (objfile), pc)); +- + result + = recursively_find_pc_sect_compunit_symtab (dw2_instantiate_symtab (data, + false), + pc); +- gdb_assert (result != NULL); ++ ++ if (warn_if_readin && result == nullptr) ++ warning (_("(Internal error: pc %s in read in CU, but not in symtab.)"), ++ paddress (get_objfile_arch (objfile), pc)); ++ + return result; + } + diff --git a/gdb.spec b/gdb.spec index 2806f06..69bba90 100644 --- a/gdb.spec +++ b/gdb.spec @@ -1062,6 +1062,10 @@ fi %endif %changelog +* Tue Mar 28 2023 Keith Seitz +- Backport portion of "Fix crash in new DWARF indexer". + (Tom Tromey, RH BZ 2150363) + * Tue May 24 2022 Keith Seitz - 8.2-19.el8 - Backport "Fix restoring of inferior terminal settings" - Backport "Avoid GDB SIGTTOU on catch exec + set follow-exec-mode