public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed
@ 2025-02-25 9:59 vries at gcc dot gnu.org
2025-02-26 12:17 ` [Bug symtab/32742] " vries at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2025-02-25 9:59 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32742
Bug ID: 32742
Summary: [gdb/symtab, fission] read.c:20914: internal-error:
set_lang: Assertion `old_value == language_unknown ||
old_value == language_minimal || old_value == lang'
failed
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: symtab
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
When running the test suite with target board fission, in test-case
gdb.ada/access_tagged_param.exp I run into:
...
(gdb) break pck.adb:19^M
/data/vries/gdb/src/gdb/dwarf2/read.c:20914: internal-error: set_lang:
Assertion `old_value == language_unknown || old_value == language_minimal ||
old_value == lang' failed.^M
...
Backtrace:
...
(gdb) bt
#0 0x00007ffff5ea941c in __pthread_kill_implementation ()
from /lib64/libc.so.6
#1 0x00007ffff5e57842 in raise () from /lib64/libc.so.6
#2 0x00007ffff5e3f5cf in abort () from /lib64/libc.so.6
#3 0x0000000000d9462c in dump_core () at /data/vries/gdb/src/gdb/utils.c:225
#4 0x0000000000d94c6d in internal_vproblem(internal_problem *, const char *,
int, const char *, typedef __va_list_tag __va_list_tag *) (
problem=0x2825160 <internal_error_problem>,
file=0x164fd30 "/data/vries/gdb/src/gdb/dwarf2/read.c", line=20914,
fmt=0x164ef8f "%s: Assertion `%s' failed.", ap=0x7fffffffbd68)
at /data/vries/gdb/src/gdb/utils.c:477
#5 0x0000000000d94d43 in internal_verror (
file=0x164fd30 "/data/vries/gdb/src/gdb/dwarf2/read.c", line=20914,
fmt=0x164ef8f "%s: Assertion `%s' failed.", ap=0x7fffffffbd68)
at /data/vries/gdb/src/gdb/utils.c:503
#6 0x0000000001573595 in internal_error_loc (
file=0x164fd30 "/data/vries/gdb/src/gdb/dwarf2/read.c", line=20914,
fmt=0x164ef8f "%s: Assertion `%s' failed.")
at /data/vries/gdb/src/gdbsupport/errors.cc:57
#7 0x0000000000791c56 in dwarf2_per_cu_data::set_lang (this=0x7fffd4004820,
lang=language_minimal, dw_lang=0)
at /data/vries/gdb/src/gdb/dwarf2/read.c:20912
#8 0x00000000007928ab in cutu_reader::prepare_one_comp_unit (
this=0x7fffffffbf70, cu=0x2e91e20, pretend_language=language_minimal)
at /data/vries/gdb/src/gdb/dwarf2/read.c:21139
#9 0x0000000000766057 in cutu_reader::cutu_reader (this=0x7fffffffbf70,
this_cu=0x7fffd4004820, per_objfile=0x2ed6df0,
pretend_language=language_minimal, parent_cu=0x0, dwo_file=0x0)
at /data/vries/gdb/src/gdb/dwarf2/read.c:3533
#10 0x0000000000761b1d in dw2_get_file_names (this_cu=0x7fffd4004820,
per_objfile=0x2ed6df0) at /data/vries/gdb/src/gdb/dwarf2/read.c:1971
#11 0x0000000000762445 in
dw_expand_symtabs_matching_file_matcher(dwarf2_per_objfile*,
gdb::function_view<bool (char const*, bool)>) (per_objfile=0x2ed6df0,
file_matcher=...) at /data/vries/gdb/src/gdb/dwarf2/read.c:2174
#12 0x000000000078673e in
cooked_index_functions::expand_symtabs_matching(objfile*,
gdb::function_view<bool (char const*, bool)>, lookup_name_info const*,
gdb::function_view<bool (char const*)>, gdb::function_view<bool
(compunit_symtab*)>, enum_flags<block_search_flag_values>,
enum_flags<domain_search_flag>, gdb::function_view<bool (language)>)
(this=0x2f18f90, objfile=0x2f11d30,
file_matcher=..., lookup_name=0x0, symbol_matcher=...,
expansion_notify=..., search_flags=..., domain=..., lang_matcher=...)
at /data/vries/gdb/src/gdb/dwarf2/read.c:16015
#13 0x0000000000c67c13 in objfile::map_symtabs_matching_filename(char const*,
char const*, gdb::function_view<bool (symtab*)>) (this=0x2f11d30,
name=0x38eff20 "pck.adb", real_path=0x0, callback=...)
at /data/vries/gdb/src/gdb/symfile-debug.c:207
#14 0x0000000000c84ac0 in iterate_over_symtabs(program_space*, char const*,
gdb::function_view<bool (symtab*)>) (pspace=0x2b99240, name=0x38eff20
"pck.adb",
callback=...) at /data/vries/gdb/src/gdb/symtab.c:727
#15 0x00000000009116c7 in collect_symtabs_from_filename (
file=0x38eff20 "pck.adb", search_pspace=0x0)
at /data/vries/gdb/src/gdb/linespec.c:3640
#16 0x00000000009117a4 in symtabs_from_filename (
filename=0x38eff20 "pck.adb", search_pspace=0x0)
at /data/vries/gdb/src/gdb/linespec.c:3657
#17 0x000000000090e801 in parse_linespec (parser=0x7fffffffcac0,
arg=0x2e16910 "pck.adb:19", match_type=symbol_name_match_type::WILD)
at /data/vries/gdb/src/gdb/linespec.c:2559
#18 0x000000000090fb1b in location_spec_to_sals (parser=0x7fffffffcac0,
locspec=0x3a2a7a0) at /data/vries/gdb/src/gdb/linespec.c:3037
#19 0x000000000090feda in decode_line_full (locspec=0x3a2a7a0, flags=1,
search_pspace=0x0, default_symtab=0x2f13810, default_line=17,
canonical=0x7fffffffcf50, select_mode=0x0, filter=0x0)
at /data/vries/gdb/src/gdb/linespec.c:3113
#20 0x00000000005891ae in parse_breakpoint_sals (locspec=0x3a2a7a0,
canonical=0x7fffffffcf50, search_pspace=0x0)
at /data/vries/gdb/src/gdb/breakpoint.c:9077
#21 0x0000000000589c36 in create_breakpoint (gdbarch=0x38cd3e0,
locspec=0x3a2a7a0, cond_string=0x0, thread=-1, inferior=-1,
extra_string=0x0, force_condition=false, parse_extra=1, tempflag=0,
type_wanted=bp_breakpoint, ignore_count=0,
pending_break_support=AUTO_BOOLEAN_AUTO,
ops=0x15f5540 <code_breakpoint_ops>, from_tty=0, enabled=1, internal=0,
flags=0) at /data/vries/gdb/src/gdb/breakpoint.c:9312
#22 0x000000000058a648 in break_command_1 (arg=0x3a27b50 "", flag=0,
from_tty=0) at /data/vries/gdb/src/gdb/breakpoint.c:9471
#23 0x000000000058a8c9 in break_command (arg=0x3a27b46 "pck.adb:19",
from_tty=0) at /data/vries/gdb/src/gdb/breakpoint.c:9541
#24 0x0000000000614cff in do_simple_func (args=0x3a27b46 "pck.adb:19",
from_tty=0, c=0x2cdd470) at /data/vries/gdb/src/gdb/cli/cli-decode.c:95
#25 0x000000000061a2a2 in cmd_func (cmd=0x2cdd470,
args=0x3a27b46 "pck.adb:19", from_tty=0)
at /data/vries/gdb/src/gdb/cli/cli-decode.c:2839
#26 0x0000000000cef370 in execute_command (p=0x3a27b4f "9", from_tty=0)
at /data/vries/gdb/src/gdb/top.c:564
#27 0x00000000007e34dc in command_handler (
command=0x3a27b40 "break pck.adb:19")
at /data/vries/gdb/src/gdb/event-top.c:613
#28 0x0000000000ceea86 in read_command_file (stream=0x2b4fdc0)
at /data/vries/gdb/src/gdb/top.c:333
#29 0x0000000000629729 in script_from_file (stream=0x2b4fdc0,
file=0x7fffffffe1e7 "outputs/gdb.ada/access_tagged_param/gdb.in.1")
at /data/vries/gdb/src/gdb/cli/cli-script.c:1643
#30 0x000000000060abbd in source_script_from_stream (stream=0x2b4fdc0,
file=0x7fffffffe1e7 "outputs/gdb.ada/access_tagged_param/gdb.in.1",
file_to_open=0x2b7a6e0 "outputs/gdb.ada/access_tagged_param/gdb.in.1")
at /data/vries/gdb/src/gdb/cli/cli-cmds.c:705
#31 0x000000000060ad17 in source_script_with_search (
file=0x7fffffffe1e7 "outputs/gdb.ada/access_tagged_param/gdb.in.1",
from_tty=0, search_path=0) at /data/vries/gdb/src/gdb/cli/cli-cmds.c:750
#32 0x000000000060ad93 in source_script (
file=0x7fffffffe1e7 "outputs/gdb.ada/access_tagged_param/gdb.in.1",
from_tty=0) at /data/vries/gdb/src/gdb/cli/cli-cmds.c:759
#33 0x0000000000985fcb in catch_command_errors (
command=0x60ad6e <source_script(char const*, int)>,
arg=0x7fffffffe1e7 "outputs/gdb.ada/access_tagged_param/gdb.in.1",
from_tty=0, do_bp_actions=false) at /data/vries/gdb/src/gdb/main.c:508
#34 0x000000000098619a in execute_cmdargs (cmdarg_vec=0x7fffffffd8c0,
file_type=CMDARG_FILE, cmd_type=CMDARG_COMMAND, ret=0x7fffffffd89c)
at /data/vries/gdb/src/gdb/main.c:604
#35 0x0000000000987611 in captured_main_1 (context=0x7fffffffdb80)
at /data/vries/gdb/src/gdb/main.c:1308
#36 0x0000000000987876 in captured_main (data=0x7fffffffdb80)
at /data/vries/gdb/src/gdb/main.c:1333
#37 0x0000000000987915 in gdb_main (args=0x7fffffffdb80)
at /data/vries/gdb/src/gdb/main.c:1362
#38 0x000000000041a403 in main (argc=7, argv=0x7fffffffdcb8)
at /data/vries/gdb/src/gdb/gdb.c:38
(gdb)
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/32742] [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed
2025-02-25 9:59 [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed vries at gcc dot gnu.org
@ 2025-02-26 12:17 ` vries at gcc dot gnu.org
2025-02-26 12:29 ` vries at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2025-02-26 12:17 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32742
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
What is happening, is that the language used to be ada, but is set to minimal:
...
(gdb) p old_value
$1 = {m_val = language_ada}
(gdb) p lang
$2 = language_minimal
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/32742] [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed
2025-02-25 9:59 [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed vries at gcc dot gnu.org
2025-02-26 12:17 ` [Bug symtab/32742] " vries at gcc dot gnu.org
@ 2025-02-26 12:29 ` vries at gcc dot gnu.org
2025-02-26 12:56 ` vries at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2025-02-26 12:29 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32742
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Starting commit 0aa72b65f78 ("Clean up calls to prepare_one_comp_unit"), before
that we run into another internal error (PR32309).
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/32742] [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed
2025-02-25 9:59 [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed vries at gcc dot gnu.org
2025-02-26 12:17 ` [Bug symtab/32742] " vries at gcc dot gnu.org
2025-02-26 12:29 ` vries at gcc dot gnu.org
@ 2025-02-26 12:56 ` vries at gcc dot gnu.org
2025-02-27 18:12 ` tromey at sourceware dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2025-02-26 12:56 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32742
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index b4fd7e30cb7..fa3a94485d9 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -21023,7 +21023,12 @@ cutu_reader::prepare_one_comp_unit (struct dwarf2_cu
*cu,
attr = dwarf2_attr (comp_unit_die, DW_AT_language, cu);
enum language lang;
dwarf_source_language dw_lang = (dwarf_source_language) 0;
- if (cu->producer_is_xlc_opencl ())
+ if (cu->per_cu->lang (false) != language_unknown)
+ {
+ lang = cu->per_cu->lang ();
+ dw_lang = cu->per_cu->dw_lang ();
+ }
+ else if (cu->producer_is_xlc_opencl ())
{
/* The XLCL doesn't generate DW_LANG_OpenCL because this
attribute is not standardised yet. As a workaround for the
...
With this patch, we're back to PR32309.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/32742] [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed
2025-02-25 9:59 [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed vries at gcc dot gnu.org
` (2 preceding siblings ...)
2025-02-26 12:56 ` vries at gcc dot gnu.org
@ 2025-02-27 18:12 ` tromey at sourceware dot org
2025-03-04 20:03 ` simark at simark dot ca
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: tromey at sourceware dot org @ 2025-02-27 18:12 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32742
--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Tom de Vries from comment #1)
> What is happening, is that the language used to be ada, but is set to
> minimal:
> ...
> (gdb) p old_value
> $1 = {m_val = language_ada}
> (gdb) p lang
> $2 = language_minimal
> ...
That seems pretty wrong, like a downgrade.
> Tentative patch:
It seems weird that the language can be set without
going through this code, because these producer checks
affect the choice of language.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/32742] [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed
2025-02-25 9:59 [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed vries at gcc dot gnu.org
` (3 preceding siblings ...)
2025-02-27 18:12 ` tromey at sourceware dot org
@ 2025-03-04 20:03 ` simark at simark dot ca
2025-03-07 14:54 ` simon.marchi at polymtl dot ca
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: simark at simark dot ca @ 2025-03-04 20:03 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32742
Simon Marchi <simark at simark dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simark at simark dot ca
--- Comment #5 from Simon Marchi <simark at simark dot ca> ---
I'm working with this reproducer precisely:
$ ./gdb -nx -q --data-directory=data-directory -ex 'maint set dwarf sync on'
-ex 'maintenance set per-command time on' -ex 'maintenance set worker-threads
0' -ex 'file testsuite/outputs/gdb.ada/access_tagged_param/foo' -ex "b break
pck.adb:19" -batch
Focusing on the CU at offset 0x0, the first place the Ada language gets set is:
#0 dwarf2_per_cu::set_lang (this=0x50f0000044b0, lang=language_ada,
dw_lang=DW_LANG_Ada95) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:20788
#1 0x0000555561666af6 in cutu_reader::prepare_one_comp_unit
(this=0x7ffff10bf2b0, cu=0x51700008e000, pretend_language=language_minimal) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:21029
#2 0x000055556159f740 in cutu_reader::cutu_reader (this=0x7ffff10bf2b0,
this_cu=0x50f0000044b0, per_objfile=0x516000066080,
abbrev_table=0x510000004640, existing_cu=0x0, skip_partial=false,
pretend_language=language_minimal, cache=0x7ffff11b95e0) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:3371
#3 0x00005555615a547a in process_psymtab_comp_unit (this_cu=0x50f0000044b0,
per_objfile=0x516000066080, storage=0x7ffff11b95e0) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:3799
#4 0x00005555615a9292 in cooked_index_worker_debug_info::process_cus
(this=0x51700008dc80, task_number=0, first=std::unique_ptr<dwarf2_per_cu> =
{...}, end=std::unique_ptr<dwarf2_per_cu> = {...})
at /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:4122
I think this is expected. The cutu_reader identified that the
DW_TAG_compile_unit is a DWO stub, it has read the DWO file and now
cutu_reader::comp_unit_die points to the DIE from the DWO, which has all the
information (the stub DIE in the main file does not have the DW_AT_language
attribute). cutu_reader::prepare_one_comp_unit properly reads the language
from there and sets it.
The second time the language gets set is:
#0 dwarf2_per_cu::set_lang (this=0x50f0000044b0, lang=language_minimal,
dw_lang=0) at /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:20788
#1 0x0000555561666af6 in cutu_reader::prepare_one_comp_unit
(this=0x7ffff0f42730, cu=0x517000091b80, pretend_language=language_minimal) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:21029
#2 0x00005555615a1822 in cutu_reader::cutu_reader (this=0x7ffff0f42730,
this_cu=0x50f0000044b0, per_objfile=0x516000066080,
pretend_language=language_minimal, parent_cu=0x0, dwo_file=0x0)
at /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:3464
#3 0x000055556158c850 in dw2_get_file_names (this_cu=0x50f0000044b0,
per_objfile=0x516000066080) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:1956
#4 0x000055556158f4f5 in dw_expand_symtabs_matching_file_matcher
(per_objfile=0x516000066080, file_matcher=...) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:2157
#5 0x00005555616329e2 in cooked_index_functions::expand_symtabs_matching
(this=0x50200002ab50, objfile=0x516000065780, file_matcher=...,
lookup_name=0x0, symbol_matcher=..., expansion_notify=...,
search_flags=..., domain=..., lang_matcher=...) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:15912
#6 0x0000555562ca8a14 in objfile::map_symtabs_matching_filename
(this=0x516000065780, name=0x50200002ad90 "break pck.adb", real_path=0x0,
callback=...) at /home/smarchi/src/binutils-gdb/gdb/symfile-debug.c:207
#7 0x0000555562d68775 in iterate_over_symtabs (pspace=0x513000005600,
name=0x50200002ad90 "break pck.adb", callback=...) at
/home/smarchi/src/binutils-gdb/gdb/symtab.c:727
In dw2_get_file_names, we create a temporary cutu_reader using the other
constructor, the one that says:
/* Read CU/TU THIS_CU but do not follow DW_AT_GNU_dwo_name (DW_AT_dwo_name)
if present. DWO_FILE, if non-NULL, is the DWO file to read (the caller is
assumed to have already done the lookup to find the DWO file).
That cutu_reader constructor also ends with a call to prepare_one_comp_unit,
which sets the language. But here, since we operate without considering the
DWO we didn't identify the language properly, so we try to set it to
language_minimal.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/32742] [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed
2025-02-25 9:59 [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed vries at gcc dot gnu.org
` (4 preceding siblings ...)
2025-03-04 20:03 ` simark at simark dot ca
@ 2025-03-07 14:54 ` simon.marchi at polymtl dot ca
2025-03-08 2:55 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: simon.marchi at polymtl dot ca @ 2025-03-07 14:54 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32742
Simon Marchi <simon.marchi at polymtl dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simon.marchi at polymtl dot ca
--- Comment #6 from Simon Marchi <simon.marchi at polymtl dot ca> ---
I sent a patch for this:
https://inbox.sourceware.org/gdb-patches/20250307145345.841329-1-simon.marchi@polymtl.ca/T/#u
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/32742] [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed
2025-02-25 9:59 [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed vries at gcc dot gnu.org
` (5 preceding siblings ...)
2025-03-07 14:54 ` simon.marchi at polymtl dot ca
@ 2025-03-08 2:55 ` cvs-commit at gcc dot gnu.org
2025-03-08 2:56 ` simon.marchi at polymtl dot ca
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2025-03-08 2:55 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32742
--- Comment #7 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Simon Marchi <simark@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=86a53c0b2ead2d0da2a6bf91741c705df6b97f76
commit 86a53c0b2ead2d0da2a6bf91741c705df6b97f76
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date: Fri Mar 7 09:53:40 2025 -0500
gdb/dwarf: call other cutu_reader constructor in ensure_lang and
dw2_get_file_names
PR 32742 shows this failing:
$ make check TESTS="gdb.ada/access_to_unbounded_array.exp"
RUNTESTFLAGS="--target_board=fission"
Running
/home/simark/src/binutils-gdb/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp
...
FAIL: gdb.ada/access_to_unbounded_array.exp: scenario=all:
gdb_breakpoint: set breakpoint at foo.adb:23 (GDB internal error)
Or, interactively:
$ ./gdb -q -nx --data-directory=data-directory
testsuite/outputs/gdb.ada/access_to_unbounded_array/foo-all -ex 'b foo.adb:23'
-batch
/home/simark/src/binutils-gdb/gdb/dwarf2/read.c:19567: internal-error:
set_lang: Assertion `old_value == language_unknown || old_value ==
language_minimal || old_value == lang' failed.
The symptom is that for a given dwarf2_per_cu, the language gets set
twice. First, set to `language_ada`, and then, to `language_minimal`.
It's unexpected for the language of a CU to get changed like this.
The CU at offset 0x0 in the main file looks like:
0x00000000: Compile Unit: length = 0x00000030, format = DWARF32,
version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at
0x00000034)
0x0000000b: DW_TAG_compile_unit
DW_AT_low_pc [DW_FORM_addr] (0x000000000000339a)
DW_AT_high_pc [DW_FORM_data8] (0x0000000000000432)
DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
DW_AT_GNU_dwo_name [DW_FORM_strp] ("b~foo.dwo")
DW_AT_comp_dir [DW_FORM_strp]
("/home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.ada/access_to_unbounded_array")
DW_AT_GNU_pubnames [DW_FORM_flag_present] (true)
DW_AT_GNU_addr_base [DW_FORM_sec_offset] (0x00000000)
DW_AT_GNU_dwo_id [DW_FORM_data8] (0x277aee54e7bd47f7)
This refers to the DWO file b~foo.dwo, whose top-level DIE is:
.debug_info.dwo contents:
0x00000000: Compile Unit: length = 0x00000b63, format = DWARF32,
version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at
0x00000b67)
0x0000000b: DW_TAG_compile_unit
DW_AT_producer [DW_FORM_GNU_str_index] ("GNU Ada
14.2.1 20250207 -fgnat-encodings=minimal -gdwarf-4 -fdebug-types-section
-fuse-ld=gold -gnatA -gnatWb -gnatiw -gdwarf-4 -gsplit-dwarf -ggnu-pubnames
-gnatws -mtune=generic -march=x86-64")
DW_AT_language [DW_FORM_data1] (DW_LANG_Ada95)
DW_AT_name [DW_FORM_GNU_str_index]
("/home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.ada/access_to_unbounded_array/b~foo.adb")
DW_AT_comp_dir [DW_FORM_GNU_str_index]
("/home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.ada/access_to_unbounded_array")
DW_AT_GNU_dwo_id [DW_FORM_data8] (0xdbeffefab180a2cb)
The thing to note is that the language attribute is only present in the
DIE in the DWO file, not on the DIE in the main file.
The first time the language gets set is here:
#0 dwarf2_per_cu::set_lang (this=0x50f0000044b0, lang=language_ada,
dw_lang=DW_LANG_Ada95) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:20788
#1 0x0000555561666af6 in cutu_reader::prepare_one_comp_unit
(this=0x7ffff10bf2b0, cu=0x51700008e000, pretend_language=language_minimal) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:21029
#2 0x000055556159f740 in cutu_reader::cutu_reader
(this=0x7ffff10bf2b0, this_cu=0x50f0000044b0, per_objfile=0x516000066080,
abbrev_table=0x510000004640, existing_cu=0x0, skip_partial=false,
pretend_language=language_minimal, cache=0x7ffff11b95e0) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:3371
#3 0x00005555615a547a in process_psymtab_comp_unit
(this_cu=0x50f0000044b0, per_objfile=0x516000066080, storage=0x7ffff11b95e0) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:3799
#4 0x00005555615a9292 in cooked_index_worker_debug_info::process_cus
(this=0x51700008dc80, task_number=0, first=std::unique_ptr<dwarf2_per_cu> =
{...}, end=std::unique_ptr<dwarf2_per_cu> = {...}) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:4122
In this code path (particularly this specific cutu_reader constructir),
the work is done to find and read the DWO file. So the language is
properly identifier as language_ada, all good so far.
The second time the language gets set is:
#0 dwarf2_per_cu::set_lang (this=0x50f0000044b0,
lang=language_minimal, dw_lang=0) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:20788
#1 0x0000555561666af6 in cutu_reader::prepare_one_comp_unit
(this=0x7ffff0f42730, cu=0x517000091b80, pretend_language=language_minimal) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:21029
#2 0x00005555615a1822 in cutu_reader::cutu_reader
(this=0x7ffff0f42730, this_cu=0x50f0000044b0, per_objfile=0x516000066080,
pretend_language=language_minimal, parent_cu=0x0, dwo_file=0x0) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:3464
#3 0x000055556158c850 in dw2_get_file_names (this_cu=0x50f0000044b0,
per_objfile=0x516000066080) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:1956
#4 0x000055556158f4f5 in dw_expand_symtabs_matching_file_matcher
(per_objfile=0x516000066080, file_matcher=...) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:2157
#5 0x00005555616329e2 in
cooked_index_functions::expand_symtabs_matching (this=0x50200002ab50,
objfile=0x516000065780, file_matcher=..., lookup_name=0x0, symbol_matcher=...,
expansion_notify=..., search_flags=..., domain=..., lang_matcher=...) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:15912
#6 0x0000555562ca8a14 in objfile::map_symtabs_matching_filename
(this=0x516000065780, name=0x50200002ad90 "break pck.adb", real_path=0x0,
callback=...) at /home/smarchi/src/binutils-gdb/gdb/symfile-debug.c:207
#7 0x0000555562d68775 in iterate_over_symtabs (pspace=0x513000005600,
name=0x50200002ad90 "break pck.adb", callback=...) at
/home/smarchi/src/binutils-gdb/gdb/symtab.c:727
Here, we use the other cutu_reader constructor, the one that does not
look up the DWO file for the passed CU. If a DWO file exists for this
CU, the caller is expected to pass it as a parameter. That cutu_reader
constructor also ends up setting the language of the CU. But because it
didn't read the DWO file, it didn't figure out the language is
language_ada, so it tries to set the language to the default,
language_minimal.
A question is: why do we end up trying to set the CU's language is this
context. This is completely unrelated to what we're trying to do, that
is get the file names from the line table. Setting the language is a
side-effect of just constructing a cutu_reader, which we need to look up
attributes in dw2_get_file_names_reader. There are probably some
cleanups to be done here, to avoid doing useless work like looking up
and setting the CU's language when all we need is an object to help
reading the DIEs and attributes. But that is future work.
The same cutu_reader constructor is used in
`dwarf2_per_cu::ensure_lang`. Since this is the version of cutu_reader
that does not look up the DWO file, it will conclude that the language
is language_minimal and set that as the CU's language. In other words,
`dwarf2_per_cu::ensure_lang` will get the language wrong, pretty ironic.
Fix this by using the other cutu_reader constructor in those two spots.
Pass `per_objfile->get_cu (this_cu)`, as the `existing_cu` parameter. I
think this is necessary, because that constructor has an assert to check
that if `existing_cu` is nullptr, then there must not be an existing
`dwarf2_cu` in the per_objfile.
To avoid getting things wrong like this, I think that the second
cutu_reader constructor should be reserved for the spots that do pass a
non-nullptr dwo_file. The only spot at the moment in
create_cus_hash_table, where we read multiple units from the same DWO
file. In this context, I guess it makes sense for efficiency to get the
dwo_file once and pass it down to cutu_reader. For that constructor,
make the parameters non-optional, add "non-nullptr" asserts, and update
the code to assume the passed values are not nullptr.
What I don't know is if this change is problematic thread-wise, if the
functions I have modified to use the other cutu_reader constructor can
be called concurrently in worker threads. If so, I think it would be
problematic.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32742
Change-Id: I980d16875b9a43ab90e251504714d0d41165c7c8
Approved-By: Tom Tromey <tom@tromey.com>
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/32742] [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed
2025-02-25 9:59 [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed vries at gcc dot gnu.org
` (6 preceding siblings ...)
2025-03-08 2:55 ` cvs-commit at gcc dot gnu.org
@ 2025-03-08 2:56 ` simon.marchi at polymtl dot ca
2025-03-09 17:21 ` simon.marchi at polymtl dot ca
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: simon.marchi at polymtl dot ca @ 2025-03-08 2:56 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32742
Simon Marchi <simon.marchi at polymtl dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #8 from Simon Marchi <simon.marchi at polymtl dot ca> ---
Should be fixed now.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/32742] [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed
2025-02-25 9:59 [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed vries at gcc dot gnu.org
` (7 preceding siblings ...)
2025-03-08 2:56 ` simon.marchi at polymtl dot ca
@ 2025-03-09 17:21 ` simon.marchi at polymtl dot ca
2025-03-09 17:21 ` simon.marchi at polymtl dot ca
2025-03-11 13:35 ` tromey at sourceware dot org
10 siblings, 0 replies; 12+ messages in thread
From: simon.marchi at polymtl dot ca @ 2025-03-09 17:21 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32742
Simon Marchi <simon.marchi at polymtl dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |16.3
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/32742] [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed
2025-02-25 9:59 [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed vries at gcc dot gnu.org
` (8 preceding siblings ...)
2025-03-09 17:21 ` simon.marchi at polymtl dot ca
@ 2025-03-09 17:21 ` simon.marchi at polymtl dot ca
2025-03-11 13:35 ` tromey at sourceware dot org
10 siblings, 0 replies; 12+ messages in thread
From: simon.marchi at polymtl dot ca @ 2025-03-09 17:21 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32742
Simon Marchi <simon.marchi at polymtl dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|16.3 |---
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/32742] [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed
2025-02-25 9:59 [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed vries at gcc dot gnu.org
` (9 preceding siblings ...)
2025-03-09 17:21 ` simon.marchi at polymtl dot ca
@ 2025-03-11 13:35 ` tromey at sourceware dot org
10 siblings, 0 replies; 12+ messages in thread
From: tromey at sourceware dot org @ 2025-03-11 13:35 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32742
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |17.1
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-03-11 13:35 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-25 9:59 [Bug symtab/32742] New: [gdb/symtab, fission] read.c:20914: internal-error: set_lang: Assertion `old_value == language_unknown || old_value == language_minimal || old_value == lang' failed vries at gcc dot gnu.org
2025-02-26 12:17 ` [Bug symtab/32742] " vries at gcc dot gnu.org
2025-02-26 12:29 ` vries at gcc dot gnu.org
2025-02-26 12:56 ` vries at gcc dot gnu.org
2025-02-27 18:12 ` tromey at sourceware dot org
2025-03-04 20:03 ` simark at simark dot ca
2025-03-07 14:54 ` simon.marchi at polymtl dot ca
2025-03-08 2:55 ` cvs-commit at gcc dot gnu.org
2025-03-08 2:56 ` simon.marchi at polymtl dot ca
2025-03-09 17:21 ` simon.marchi at polymtl dot ca
2025-03-09 17:21 ` simon.marchi at polymtl dot ca
2025-03-11 13:35 ` tromey at sourceware dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).