static void
handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
- const file_and_directory &fnd,
- CORE_ADDR lowpc) /* ARI: editCase function */
+ const file_and_directory &fnd, CORE_ADDR lowpc,
+ bool have_code) /* ARI: editCase function */
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct attribute *attr;
gdb_assert (die->tag != DW_TAG_partial_unit);
}
decode_mapping = (die->tag != DW_TAG_partial_unit);
- dwarf_decode_lines (cu->line_header, cu, lowpc, decode_mapping);
+ /* The have_code check is here because, if LOWPC and HIGHPC are both 0x0,
+ then there won't be any interesting code in the CU, but a check later on
+ (in lnp_state_machine::check_line_address) will fail to properly exclude
+ an entry that was removed via --gc-sections. */
+ if (have_code)
+ dwarf_decode_lines (cu->line_header, cu, lowpc, decode_mapping);
}
/* Process DW_TAG_compile_unit or DW_TAG_partial_unit. */
/* Decode line number information if present. We do this before
processing child DIEs, so that the line header table is available
- for DW_AT_decl_file. The PC check is here because, if LOWPC and
- HIGHPC are both 0x0, then there won't be any interesting code in
- the CU, but a check later on (in
- lnp_state_machine::check_line_address) will fail to properly
- exclude an entry that was removed via --gc-sections. */
- if (lowpc != highpc)
- handle_DW_AT_stmt_list (die, cu, fnd, lowpc);
+ for DW_AT_decl_file. */
+ handle_DW_AT_stmt_list (die, cu, fnd, lowpc, lowpc != highpc);
/* Process all dies in compilation unit. */
if (die->child != NULL)
--- /dev/null
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2022 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/>. */
+
+int var;
--- /dev/null
+# Copyright 2022 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/>.
+
+standard_testfile .c main.c
+
+if [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2"] {
+ return -1
+}
+
+set cmd "p var"
+
+set re \
+ [multi_line \
+ "$cmd" \
+ "\\\$1 = 0"]
+
+with_complaints 5 {
+ gdb_test $cmd $re "$cmd with no complaints"
+}