Blame SOURCES/gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-5of5.patch

689258
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
689258
From: Sergio Durigan Junior <sergiodj@redhat.com>
689258
Date: Fri, 11 Jan 2019 11:31:59 -0500
689258
Subject: 
689258
 gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-5of5.patch
689258
689258
;; Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
689258
;; Keith Seitz, RHBZ#1560010.
689258
689258
gdb/23712: Test case for multidictionary
689258
689258
This is a test derived from one of the reproducers in symtab/23010.
689258
The DIE tree used here is typical of compilations with LTO, where an
689258
artificial parent DIE of language C99 imports DIEs of other languages.
689258
689258
gdb/testsuite/ChangeLog:
689258
689258
	PR gdb/23712
689258
	PR symtab/23010
689258
	* gdb.dwarf2/multidictionary.exp: New file.
689258
689258
diff --git a/gdb/testsuite/gdb.dwarf2/multidictionary.exp b/gdb/testsuite/gdb.dwarf2/multidictionary.exp
689258
new file mode 100644
689258
--- /dev/null
689258
+++ b/gdb/testsuite/gdb.dwarf2/multidictionary.exp
689258
@@ -0,0 +1,157 @@
689258
+# Copyright 2019 Free Software Foundation, Inc.
689258
+
689258
+# This program is free software; you can redistribute it and/or modify
689258
+# it under the terms of the GNU General Public License as published by
689258
+# the Free Software Foundation; either version 3 of the License, or
689258
+# (at your option) any later version.
689258
+#
689258
+# This program is distributed in the hope that it will be useful,
689258
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
689258
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
689258
+# GNU General Public License for more details.
689258
+#
689258
+# You should have received a copy of the GNU General Public License
689258
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
689258
+
689258
+# A test of multi-language dictionaries, a solution to symtab/23010 et al.
689258
+
689258
+load_lib dwarf.exp
689258
+
689258
+# This test can only be run on targets which support DWARF.
689258
+if {![dwarf2_support]} {
689258
+    return 0
689258
+}
689258
+
689258
+standard_testfile main.c .S
689258
+
689258
+# Create the DWARF.  This is derived from the reproducer in the bug
689258
+# mentioned above.  This DIE tree is typical of compilations wtih
689258
+# LTO enabled.
689258
+
689258
+set asm_file [standard_output_file $srcfile2]
689258
+Dwarf::assemble $asm_file {
689258
+    declare_labels D45d9 D5079 D5080 D50a9 D50af D5ab2 D5ac2 D5ace D5acf
689258
+    declare_labels D2135f D2216a D22171 D226c4 D226ca D244ca \
689258
+	D245da D245e6
689258
+    declare_labels D41c21 D42025 D42045 D42038 D42045 D420b5
689258
+
689258
+    cu {} {
689258
+	D45d9: compile_unit {
689258
+	    {language @DW_LANG_C_plus_plus}
689258
+	    {name "SerialPortUtils.cpp"}
689258
+	} {
689258
+	    D5079: base_type {
689258
+		{byte_size 1 sdata}
689258
+		{encoding @DW_ATE_unsigned}
689258
+		{name "char"}
689258
+	    }
689258
+
689258
+	    D5080: const_type {
689258
+		{type :$D5079}
689258
+	    }
689258
+
689258
+	    D50a9: pointer_type {
689258
+		{byte_size 4 sdata}
689258
+		{type :$D5080}
689258
+	    }
689258
+
689258
+	    D50af: const_type {
689258
+		{type :$D50a9}
689258
+	    }
689258
+
689258
+	    D5ab2: subprogram {
689258
+		{external 1 flag}
689258
+		{linkage_name "_Z18SerialSyncWriteStrPKc"}
689258
+	    } {
689258
+		D5ac2: formal_parameter {
689258
+		    {name "msg"}
689258
+		    {type :$D50af}
689258
+		}
689258
+		D5ace: lexical_block {} {
689258
+		    D5acf: DW_TAG_variable {
689258
+			{name "p"}
689258
+			{type :$D50a9}
689258
+		    }
689258
+		}
689258
+	    }
689258
+	}
689258
+    }
689258
+
689258
+    cu {} {
689258
+	D2135f: compile_unit {
689258
+	    {language @DW_LANG_C_plus_plus}
689258
+	    {name "Main.cpp"}
689258
+	} {
689258
+	    D2216a: base_type {
689258
+		{byte_size 1 sdata}
689258
+		{encoding @DW_ATE_unsigned_char}
689258
+		{name "char"}
689258
+	    }
689258
+
689258
+	    D22171: const_type {
689258
+		{type :$D2216a}
689258
+	    }
689258
+
689258
+	    D226c4: pointer_type {
689258
+		{byte_size 4 sdata}
689258
+		{type :$D22171}
689258
+	    }
689258
+
689258
+	    D226ca: const_type {
689258
+		{type :$D226c4}
689258
+	    }
689258
+
689258
+	    D245da: subprogram {
689258
+		{name "PrintPanicMsg"}
689258
+	    } {
689258
+		D245e6: formal_parameter {
689258
+		    {name "msg"}
689258
+		    {type :$D226ca}
689258
+		}
689258
+	    }
689258
+	}
689258
+    }
689258
+
689258
+    cu {} {
689258
+       D41c21: compile_unit {
689258
+           {language @DW_LANG_C99}
689258
+           {name "<artificial>"}
689258
+       } {
689258
+           D42025: subprogram {
689258
+               {abstract_origin %$D245da}
689258
+               {low_pc 0x80b60 addr}
689258
+               {high_pc 0x6c data4}
689258
+           } {
689258
+	       D42038: formal_parameter {
689258
+		   {abstract_origin %$D245e6}
689258
+	       }
689258
+
689258
+	       D42045: inlined_subroutine {
689258
+                   {abstract_origin %$D5ab2}
689258
+                   {low_pc 0x8060 addr}
689258
+                   {high_pc 0xc data4}
689258
+               } {
689258
+                   D420b5: formal_parameter {
689258
+                       {abstract_origin %$D5ac2}
689258
+                   }
689258
+               }
689258
+           }
689258
+       }
689258
+    }
689258
+}
689258
+
689258
+# Build the test executable.
689258
+if {[build_executable $testfile.exp $testfile [list $asm_file $srcfile] {}] \
689258
+	== -1} {
689258
+    return -1
689258
+}
689258
+
689258
+# We force the DIEs above to be read in via "-readnow".
689258
+gdb_spawn_with_cmdline_opts "-readnow"
689258
+gdb_load $binfile
689258
+
689258
+# All we need to do is check whether GDB is alive.  Without
689258
+# multidictionaries, it will either crash, assert, or throw an
689258
+# internal_error.
689258
+gdb_test "p 1" "= 1" "GDB is alive"
689258
+