binutils-gdb/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.c
Tom Tromey 05caa1d236 Handle DW_AT_ranges when reading partial symtabs
add_partial_subprogram does not handle DW_AT_ranges, while the full
symtab reader does.  This can lead to discrepancies where a function
is not put into a partial symtab, and so is not available to "break"
and the like -- but is available if the full symtab has somehow been
read.

This patch fixes the bug by arranging to read DW_AT_ranges when
reading partial DIEs.

This is PR symtab/23331.

The new test case is derived from dw2-ranges-func.exp, which is why I
kept the copyright dates.

gdb/ChangeLog
2019-04-01  Tom Tromey  <tromey@adacore.com>

	PR symtab/23331:
	* dwarf2read.c (partial_die_info::read): Handle DW_AT_ranges.

gdb/testsuite/ChangeLog
2019-04-01  Tom Tromey  <tromey@adacore.com>

	PR symtab/23331:
	* gdb.dwarf2/dw2-ranges-main.c: New file.
	* gdb.dwarf2/dw2-ranges-psym.c: New file.
	* gdb.dwarf2/dw2-ranges-psym.exp: New file.
2019-04-01 10:36:58 -06:00

47 lines
1.3 KiB
C

/* Copyright 2018-2019 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/>. */
volatile int e = 0;
void
baz (void)
{
asm ("baz_label: .globl baz_label");
} /* baz end */
void
foo_low (void)
{ /* foo_low prologue */
asm ("foo_low_label: .globl foo_low_label");
baz (); /* foo_low baz call */
asm ("foo_low_label2: .globl foo_low_label2");
} /* foo_low end */
void
bar (void)
{
asm ("bar_label: .globl bar_label");
} /* bar end */
void
foo (void)
{ /* foo prologue */
asm ("foo_label: .globl foo_label");
bar (); /* foo bar call */
asm ("foo_label2: .globl foo_label2");
if (e) foo_low (); /* foo foo_low call */
asm ("foo_label3: .globl foo_label3");
} /* foo end */