[PATCH 5/5] [gdb/symtab] Fix data race on per_cu->lang
Tom Tromey
tom@tromey.com
Mon Jul 4 18:30:17 GMT 2022
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Both writes are called from the parallel for in dwarf2_build_psymtabs_hard,
Tom> this one directly:
Tom> ...
Tom> #1 process_psymtab_comp_unit gdb/dwarf2/read.c:6812 (gdb+0x830912)
Tom> #2 operator() gdb/dwarf2/read.c:7102 (gdb+0x831902)
Tom> #3 operator() gdb/../gdbsupport/parallel-for.h:171 (gdb+0x8723a8)
Tom> ...
Tom> and this one when handling cross-CU refs:
Tom> ...
Tom> #1 cooked_indexer::ensure_cu_exists(cutu_reader*, dwarf2_per_objfile*, \
Tom> sect_offset, bool, bool) gdb/dwarf2/read.c:17973 (gdb+0x85c522)
This method tries to ensure that a CU isn't processed twice, using the
'scanned' field. Do you know why this isn't working?
Tom> Fix this by guarding the write with a lock.
I would rather we avoid locks. Ideally the existing exclusion mechanism
should be made to work, but if that fails, perhaps we can use another
atomic.
Tom
More information about the Gdb-patches
mailing list