diff options
author | Pedro Alves <palves@redhat.com> | 2015-08-20 12:30:08 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-08-20 12:30:08 +0100 |
commit | 40e3ad0ebb0c71008b928d6d350e9258dc1dcf2a (patch) | |
tree | 162374e0eae01a1ab9f41f8752f9c42a23d9f019 /gdb/testsuite/gdb.dwarf2/comp-unit-lang.c | |
parent | af39b3270a1385027b2a5d145b9ba7564bd39f7a (diff) | |
download | binutils-40e3ad0ebb0c71008b928d6d350e9258dc1dcf2a.zip binutils-40e3ad0ebb0c71008b928d6d350e9258dc1dcf2a.tar.gz binutils-40e3ad0ebb0c71008b928d6d350e9258dc1dcf2a.tar.bz2 |
Fix language of compilation unit with unknown file extension
Here, in dwarfread.c:process_full_comp_unit:
/* Set symtab language to language from DW_AT_language. If the
compilation is from a C file generated by language preprocessors, do
not set the language if it was already deduced by start_subfile. */
if (!(cu->language == language_c
&& COMPUNIT_FILETABS (cust)->language != language_c))
COMPUNIT_FILETABS (cust)->language = cu->language;
in case start_subfile doesn't manage to deduce a language
COMPUNIT_FILETABS(cust)->language ends up as language_unknown, not
language_c. So the condition above evals false and we never set the
language from the cu's language.
gdb/ChangeLog:
2015-08-20 Pedro Alves <palves@redhat.com>
* dwarf2read.c (process_full_comp_unit): To tell whether
start_subfile managed to deduce a language, test for
language_unknown instead of language_c.
gdb/testsuite/ChangeLog:
2015-08-20 Pedro Alves <palves@redhat.com>
* gdb.dwarf2/comp-unit-lang.exp: New file.
* gdb.dwarf2/comp-unit-lang.c: New file.
Diffstat (limited to 'gdb/testsuite/gdb.dwarf2/comp-unit-lang.c')
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/comp-unit-lang.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/comp-unit-lang.c b/gdb/testsuite/gdb.dwarf2/comp-unit-lang.c new file mode 100644 index 0000000..2835209 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/comp-unit-lang.c @@ -0,0 +1,34 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2011-2015 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +asm (".section \".text\""); +asm (".balign 8"); +asm ("func_start: .globl func_start"); + +static void +func (void) +{ +} + +asm ("func_end: .globl func_end"); + +int +main (void) +{ + func (); + return 0; +} |