Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gdb/symtab] Fix data race on objfile->template_symbols
Data race between: ... Read of size 8 at 0x7b4000006dd8 by thread T4: #0 new_symbol gdb/dwarf2/read.c:21085 (gdb+0x868212) #1 handle_struct_member_die gdb/dwarf2/read.c:14828 (gdb+0x851be8) #2 process_structure_scope gdb/dwarf2/read.c:14865 (gdb+0x851e70) #3 process_die gdb/dwarf2/read.c:8649 (gdb+0x83a048) #4 read_namespace gdb/dwarf2/read.c:16026 (gdb+0x857a32) #5 process_die gdb/dwarf2/read.c:8689 (gdb+0x83a100) #6 read_file_scope gdb/dwarf2/read.c:9616 (gdb+0x83cb81) #7 process_die gdb/dwarf2/read.c:8620 (gdb+0x839f43) #8 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839509) #9 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5) ... and: ... Previous write of size 8 at 0x7b4000006dd8 by main thread: #0 new_symbol gdb/dwarf2/read.c:21086 (gdb+0x868247) #1 handle_struct_member_die gdb/dwarf2/read.c:14828 (gdb+0x851be8) #2 process_structure_scope gdb/dwarf2/read.c:14865 (gdb+0x851e70) #3 process_die gdb/dwarf2/read.c:8649 (gdb+0x83a048) #4 read_namespace gdb/dwarf2/read.c:16026 (gdb+0x857a32) #5 process_die gdb/dwarf2/read.c:8689 (gdb+0x83a100) #6 read_file_scope gdb/dwarf2/read.c:9616 (gdb+0x83cb81) #7 process_die gdb/dwarf2/read.c:8620 (gdb+0x839f43) #8 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839509) #9 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5) ... Fix this by adding a lock in new_symbol for adding to objfile->template_symbols.
- Loading branch information