Compare commits

...

21 Commits

Author SHA1 Message Date
Tom de Vries
e76289d2b3 [gdb/symtab] Use task size in parallel for in process_queue 2022-07-21 15:06:40 +02:00
Tom de Vries
3240a7e734 [gdb/symtab] Fix data race in lookup_die_type
Data race between:
...
  Write of size 8 at 0x7b8009b483f8 by main thread:
    #0 read_tag_pointer_type gdb/dwarf2/read.c:16171 (gdb+0x8580b3)
    #1 read_type_die_1 gdb/dwarf2/read.c:21508 (gdb+0x869b69)
    #2 read_type_die gdb/dwarf2/read.c:21474 (gdb+0x869a53)
    #3 lookup_die_type gdb/dwarf2/read.c:21446 (gdb+0x8699ad)
    #4 die_type gdb/dwarf2/read.c:21300 (gdb+0x869286)
    #5 dwarf2_add_field gdb/dwarf2/read.c:13535 (gdb+0x84aabd)
    #6 handle_struct_member_die gdb/dwarf2/read.c:14803 (gdb+0x851ad2)
    #7 process_structure_scope gdb/dwarf2/read.c:14865 (gdb+0x851e70)
    #8 process_die gdb/dwarf2/read.c:8649 (gdb+0x83a048)
    #9 read_file_scope gdb/dwarf2/read.c:9616 (gdb+0x83cb81)
    #10 process_die gdb/dwarf2/read.c:8620 (gdb+0x839f43)
    #11 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839509)
    #12 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
and:
...
  Previous read of size 8 at 0x7b8009b483f8 by thread T3:
    #0 dwarf2_cu::addr_type() const gdb/dwarf2/cu.c:99 (gdb+0x7b8d42)
    #1 set_die_type gdb/dwarf2/read.c:23850 (gdb+0x871e4e)
    #2 read_subroutine_type gdb/dwarf2/read.c:16539 (gdb+0x8591c8)
    #3 read_type_die_1 gdb/dwarf2/read.c:21499 (gdb+0x869b15)
    #4 read_type_die gdb/dwarf2/read.c:21474 (gdb+0x869a53)
    #5 lookup_die_type gdb/dwarf2/read.c:21446 (gdb+0x8699ad)
    #6 die_type gdb/dwarf2/read.c:21300 (gdb+0x869286)
    #7 read_tag_pointer_type gdb/dwarf2/read.c:16114 (gdb+0x857d91)
    #8 read_type_die_1 gdb/dwarf2/read.c:21508 (gdb+0x869b69)
    #9 read_type_die gdb/dwarf2/read.c:21474 (gdb+0x869a53)
    #10 lookup_die_type gdb/dwarf2/read.c:21446 (gdb+0x8699ad)
    #11 die_type gdb/dwarf2/read.c:21300 (gdb+0x869286)
    #12 new_symbol gdb/dwarf2/read.c:20742 (gdb+0x8671fe)
    #13 read_variable gdb/dwarf2/read.c:12623 (gdb+0x848823)
    #14 process_die gdb/dwarf2/read.c:8716 (gdb+0x83a28c)
    #15 read_file_scope gdb/dwarf2/read.c:9616 (gdb+0x83cb81)
    #16 process_die gdb/dwarf2/read.c:8620 (gdb+0x839f43)
    #17 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839509)
    #18 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...

Fix this by adding a lock in lookup_die_type.

Also in read_type_die and set_die_type.

Hmm, we already use another lock in set_die_type.  This needs more work.
2022-07-21 15:06:40 +02:00
Tom de Vries
333d407393 [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.
2022-07-21 15:06:40 +02:00
Tom de Vries
4f005db8e0 [gdb/symtab] Fix data race in add_compunit_symtab_to_objfile
Data race bewteen:
...
  Read of size 8 at 0x7b4000006d20 by thread T3:
    #0 add_compunit_symtab_to_objfile(compunit_symtab*) gdb/symfile.c:2852
    (gdb+0xe89cff)
    #1 buildsym_compunit::end_compunit_symtab_with_blockvector(block*, int,
    int) gdb/buildsym.c:1018 (gdb+0x63e857)
    #2 buildsym_compunit::end_compunit_symtab_from_static_block(block*, int,
    int) gdb/buildsym.c:1052 (gdb+0x63e8cd)
    #3 process_full_comp_unit gdb/dwarf2/read.c:8414 (gdb+0x8396b6)
    #4 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
and:
...
  Previous write of size 8 at 0x7b4000006d20 by thread T4:
    #0 add_compunit_symtab_to_objfile(compunit_symtab*) gdb/symfile.c:2853
    (gdb+0xe89d35)
    #1 buildsym_compunit::end_compunit_symtab_with_blockvector(block*, int,
    int) gdb/buildsym.c:1018 (gdb+0x63e857)
    #2 buildsym_compunit::end_compunit_symtab_from_static_block(block*, int,
    int) gdb/buildsym.c:1052 (gdb+0x63e8cd)
    #3 process_full_comp_unit gdb/dwarf2/read.c:8414 (gdb+0x8396b6)
    #4 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...

Fix this by adding a lock in add_compunit_symtab_to_objfile.
2022-07-21 15:06:40 +02:00
Tom de Vries
b4303a08c2 [gdb] Fix data race in cleanup_undefined_stabs_types
Data race for:
...
  Read of size 4 at 0x00000324db04 by thread T1:
    #0 cleanup_undefined_types_1 /home/vries/gdb_versions/devel/src/gdb/stabsread.c:4437 (gdb+0xe60bdd)
    #1 cleanup_undefined_stabs_types(objfile*) /home/vries/gdb_versions/devel/src/gdb/stabsread.c:4500 (gdb+0xe60c48)
    #2 buildsym_compunit::end_compunit_symtab_get_static_block(unsigned long, int, int) /home/vries/gdb_versions/devel/src/gdb/buildsym.c:837 (gdb+0x63dbba)
    #3 process_full_comp_unit /home/vries/gdb_versions/devel/src/gdb/dwarf2/read.c:8404 (gdb+0x8395f4)
    #4 process_queue_item /home/vries/gdb_versions/devel/src/gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
and location:
...
  Location is global 'undef_types_length' of size 4 at 0x00000324db04
...

Likewise for:
...
WARNING: ThreadSanitizer: data race (pid=12737)
  Read of size 4 at 0x00000324db1c by thread T4:
    #0 cleanup_undefined_types_noname /home/vries/gdb_versions/devel/src/gdb/stabsread.c:4383 (gdb+0xe608b2)
    #1 cleanup_undefined_stabs_types(objfile*) /home/vries/gdb_versions/devel/src/gdb/stabsread.c:4501 (gdb+0xe60c54)
    #2 buildsym_compunit::end_compunit_symtab_get_static_block(unsigned long, int, int) /home/vries/gdb_versions/devel/src/gdb/buildsym.c:837 (gdb+0x63dbba)
    #3 process_full_comp_unit /home/vries/gdb_versions/devel/src/gdb/dwarf2/read.c:8404 (gdb+0x8395f4)
    #4 process_queue_item /home/vries/gdb_versions/devel/src/gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
and location:
...
  Location is global 'noname_undefs_length' of size 4 at 0x00000324db1c
...

Fix this by adding a lock in cleanup_undefined_stabs_types.
2022-07-21 15:06:40 +02:00
Tom de Vries
c2ae16cc58 [gdb/symtab] Fix race condition in just_read_cus
Race condition between:
...
  Read of size 8 at 0x7b640001f2c8 by thread T1:
    #0 std::vector<dwarf2_per_cu_data*, std::allocator<dwarf2_per_cu_data*>
    >::push_back(dwarf2_per_cu_data* const&)
    /usr/include/c++/12/bits/stl_vector.h:1278 (gdb+0x888ad6)
    #1 process_full_comp_unit gdb/dwarf2/read.c:8451 (gdb+0x8397d0)
    #2 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
and:
...
  Previous write of size 8 at 0x7b640001f2c8 by main thread:
    #0 std::vector<dwarf2_per_cu_data*, std::allocator<dwarf2_per_cu_data*>
    >::push_back(dwarf2_per_cu_data* const&)
    /usr/include/c++/12/bits/stl_vector.h:1283 (gdb+0x888b52)
    #1 process_full_comp_unit gdb/dwarf2/read.c:8451 (gdb+0x8397d0)
    #2 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...

Fix this by doing the just_read_cus push_back in a lock.
2022-07-21 15:06:40 +02:00
Tom de Vries
a4f4bbc353 [gdb] Fix data race in bitfield
Data race between:
...
  Write of size 4 at 0x7b8009b483f0 by thread T2:
    #0 set_type_align(type*, unsigned long) /home/vries/gdb_versions/devel/src/gdb/gdbtypes.c:3751 (gdb+0x961e08)
...
and:
...
  Previous read of size 1 at 0x7b8009b483f1 by thread T4:
    #0 type::instance_flags() const /home/vries/gdb_versions/devel/src/gdb/gdbtypes.h:1092 (gdb+0x59e74b)
...
corresponding to:
...
  unsigned align_log2 : TYPE_ALIGN_BITS;
  unsigned m_instance_flags : 9;
...

Fix this by wrapping them using "struct { ... };".

For now, don't worry about size increase, we might have to address this later
using packed.

Still, is this a correct fix?  Maybe the problem is modifying a type from
different thread.  If so, having this patch for now may expose that problem.
2022-07-21 15:06:40 +02:00
Tom de Vries
2f8fd1da0e [gdb] Fix data race in bcache::insert
Data race between:
...
  Read of size 8 at 0x7bb4000000d0 by thread T4:
    #0 gdb::bcache::insert(void const*, int, bool*) gdb/bcache.c:155
    #1 objfile_per_bfd_storage::intern(char const*) gdb/objfiles.h:250
    #2 objfile::intern(char const*) gdb/objfiles.h:475
    #3 dwarf2_canonicalize_name gdb/dwarf2/read.c:21904
    #4 dwarf2_name gdb/dwarf2/read.c:21999
    #5 read_base_type gdb/dwarf2/read.c:17092
    #6 read_type_die_1 gdb/dwarf2/read.c:21529
    #7 read_type_die gdb/dwarf2/read.c:21464
    #8 process_die gdb/dwarf2/read.c:8674
    #9 read_file_scope gdb/dwarf2/read.c:9610
    #10 process_die gdb/dwarf2/read.c:8614
    #11 process_full_comp_unit gdb/dwarf2/read.c:8383
    #12 process_queue_item gdb/dwarf2/read.c:7592
...
and:
...
  Previous write of size 8 at 0x7bb4000000d0 by main thread:
    #0 gdb::bcache::insert(void const*, int, bool*) gdb/bcache.c:167
    #1 objfile_per_bfd_storage::intern(std::__cxx11::basic_string<char,
    std::char_traits<char>, std::allocator<char> > const&) gdb/objfiles.h:257
    #2 objfile::intern(std::__cxx11::basic_string<char,
    std::char_traits<char>, std::allocator<char> > const&) <null>
    #3 dwarf2_compute_name gdb/dwarf2/read.c:9050
    #4 dwarf2_full_name gdb/dwarf2/read.c:9070
    #5 read_structure_type gdb/dwarf2/read.c:14558
    #6 process_structure_scope gdb/dwarf2/read.c:14847
    #7 process_die gdb/dwarf2/read.c:8643
    #8 read_file_scope gdb/dwarf2/read.c:9610
    #9 process_die gdb/dwarf2/read.c:8614
    #10 process_full_comp_unit gdb/dwarf2/read.c:8383
    #11 process_queue_item gdb/dwarf2/read.c:7592
...
2022-07-21 15:06:40 +02:00
Tom de Vries
b0a46c96e4 [gdb/symtab] Fix data race in get_die_type_at_offset
Data race between:
...
==================
WARNING: ThreadSanitizer: data race (pid=28142)
  Read of size 4 at 0x7b1c0004b978 by thread T2:
    #0 htab_find_with_hash libiberty/hashtab.c:591 (gdb+0x1c5a254)
    #1 htab_find libiberty/hashtab.c:621 (gdb+0x1c5a44d)
    #2 get_die_type_at_offset gdb/dwarf2/read.c:23877 (gdb+0x872004)
    #3 get_die_type gdb/dwarf2/read.c:23890 (gdb+0x8720d0)
    #4 read_type_die gdb/dwarf2/read.c:21460 (gdb+0x8698e4)
    #5 process_die gdb/dwarf2/read.c:8674 (gdb+0x839f6e)
    #6 read_file_scope gdb/dwarf2/read.c:9610 (gdb+0x83ca5d)
    #7 process_die gdb/dwarf2/read.c:8614 (gdb+0x839e1f)
    #8 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x83945e)
    #9 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x83597d)
...
and:
...
  Previous write of size 4 at 0x7b1c0004b978 by thread T1:
    #0 htab_find_with_hash libiberty/hashtab.c:591 (gdb+0x1c5a26e)
    #1 htab_find libiberty/hashtab.c:621 (gdb+0x1c5a44d)
    #2 get_die_type_at_offset gdb/dwarf2/read.c:23877 (gdb+0x872004)
    #3 get_die_type gdb/dwarf2/read.c:23890 (gdb+0x8720d0)
    #4 process_structure_scope gdb/dwarf2/read.c:14845 (gdb+0x851c12)
    #5 process_die gdb/dwarf2/read.c:8643 (gdb+0x839f24)
    #6 read_file_scope gdb/dwarf2/read.c:9610 (gdb+0x83ca5d)
    #7 process_die gdb/dwarf2/read.c:8614 (gdb+0x839e1f)
    #8 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x83945e)
    #9 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x83597d)
...

Fix by using lock, also in set_die_type.
2022-07-21 15:06:40 +02:00
Tom de Vries
19947698de [gdb/symtab] Fix data race in objstats->n_syms
Data race between:
...
  Read of size 4 at 0x7b4000006dc8 by main thread:
    #0 new_symbol gdb/dwarf2/read.c:20704 (gdb+0x866f3e)
    #1 process_die gdb/dwarf2/read.c:8674 (gdb+0x839fa8)
    #2 read_file_scope gdb/dwarf2/read.c:9610 (gdb+0x83ca7f)
    #3 process_die gdb/dwarf2/read.c:8614 (gdb+0x839e41)
    #4 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839480)
    #5 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x83599f)
...
and:
...
  Previous write of size 4 at 0x7b4000006dc8 by thread T2:
    #0 new_symbol gdb/dwarf2/read.c:20704 (gdb+0x866f5d)
    #1 process_die gdb/dwarf2/read.c:8674 (gdb+0x839fa8)
    #2 read_file_scope gdb/dwarf2/read.c:9610 (gdb+0x83ca7f)
    #3 process_die gdb/dwarf2/read.c:8614 (gdb+0x839e41)
    #4 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839480)
    #5 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x83599f)
...

Fix by making objstats->n_syms atomic.  Likewise for n_types.
2022-07-21 15:06:40 +02:00
Tom de Vries
3164537f25 [gdb/symtab] Fix data race on per_objfile->sym_cu
We have both:
...
gdb/dwarf2/read.c:9590: internal-error: read_file_scope: \
  Assertion `per_objfile->sym_cu == nullptr' failed.
...
and a data race between:
...
    #0 read_file_scope gdb/dwarf2/read.c:9590 (gdb+0x83c8ca)
    #1 process_die gdb/dwarf2/read.c:8614 (gdb+0x839dc1)
    #2 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839400)
    #3 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x83591f)
...
and:
...
  Previous write of size 8 at 0x7b4400096f20 by thread T1:
    #0 scoped_restore_tmpl<dwarf2_cu*>::scoped_restore_tmpl<dwarf2_cu*>
    (dwarf2_cu**, dwarf2_cu*) gdbsupport/scoped_restore.h:73 (gdb+0x89d23e)
    #1 scoped_restore_tmpl<dwarf2_cu*> make_scoped_restore<dwarf2_cu*,
    dwarf2_cu*>(dwarf2_cu**, dwarf2_cu*) gdbsupport/scoped_restore.h:115
    (gdb+0x890543)
    #2 read_file_scope gdb/dwarf2/read.c:9592 (gdb+0x83c924)
    #3 process_die gdb/dwarf2/read.c:8614 (gdb+0x839dc1)
    #4 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839400)
    #5 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x83591f)
...

Fix again by using poor man's thread local.
2022-07-21 15:06:40 +02:00
Tom de Vries
fa25a1fa4a [gdb/symtab] Fix race condition in objfile_obstack
Race condition between:
...
  Read of size 8 at 0x7b4400096f60 by thread T1:
    #0 obstack_zalloc<compunit_symtab> gdbsupport/gdb_obstack.h:33
    #1 allocate_compunit_symtab(objfile*, char const*) gdb/symfile.c:2822
    #2 buildsym_compunit::buildsym_compunit(objfile*, char const*,
    char const*, language, unsigned long) gdb/buildsym.c:65
    #3 dwarf2_cu::start_compunit_symtab(char const*, char const*,
    unsigned long) gdb/dwarf2/cu.c:65
    #4 read_file_scope gdb/dwarf2/read.c:9587
    #5 process_die gdb/dwarf2/read.c:8614
    #6 process_full_comp_unit gdb/dwarf2/read.c:8383
    #7 process_queue_item gdb/dwarf2/read.c:7592
...
and:
...
  Previous write of size 8 at 0x7b4400096f60 by thread T2:
    #0 _obstack_newchunk libiberty/obstack.c:211
    #1 obstack_zalloc<compunit_symtab> gdbsupport/gdb_obstack.h:33
    #2 allocate_compunit_symtab(objfile*, char const*) gdb/symfile.c:2822
    #3 buildsym_compunit::buildsym_compunit(objfile*, char const*,
    char const*, language, unsigned long) gdb/buildsym.c:65
    #4 dwarf2_cu::start_compunit_symtab(char const*, char const*,
    unsigned long) gdb/dwarf2/cu.c:65
    #5 read_file_scope gdb/dwarf2/read.c:9587
    #6 process_die gdb/dwarf2/read.c:8614
    #7 process_full_comp_unit gdb/dwarf2/read.c:8383
    #8 process_queue_item gdb/dwarf2/read.c:7592
...

Fix by using poor man's thread_local.
2022-07-21 15:06:40 +02:00
Tom de Vries
5a74a1a528 [gdbsupport] Workaround data race in get_print_cell
Data race between:
...
  Write of size 4 at 0x00000324eb60 by thread T2:
    #0 get_print_cell() gdbsupport/print-utils.cc:35 (gdb+0x1c032c7)
    #1 hex_string(long) gdbsupport/print-utils.cc:230 (gdb+0x1c03bc2)
    #2 sect_offset_str gdb/gdbtypes.h:82 (gdb+0x81b333)
    #3 process_queue_item gdb/dwarf2/read.c:7581 (gdb+0x831645)
...
and:
...
  Previous read of size 4 at 0x00000324eb60 by thread T3:
    #0 get_print_cell() gdbsupport/print-utils.cc:35 (gdb+0x1c032b4)
    #1 hex_string(long) gdbsupport/print-utils.cc:230 (gdb+0x1c03bc2)
    #2 sect_offset_str gdb/gdbtypes.h:82 (gdb+0x81b333)
    #3 process_queue_item gdb/dwarf2/read.c:7581 (gdb+0x831645)
...

For now, just do a malloc in get_print_cell to work around the data race.
2022-07-21 15:06:40 +02:00
Tom de Vries
060f7c545b [gdb/symtab] Use parallel_for_each in process_queue
Do the parallelization.
2022-07-21 15:06:40 +02:00
Tom de Vries
3f7397885b [gdb] Make objfile_obstack a member function
Prepare to fix race conditions in a single location.
2022-07-21 15:06:40 +02:00
Tom de Vries
281b014f52 [gdb/symtab] Factor out process_queue_item
Refactoring that makes the patch to parallelize process_queue more readable.
2022-07-21 15:06:40 +02:00
Tom de Vries
80a527c1c9 [gdb/symtab] Add early-out in process_queue
Don't print "Expanding one or more symtabs of objfile" if the queue is empty.
2022-07-21 15:06:39 +02:00
Tom de Vries
9ce66f579a [gdb/symtab] Use deque instead of queue for per_objfile->queue
Allows us to access all elements at once.
2022-07-21 15:06:39 +02:00
Tom de Vries
947a158521 [gdbsupport] Add thread_pool::id
Used to implement a poor mans thread_local.
2022-07-21 15:06:39 +02:00
Tom de Vries
b4045c876d [COVER-LETTER] Parallelize process_queue
I. Rationale

When investigating my running example for gdb speed with lto execs (see PR23710):
...
$ gdb -q -batch ./lto/cc1 -ex "b do_rpo_vn"
...
using this patch:
...
@@ -7549,13 +7549,17 @@ maybe_queue_comp_unit (struct dwarf2_cu *dependent_cu,
 static void
 process_queue (dwarf2_per_objfile *per_objfile)
 {
-  dwarf_read_debug_printf ("Expanding one or more symtabs of objfile %s ...",
-			   objfile_name (per_objfile->objfile));
+  if (per_objfile->queue->empty ())
+    return;

   /* The queue starts out with one item, but following a DIE reference
      may load a new CU, adding it to the end of the queue.  */
   while (!per_objfile->queue->empty ())
     {
+      dwarf_read_debug_printf ("Expanding symtabs of objfile %s, queue size: %zd ...",
+			       objfile_name (per_objfile->objfile),
+			       per_objfile->queue->size ());
+
       dwarf2_queue_item &item = per_objfile->queue->front ();
       dwarf2_per_cu_data *per_cu = item.per_cu;

@@ -8522,7 +8526,11 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
       if (die->parent && die->parent->parent == NULL
 	  && per_cu->unit_type (false) == DW_UT_compile
 	  && per_cu->lang (false) == language_cplus)
-	return;
+	{
+	  dwarf_read_debug_printf ("Skipping import of c++ CU at offset %s",
+				   sect_offset_str (sect_off));
+	  return;
+	}

       /* If necessary, add it to the queue and load its DIEs.  */
       if (maybe_queue_comp_unit (cu, per_cu, per_objfile,
...
and "set debug dwarf-read 1" (dumped into a log file, see V), I noticed:
...
$ grep "Expanding symtabs of" LOG | more
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 1 ...
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 1 ...
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 173 ...
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 172 ...
...
that the queue processed by process_queue can be large, and is processed
sequentially, and I wondered if doing this in parallel might speed things up.

This might also be useful for -readnow, but that might require additional
changes to active this, I haven't checked that yet.

II. Correctness results.

The running example runs without thread sanitizer issues.

Running the testsuite with thread sanitizer revealed issues during
cpexprs-debug-types.exp.

III. Performance results.

I did a performance experiment using:
...
$ for n in $(seq 1 10); do \
    time gdb -q -batch ~/firefox/libxul.so-93.0-1.1.x86_64.debug \
    2>&1 \
    | grep "real:"; \
  done
...
and observed the following results for master:
...
real: 4.09
real: 4.03
real: 4.64
real: 4.04
real: 4.18
real: 4.73
real: 4.63
real: 4.02
real: 4.04
real: 4.03
...
and with this branch:
...
real: 4.04
real: 4.06
real: 3.97
real: 4.59
real: 4.39
real: 4.03
real: 4.03
real: 3.96
real: 3.97
real: 4.54
...
which looks roughtly comparable, so we don't seem to have slowed down the
common case (where we don't excercise process_queue yet).

Then with the running example:
...
$ for n in $(seq 1 10); do \
    time gdb -q -batch ./lto/cc1 -ex "b do_rpo_vn" 2>&1 | grep "real:"; \
  done
...
with master:
...
real: 4.19
real: 4.40
real: 4.30
real: 4.29
real: 4.20
real: 4.25
real: 4.28
real: 4.22
real: 4.31
real: 4.32
...
and this branch:
...
real: 4.79
real: 4.83
real: 4.81
real: 4.74
real: 4.93
real: 4.92
real: 4.72
real: 4.82
real: 4.77
real: 4.79
...

So, there's a noticable slowdown.

Doing the break after "maint set worker-threads 0" (to force the parallel for
in process_queue to run sequentially) gives us:
...
real: 4.56
real: 4.50
real: 4.57
real: 4.57
real: 4.61
real: 4.58
real: 4.52
real: 4.62
real: 4.52
real: 4.58
...

IV. Analysis.

The slowdown is probably caused by excessive locking.  This could be solved by
tracking more things in a thread_local way, but probably at the cost of more
memory.

We could implement a statistics_mutex that dumps the lock/unlock statistics
upon destroying to find out what the problematic locks are (I suspect at least
the die_type ones).

A possibility is that we're not getting the full benefit because we only start
processing in parallel once process_queue is called.  A possible fix
would be to have the main thread filling the queue and a dispatcher thread
reading it and dispatching items to worker threads.

Another possibility is that we're not getting the full benefit because we
fairly distribute a number of CUs, but CUs will not be of equal size (this
might hold equally for the cooked index btw).  This could be mitigated
somewhat by taking into account the size of the CUs when doing the
distribution.  Another solution would be to add a parallel_for_each_dynamic or
some such that dispatches to workers that are idle.  [ Presumably the
dispatcher thread mentioned above would behave similarly. ]

[ I've proposed a patch "[gdbsupport] Use task size in parallel_for_each" for
trunk that deals with this issue for the parallel for in
dwarf2_build_psymtabs_hard.  Included in this branch before the cover letter. ]

[ A last minute addition "[gdb/symtab] Use task size in parallel for in
process_queue" did not improve the result. ]

V. Dwarf-read log

FTR, full log of gdb output with dwarf-read logging on:
...
[dwarf-read] dwarf2_initialize_objfile: called
[dwarf-read] dwarf2_build_psymtabs_hard: Building psymtabs of objfile cc1 ...
[dwarf-read] read_comp_units_from_section: Reading .debug_info for cc1
[dwarf-read] open_and_init_dwp_file: DWP file not found: cc1.dwp
[dwarf-read] print_tu_stats: Type unit statistics:
[dwarf-read] print_tu_stats:   0 TUs
[dwarf-read] print_tu_stats:   0 uniq abbrev tables
[dwarf-read] print_tu_stats:   0 symtabs from stmt_list entries
[dwarf-read] print_tu_stats:   0 symtab sharers
[dwarf-read] print_tu_stats:   0 type units without a stmt_list
[dwarf-read] print_tu_stats:   0 all_type_units reallocs
[dwarf-read] dwarf2_build_psymtabs_hard: Done building psymtabs of cc1
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 1 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x282e061
[dwarf-read] process_queue: Done expanding CU at offset 0x282e061
[dwarf-read] process_queue: Done expanding symtabs of cc1.
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 1 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x4f726fa
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x18913
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xd9
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x48bb60
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x56019
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x432a1f
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x4c6372
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x27e55eb
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x94932
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x17642d
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x261f49
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x52ac2c
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x151169
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xd2a8cd
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x279a341
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x256eabe
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x271c86b
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x6a3f89
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x24ad9d6
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x274b291
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x26e630a
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x282e06c
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x540b58
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x181903c
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3f05d53
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xe25133
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x35811ee
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xcc5d11
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1e7e6d1
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1e3fbd
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1fb00fe
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x65e263
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x625166
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2a3cb30
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xfa6640
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2d0bdf6
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x22ed46
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x4ef108
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x8d697a
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xe50cd2
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x109c04d
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xb42761
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xaa65e8
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x7f222a
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1a54bc
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x23c40eb
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xd5eccb
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xeb4343
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x211992
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xf34af1
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x150e087
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xa070aa
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xaf4948
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x922e3c
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2628d41
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x229ddf3
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x14c101f
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x709504
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x193586f
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x8c24f9
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x20741b1
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x9530c2
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x5f55f9
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x5c2f35
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x58e313
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x19b0475
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xbfb92a
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x10f2e0
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xda08e5
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xc90a25
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x16524ce
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x834f38
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2e9352
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x31964b
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x9bd839
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x5a0ea0
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x27cbbf1
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1012d7
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2424d46
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xcaaa67
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2017b91
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x6c293d
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x47e745
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x245be5d
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x13f465a
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x27840f7
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1f94f6e
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x18c12a1
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2733a9c
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x228970c
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x24eed38
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1e085a3
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xc59eeb
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x7c4801
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x26b9f5c
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x269fd21
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x5db31b
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2687a48
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2478fbe
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2317395
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2657181
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x20d8a89
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1369c6c
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x21583cf
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1a76f13
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x849309
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x411fc8
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x260a83d
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x12f73a3
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x899f40
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x195b657
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x25bcc72
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x259688c
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3ebb2d5
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3ec48c8
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xc3fc34
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1d36e66
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xee7fc
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x22c669e
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3ea4bac
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1ff9d25
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xd0a5eb
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x824e4a
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xf679ff
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xfe5f20
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x203861e
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2a167ce
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xbe8373
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x23ee830
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1efde95
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3028d26
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2e1f51e
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x10411d1
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x33e777d
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3f0a9ce
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1dc37af
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3ef249e
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1751aa5
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1b52685
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x11cc196
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1b3b1e6
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x12eba45
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x414bd
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3f3a624
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2915861
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x248fe5c
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2dadb2
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2113e46
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x321ff16
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3d80b8a
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x21879c2
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x19158b7
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1d425c7
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x172a702
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x17709ba
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x335da3
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2c76457
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x12b9fe2
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x38abdf2
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2ee9139
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3d68c0a
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1d6e394
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3d49449
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x22278ca
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3ef7e15
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2bf61b9
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x19d1d3a
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xa71c19
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x14eef30
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3e966b0
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xbaa4fb
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1e18bd6
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x3ee5f02
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x4082bc
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x46f8cf
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2effdc1
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0xdcd1cb
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1270a16
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2243311
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x169070e
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1bd41bb
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x39b092
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1ebd919
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x1cb0b5e
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x2381bf5
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x12de1b4
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x220dd2f
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x7436f9
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x36b680
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x765494
[dwarf-read] process_imported_unit_die: Skipping import of c++ CU at offset 0x14061fc
[dwarf-read] process_queue: Done expanding CU at offset 0x4f726fa
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 173 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fd7e1b
[dwarf-read] process_queue: Done expanding CU at offset 0x3fd7e1b
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 172 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3f6f015
[dwarf-read] process_queue: Done expanding CU at offset 0x3f6f015
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 171 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3f6a111
[dwarf-read] process_queue: Done expanding CU at offset 0x3f6a111
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 170 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3f66c00
[dwarf-read] process_queue: Done expanding CU at offset 0x3f66c00
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 169 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3f51880
[dwarf-read] process_queue: Done expanding CU at offset 0x3f51880
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 168 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fcc5a5
[dwarf-read] process_queue: Done expanding CU at offset 0x3fcc5a5
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 167 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fd478f
[dwarf-read] process_queue: Done expanding CU at offset 0x3fd478f
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 166 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3f5eb9c
[dwarf-read] process_queue: Done expanding CU at offset 0x3f5eb9c
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 165 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fd916c
[dwarf-read] process_queue: Done expanding CU at offset 0x3fd916c
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 164 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fd1973
[dwarf-read] process_queue: Done expanding CU at offset 0x3fd1973
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 163 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fd73b7
[dwarf-read] process_queue: Done expanding CU at offset 0x3fd73b7
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 162 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fcca75
[dwarf-read] process_queue: Done expanding CU at offset 0x3fcca75
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 161 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fd98bd
[dwarf-read] process_queue: Done expanding CU at offset 0x3fd98bd
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 160 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fca0f1
[dwarf-read] process_queue: Done expanding CU at offset 0x3fca0f1
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 159 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fd9f5b
[dwarf-read] process_queue: Done expanding CU at offset 0x3fd9f5b
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 158 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fd1e43
[dwarf-read] process_queue: Done expanding CU at offset 0x3fd1e43
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 157 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fca842
[dwarf-read] process_queue: Done expanding CU at offset 0x3fca842
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 156 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3fd05c2
[dwarf-read] process_queue: Done expanding CU at offset 0x3fd05c2
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 155 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3f64557
[dwarf-read] process_queue: Done expanding CU at offset 0x3f64557
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 154 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x52ac21
[dwarf-read] process_queue: Done expanding CU at offset 0x52ac21
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 153 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x27e55e0
[dwarf-read] process_queue: Done expanding CU at offset 0x27e55e0
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 152 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x279a336
[dwarf-read] process_queue: Done expanding CU at offset 0x279a336
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 151 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x27840ec
[dwarf-read] process_queue: Done expanding CU at offset 0x27840ec
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 150 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x274b286
[dwarf-read] process_queue: Done expanding CU at offset 0x274b286
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 149 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x26e62ff
[dwarf-read] process_queue: Done expanding CU at offset 0x26e62ff
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 148 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x26b9f51
[dwarf-read] process_queue: Done expanding CU at offset 0x26b9f51
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 147 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x269fd16
[dwarf-read] process_queue: Done expanding CU at offset 0x269fd16
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 146 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2687a3d
[dwarf-read] process_queue: Done expanding CU at offset 0x2687a3d
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 145 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2657176
[dwarf-read] process_queue: Done expanding CU at offset 0x2657176
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 144 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2596881
[dwarf-read] process_queue: Done expanding CU at offset 0x2596881
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 143 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3ec48bd
[dwarf-read] process_queue: Done expanding CU at offset 0x3ec48bd
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 142 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x6a3f7e
[dwarf-read] process_queue: Done expanding CU at offset 0x6a3f7e
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 141 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1819031
[dwarf-read] process_queue: Done expanding CU at offset 0x1819031
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 140 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2733a91
[dwarf-read] process_queue: Done expanding CU at offset 0x2733a91
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 139 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x8c24ee
[dwarf-read] process_queue: Done expanding CU at offset 0x8c24ee
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 138 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3ebb2ca
[dwarf-read] process_queue: Done expanding CU at offset 0x3ebb2ca
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 137 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x18908
[dwarf-read] process_queue: Done expanding CU at offset 0x18908
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 136 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xc3fc29
[dwarf-read] process_queue: Done expanding CU at offset 0xc3fc29
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 135 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x411fbd
[dwarf-read] process_queue: Done expanding CU at offset 0x411fbd
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 134 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x12f7398
[dwarf-read] process_queue: Done expanding CU at offset 0x12f7398
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 133 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xc59ee0
[dwarf-read] process_queue: Done expanding CU at offset 0xc59ee0
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 132 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1e7e6c6
[dwarf-read] process_queue: Done expanding CU at offset 0x1e7e6c6
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 131 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x271c860
[dwarf-read] process_queue: Done expanding CU at offset 0x271c860
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 130 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xcaaa5c
[dwarf-read] process_queue: Done expanding CU at offset 0xcaaa5c
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 129 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2a3cb25
[dwarf-read] process_queue: Done expanding CU at offset 0x2a3cb25
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 128 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x5600e
[dwarf-read] process_queue: Done expanding CU at offset 0x5600e
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 127 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3ea4ba1
[dwarf-read] process_queue: Done expanding CU at offset 0x3ea4ba1
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 126 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x540b4d
[dwarf-read] process_queue: Done expanding CU at offset 0x540b4d
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 125 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x195b64c
[dwarf-read] process_queue: Done expanding CU at offset 0x195b64c
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 124 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xf34ae6
[dwarf-read] process_queue: Done expanding CU at offset 0xf34ae6
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 123 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x58e308
[dwarf-read] process_queue: Done expanding CU at offset 0x58e308
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 122 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x5db310
[dwarf-read] process_queue: Done expanding CU at offset 0x5db310
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 121 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x5f55ee
[dwarf-read] process_queue: Done expanding CU at offset 0x5f55ee
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 120 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2d0bdeb
[dwarf-read] process_queue: Done expanding CU at offset 0x2d0bdeb
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 119 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x33e7772
[dwarf-read] process_queue: Done expanding CU at offset 0x33e7772
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 118 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2289701
[dwarf-read] process_queue: Done expanding CU at offset 0x2289701
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 117 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x211987
[dwarf-read] process_queue: Done expanding CU at offset 0x211987
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 116 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1d36e5b
[dwarf-read] process_queue: Done expanding CU at offset 0x1d36e5b
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 115 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x220dd24
[dwarf-read] process_queue: Done expanding CU at offset 0x220dd24
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 114 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x245be52
[dwarf-read] process_queue: Done expanding CU at offset 0x245be52
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 113 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xc90a1a
[dwarf-read] process_queue: Done expanding CU at offset 0xc90a1a
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 112 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1f94f63
[dwarf-read] process_queue: Done expanding CU at offset 0x1f94f63
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 111 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x22ed3b
[dwarf-read] process_queue: Done expanding CU at offset 0x22ed3b
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 110 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x23ee825
[dwarf-read] process_queue: Done expanding CU at offset 0x23ee825
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 109 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x20741a6
[dwarf-read] process_queue: Done expanding CU at offset 0x20741a6
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 108 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x47e73a
[dwarf-read] process_queue: Done expanding CU at offset 0x47e73a
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 107 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1fb00f3
[dwarf-read] process_queue: Done expanding CU at offset 0x1fb00f3
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 106 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1dc37a4
[dwarf-read] process_queue: Done expanding CU at offset 0x1dc37a4
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 105 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xb42756
[dwarf-read] process_queue: Done expanding CU at offset 0xb42756
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 104 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x48bb55
[dwarf-read] process_queue: Done expanding CU at offset 0x48bb55
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 103 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x94927
[dwarf-read] process_queue: Done expanding CU at offset 0x94927
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 102 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x321ff0b
[dwarf-read] process_queue: Done expanding CU at offset 0x321ff0b
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 101 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x18c1296
[dwarf-read] process_queue: Done expanding CU at offset 0x18c1296
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 100 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2038613
[dwarf-read] process_queue: Done expanding CU at offset 0x2038613
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 99 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xd0a5e0
[dwarf-read] process_queue: Done expanding CU at offset 0xd0a5e0
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 98 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xcc5d06
[dwarf-read] process_queue: Done expanding CU at offset 0xcc5d06
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 97 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x19b046a
[dwarf-read] process_queue: Done expanding CU at offset 0x19b046a
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 96 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x65e258
[dwarf-read] process_queue: Done expanding CU at offset 0x65e258
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 95 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2a167c3
[dwarf-read] process_queue: Done expanding CU at offset 0x2a167c3
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 94 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x231738a
[dwarf-read] process_queue: Done expanding CU at offset 0x231738a
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 93 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2c7644c
[dwarf-read] process_queue: Done expanding CU at offset 0x2c7644c
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 92 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x10f2d5
[dwarf-read] process_queue: Done expanding CU at offset 0x10f2d5
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 91 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x12de1a9
[dwarf-read] process_queue: Done expanding CU at offset 0x12de1a9
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 90 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2e9347
[dwarf-read] process_queue: Done expanding CU at offset 0x2e9347
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 89 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3ef2493
[dwarf-read] process_queue: Done expanding CU at offset 0x3ef2493
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 88 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x432a14
[dwarf-read] process_queue: Done expanding CU at offset 0x432a14
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 87 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x39b087
[dwarf-read] process_queue: Done expanding CU at offset 0x39b087
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 86 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x21583c4
[dwarf-read] process_queue: Done expanding CU at offset 0x21583c4
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 85 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x248fe51
[dwarf-read] process_queue: Done expanding CU at offset 0x248fe51
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 84 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2915856
[dwarf-read] process_queue: Done expanding CU at offset 0x2915856
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 83 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2628d36
[dwarf-read] process_queue: Done expanding CU at offset 0x2628d36
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 82 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x260a832
[dwarf-read] process_queue: Done expanding CU at offset 0x260a832
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 81 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2478fb3
[dwarf-read] process_queue: Done expanding CU at offset 0x2478fb3
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 80 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x5a0e95
[dwarf-read] process_queue: Done expanding CU at offset 0x5a0e95
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 79 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xda08da
[dwarf-read] process_queue: Done expanding CU at offset 0xda08da
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 78 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x16524c3
[dwarf-read] process_queue: Done expanding CU at offset 0x16524c3
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 77 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x22c6693
[dwarf-read] process_queue: Done expanding CU at offset 0x22c6693
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 76 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x35811e3
[dwarf-read] process_queue: Done expanding CU at offset 0x35811e3
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 75 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x172a6f7
[dwarf-read] process_queue: Done expanding CU at offset 0x172a6f7
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 74 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x20d8a7e
[dwarf-read] process_queue: Done expanding CU at offset 0x20d8a7e
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 73 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x25bcc67
[dwarf-read] process_queue: Done expanding CU at offset 0x25bcc67
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 72 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x150e07c
[dwarf-read] process_queue: Done expanding CU at offset 0x150e07c
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 71 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xaf493d
[dwarf-read] process_queue: Done expanding CU at offset 0xaf493d
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 70 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x27cbbe6
[dwarf-read] process_queue: Done expanding CU at offset 0x27cbbe6
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 69 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x9530b7
[dwarf-read] process_queue: Done expanding CU at offset 0x9530b7
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 68 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x7c47f6
[dwarf-read] process_queue: Done expanding CU at offset 0x7c47f6
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 67 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xfa6635
[dwarf-read] process_queue: Done expanding CU at offset 0xfa6635
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 66 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x13f464f
[dwarf-read] process_queue: Done expanding CU at offset 0x13f464f
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 65 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x9bd82e
[dwarf-read] process_queue: Done expanding CU at offset 0x9bd82e
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 64 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x24ad9cb
[dwarf-read] process_queue: Done expanding CU at offset 0x24ad9cb
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 63 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x256eab3
[dwarf-read] process_queue: Done expanding CU at offset 0x256eab3
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 62 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x24eed2d
[dwarf-read] process_queue: Done expanding CU at offset 0x24eed2d
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 61 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1ff9d1a
[dwarf-read] process_queue: Done expanding CU at offset 0x1ff9d1a
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 60 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x6c2932
[dwarf-read] process_queue: Done expanding CU at offset 0x6c2932
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 59 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xf679f4
[dwarf-read] process_queue: Done expanding CU at offset 0xf679f4
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 58 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xe50cc7
[dwarf-read] process_queue: Done expanding CU at offset 0xe50cc7
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 57 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1a54b1
[dwarf-read] process_queue: Done expanding CU at offset 0x1a54b1
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 56 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2ed3119
[dwarf-read] process_queue: Done expanding CU at offset 0x2ed3119
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 55 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x319640
[dwarf-read] process_queue: Done expanding CU at offset 0x319640
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 54 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x261f3e
[dwarf-read] process_queue: Done expanding CU at offset 0x261f3e
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 53 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x229dde8
[dwarf-read] process_queue: Done expanding CU at offset 0x229dde8
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 52 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x4ef0fd
[dwarf-read] process_queue: Done expanding CU at offset 0x4ef0fd
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 51 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x4c6367
[dwarf-read] process_queue: Done expanding CU at offset 0x4c6367
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 50 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2e1f513
[dwarf-read] process_queue: Done expanding CU at offset 0x2e1f513
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 49 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xd5ecc0
[dwarf-read] process_queue: Done expanding CU at offset 0xd5ecc0
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 48 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xd2a8c2
[dwarf-read] process_queue: Done expanding CU at offset 0xd2a8c2
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 47 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xaa65dd
[dwarf-read] process_queue: Done expanding CU at offset 0xaa65dd
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 46 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xeb4338
[dwarf-read] process_queue: Done expanding CU at offset 0xeb4338
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 45 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x7f221f
[dwarf-read] process_queue: Done expanding CU at offset 0x7f221f
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 44 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x109c042
[dwarf-read] process_queue: Done expanding CU at offset 0x109c042
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 43 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xa71c0e
[dwarf-read] process_queue: Done expanding CU at offset 0xa71c0e
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 42 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x922e31
[dwarf-read] process_queue: Done expanding CU at offset 0x922e31
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 41 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x23c40e0
[dwarf-read] process_queue: Done expanding CU at offset 0x23c40e0
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 40 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x8d696f
[dwarf-read] process_queue: Done expanding CU at offset 0x8d696f
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 39 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3028d1b
[dwarf-read] process_queue: Done expanding CU at offset 0x3028d1b
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 38 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2424d3b
[dwarf-read] process_queue: Done expanding CU at offset 0x2424d3b
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 37 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x834f2d
[dwarf-read] process_queue: Done expanding CU at offset 0x834f2d
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 36 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2381bea
[dwarf-read] process_queue: Done expanding CU at offset 0x2381bea
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 35 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1b3b1db
[dwarf-read] process_queue: Done expanding CU at offset 0x1b3b1db
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 34 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1b5267a
[dwarf-read] process_queue: Done expanding CU at offset 0x1b5267a
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 33 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3f3a619
[dwarf-read] process_queue: Done expanding CU at offset 0x3f3a619
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 32 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x19158ac
[dwarf-read] process_queue: Done expanding CU at offset 0x19158ac
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 31 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1d425bc
[dwarf-read] process_queue: Done expanding CU at offset 0x1d425bc
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 30 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1e08598
[dwarf-read] process_queue: Done expanding CU at offset 0x1e08598
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 29 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x335d98
[dwarf-read] process_queue: Done expanding CU at offset 0x335d98
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 28 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3f0a9c3
[dwarf-read] process_queue: Done expanding CU at offset 0x3f0a9c3
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 27 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1751a9a
[dwarf-read] process_queue: Done expanding CU at offset 0x1751a9a
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 26 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xbfb91f
[dwarf-read] process_queue: Done expanding CU at offset 0xbfb91f
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 25 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x824e3f
[dwarf-read] process_queue: Done expanding CU at offset 0x824e3f
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 24 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x36b675
[dwarf-read] process_queue: Done expanding CU at offset 0x36b675
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 23 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x17709af
[dwarf-read] process_queue: Done expanding CU at offset 0x17709af
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 22 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x5c2f2a
[dwarf-read] process_queue: Done expanding CU at offset 0x5c2f2a
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 21 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2113e3b
[dwarf-read] process_queue: Done expanding CU at offset 0x2113e3b
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 20 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x16f9378
[dwarf-read] process_queue: Done expanding CU at offset 0x16f9378
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 19 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3d68bff
[dwarf-read] process_queue: Done expanding CU at offset 0x3d68bff
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 18 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2ee912e
[dwarf-read] process_queue: Done expanding CU at offset 0x2ee912e
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 17 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1d6e389
[dwarf-read] process_queue: Done expanding CU at offset 0x1d6e389
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 16 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x899f35
[dwarf-read] process_queue: Done expanding CU at offset 0x899f35
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 15 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3d4943e
[dwarf-read] process_queue: Done expanding CU at offset 0x3d4943e
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 14 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x14061f1
[dwarf-read] process_queue: Done expanding CU at offset 0x14061f1
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 13 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0xfe5f15
[dwarf-read] process_queue: Done expanding CU at offset 0xfe5f15
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 12 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1935864
[dwarf-read] process_queue: Done expanding CU at offset 0x1935864
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 11 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x21879b7
[dwarf-read] process_queue: Done expanding CU at offset 0x21879b7
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 10 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3d80b7f
[dwarf-read] process_queue: Done expanding CU at offset 0x3d80b7f
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 9 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1369c61
[dwarf-read] process_queue: Done expanding CU at offset 0x1369c61
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 8 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x1a76f08
[dwarf-read] process_queue: Done expanding CU at offset 0x1a76f08
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 7 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x7094f9
[dwarf-read] process_queue: Done expanding CU at offset 0x7094f9
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 6 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x12b9fd7
[dwarf-read] process_queue: Done expanding CU at offset 0x12b9fd7
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 5 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x38abde7
[dwarf-read] process_queue: Done expanding CU at offset 0x38abde7
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 4 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x19d1d2f
[dwarf-read] process_queue: Done expanding CU at offset 0x19d1d2f
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 3 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x3ef7e0a
[dwarf-read] process_queue: Done expanding CU at offset 0x3ef7e0a
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 2 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x2bf61ae
[dwarf-read] process_queue: Done expanding CU at offset 0x2bf61ae
[dwarf-read] process_queue: Expanding symtabs of objfile cc1, queue size: 1 ...
[dwarf-read] process_queue: Expanding symtab of CU at offset 0x765489
[dwarf-read] process_queue: Done expanding CU at offset 0x765489
[dwarf-read] process_queue: Done expanding symtabs of cc1.
Breakpoint 1 at 0xd40e30: do_rpo_vn. (2 locations)
...
2022-07-21 15:01:42 +02:00
Tom de Vries
ce6da2065f [gdbsupport] Use task size in parallel_for_each
Ensuring a fair distribution over the worker threads and main thread in terms
of number of CUs might not be the most efficient way, given that CUs can vary
in size.

Fix this by:
- adding a task_size_ptr parameter to parallel_for_each,
  defaulting to nullptr,
- using per_cu->get_length () as the task size in the parallel_for_each
  in dwarf2_build_psymtabs_hard, and
- using the task size in parallel_for_each to distribute similarly-sized tasks
  to the threads.

I've used this experiment to verify the performance impact:
...
$ for n in $(seq 1 10); do \
    time gdb -q -batch ~/firefox/libxul.so-93.0-1.1.x86_64.debug \
    2>&1 \
    | grep "real:"; \
  done
...
and without the patch got:
...
real: 4.71
real: 4.88
real: 4.29
real: 4.30
real: 4.65
real: 4.27
real: 4.27
real: 4.27
real: 4.75
real: 4.41
...
and with the patch:
...
real: 3.68
real: 3.81
real: 3.80
real: 3.68
real: 3.75
real: 3.69
real: 3.69
real: 3.74
real: 3.67
real: 3.74
...
so that seems a reasonable improvement.

With parallel_for_each_debug set to true, we get some more detail about
the difference in behaviour.  Without the patch we have:
...
Parallel for: n_elements: 2818
Parallel for: minimum elements per thread: 1
Parallel for: elts_per_thread: 704
Parallel for: elements on worker thread 0       : 705
Parallel for: elements on worker thread 1       : 705
Parallel for: elements on worker thread 2       : 704
Parallel for: elements on worker thread 3       : 0
Parallel for: elements on main thread           : 704
...
and with the patch:
...
Parallel for: n_elements: 2818
Parallel for: total_size: 1483674865
Parallel for: size_per_thread: 370918716
Parallel for: elements on worker thread 0       : 752   (size: 371811790)
Parallel for: elements on worker thread 1       : 360   (size: 371509370)
Parallel for: elements on worker thread 2       : 1130  (size: 372681710)
Parallel for: elements on worker thread 3       : 0     (size: 0)
Parallel for: elements on main thread           : 576   (size: 367671995)
...

Tested on x86_64-linux.
2022-07-21 15:00:35 +02:00
30 changed files with 489 additions and 281 deletions

0
gdb/COVER-LETTER Normal file
View File

View File

@@ -2607,7 +2607,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
if (n_bytes || n_words)
{
gdb_byte *p = entry
= (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
= (gdb_byte *) obstack_alloc (objfile->objfile_obstack (),
n_bytes + n_words * 4 + 1);
while (n_bytes--)

View File

@@ -24,6 +24,11 @@
#include "bcache.h"
#include <algorithm>
#include <mutex>
#if CXX_STD_THREAD
static std::mutex bcache_lock;
#endif
namespace gdb {
@@ -63,6 +68,9 @@ struct bstring
void
bcache::expand_hash_table ()
{
#if CXX_STD_THREAD
//std::lock_guard<std::mutex> guard (bcache_lock);
#endif
/* A table of good hash table sizes. Whenever we grow, we pick the
next larger size from this table. sizes[i] is close to 1 << (i+10),
so we roughly double the table size each time. After we fall off
@@ -142,6 +150,9 @@ bcache::expand_hash_table ()
const void *
bcache::insert (const void *addr, int length, bool *added)
{
#if CXX_STD_THREAD
std::lock_guard<std::mutex> guard (bcache_lock);
#endif
unsigned long full_hash;
unsigned short half_hash;
int hash_index;

View File

@@ -881,7 +881,7 @@ make_blockranges (struct objfile *objfile,
size_t n = rangevec.size();
blr = (struct blockranges *)
obstack_alloc (&objfile->objfile_obstack,
obstack_alloc (objfile->objfile_obstack (),
sizeof (struct blockranges)
+ (n - 1) * sizeof (struct blockrange));

View File

@@ -211,13 +211,13 @@ buildsym_compunit::finish_block_internal
struct pending_block *opblock;
block = (is_global
? allocate_global_block (&m_objfile->objfile_obstack)
: allocate_block (&m_objfile->objfile_obstack));
? allocate_global_block (m_objfile->objfile_obstack ())
: allocate_block (m_objfile->objfile_obstack ()));
if (symbol)
{
block->set_multidict
(mdict_create_linear (&m_objfile->objfile_obstack, *listhead));
(mdict_create_linear (m_objfile->objfile_obstack (), *listhead));
}
else
{
@@ -230,7 +230,7 @@ buildsym_compunit::finish_block_internal
else
{
block->set_multidict
(mdict_create_hashed (&m_objfile->objfile_obstack, *listhead));
(mdict_create_hashed (m_objfile->objfile_obstack (), *listhead));
}
}
@@ -374,7 +374,7 @@ buildsym_compunit::finish_block_internal
(is_global
? m_global_using_directives
: m_local_using_directives),
&m_objfile->objfile_obstack);
m_objfile->objfile_obstack ());
if (is_global)
m_global_using_directives = NULL;
else
@@ -434,7 +434,7 @@ buildsym_compunit::make_blockvector ()
}
blockvector = (struct blockvector *)
obstack_alloc (&m_objfile->objfile_obstack,
obstack_alloc (m_objfile->objfile_obstack (),
(sizeof (struct blockvector)
+ (i - 1) * sizeof (struct block *)));
@@ -454,8 +454,8 @@ buildsym_compunit::make_blockvector ()
blockvector. */
if (m_pending_addrmap_interesting)
blockvector->set_map
(new (&m_objfile->objfile_obstack) addrmap_fixed
(&m_objfile->objfile_obstack, &m_pending_addrmap));
(new (m_objfile->objfile_obstack ()) addrmap_fixed
(m_objfile->objfile_obstack (), &m_pending_addrmap));
else
blockvector->set_map (nullptr);
@@ -939,7 +939,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
int linetablesize = sizeof (struct linetable) + entry_array_size;
symtab->set_linetable
(XOBNEWVAR (&m_objfile->objfile_obstack, struct linetable,
(XOBNEWVAR (m_objfile->objfile_obstack (), struct linetable,
linetablesize));
symtab->linetable ()->nitems = n_entries;
@@ -966,7 +966,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
if (!m_comp_dir.empty ())
{
/* Reallocate the dirname on the symbol obstack. */
cu->set_dirname (obstack_strdup (&m_objfile->objfile_obstack,
cu->set_dirname (obstack_strdup (m_objfile->objfile_obstack (),
m_comp_dir.c_str ()));
}

View File

@@ -1561,13 +1561,13 @@ process_coff_symbol (struct coff_symbol *cs,
union internal_auxent *aux,
struct objfile *objfile)
{
struct symbol *sym = new (&objfile->objfile_obstack) symbol;
struct symbol *sym = new (objfile->objfile_obstack ()) symbol;
char *name;
name = cs->c_name;
name = EXTERNAL_NAME (name, objfile->obfd);
sym->set_language (get_current_subfile ()->language,
&objfile->objfile_obstack);
objfile->objfile_obstack ());
sym->compute_and_set_names (name, true, objfile->per_bfd);
/* default assumptions */
@@ -2014,7 +2014,7 @@ coff_read_struct_type (int index, int length, int lastsym,
list = newobj;
/* Save the data. */
list->field.set_name (obstack_strdup (&objfile->objfile_obstack,
list->field.set_name (obstack_strdup (objfile->objfile_obstack (),
name));
list->field.set_type (decode_type (ms, ms->c_type, &sub_aux,
objfile));
@@ -2031,7 +2031,7 @@ coff_read_struct_type (int index, int length, int lastsym,
list = newobj;
/* Save the data. */
list->field.set_name (obstack_strdup (&objfile->objfile_obstack,
list->field.set_name (obstack_strdup (objfile->objfile_obstack (),
name));
list->field.set_type (decode_type (ms, ms->c_type, &sub_aux,
objfile));
@@ -2100,9 +2100,9 @@ coff_read_enum_type (int index, int length, int lastsym,
switch (ms->c_sclass)
{
case C_MOE:
sym = new (&objfile->objfile_obstack) symbol;
sym = new (objfile->objfile_obstack ()) symbol;
name = obstack_strdup (&objfile->objfile_obstack, name);
name = obstack_strdup (objfile->objfile_obstack (), name);
sym->set_linkage_name (name);
sym->set_aclass_index (LOC_CONST);
sym->set_domain (VAR_DOMAIN);

View File

@@ -693,7 +693,7 @@ compile_object_load (const compile_file_names &file_names,
/* The memory may be later needed
by bfd_generic_get_relocated_section_contents
called from default_symfile_relocate. */
symbol_table = (asymbol **) obstack_alloc (&objfile->objfile_obstack,
symbol_table = (asymbol **) obstack_alloc (objfile->objfile_obstack (),
storage_needed);
number_of_symbols = bfd_canonicalize_symtab (abfd.get (), symbol_table);
if (number_of_symbols < 0)

View File

@@ -97,7 +97,7 @@ cp_scan_for_anonymous_namespaces (struct buildsym_compunit *compunit,
std::vector<const char *> excludes;
add_using_directive (compunit->get_local_using_directives (),
dest, src, NULL, NULL, excludes,
1, &objfile->objfile_obstack);
1, objfile->objfile_obstack ());
}
/* The "+ 2" is for the "::". */
previous_component = next_component + 2;

View File

@@ -257,7 +257,7 @@ set_tid_type (struct objfile *of, ctf_id_t tid, struct type *typ)
ids.type = typ;
slot = (struct ctf_tid_and_type **) htab_find_slot (htab, &ids, INSERT);
if (*slot == nullptr)
*slot = XOBNEW (&of->objfile_obstack, struct ctf_tid_and_type);
*slot = XOBNEW (of->objfile_obstack (), struct ctf_tid_and_type);
**slot = ids;
return typ;
}
@@ -445,10 +445,10 @@ ctf_add_enum_member_cb (const char *name, int enum_value, void *arg)
if (name != nullptr)
{
struct symbol *sym = new (&ccp->of->objfile_obstack) symbol;
struct symbol *sym = new (ccp->of->objfile_obstack ()) symbol;
OBJSTAT (ccp->of, n_syms++);
sym->set_language (language_c, &ccp->of->objfile_obstack);
sym->set_language (language_c, ccp->of->objfile_obstack ());
sym->compute_and_set_names (name, false, ccp->of->per_bfd);
sym->set_aclass_index (LOC_CONST);
sym->set_domain (VAR_DOMAIN);
@@ -474,10 +474,10 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid)
const char *name = ctf_type_name_raw (fp, tid);
if (name != nullptr)
{
sym = new (&objfile->objfile_obstack) symbol;
sym = new (objfile->objfile_obstack ()) symbol;
OBJSTAT (objfile, n_syms++);
sym->set_language (language_c, &objfile->objfile_obstack);
sym->set_language (language_c, objfile->objfile_obstack ());
sym->compute_and_set_names (name, false, objfile->per_bfd);
sym->set_domain (VAR_DOMAIN);
sym->set_aclass_index (LOC_OPTIMIZED_OUT);
@@ -928,7 +928,7 @@ read_typedef_type (struct ctf_context *ccp, ctf_id_t tid,
struct objfile *objfile = ccp->of;
struct type *this_type, *target_type;
char *aname = obstack_strdup (&objfile->objfile_obstack, name);
char *aname = obstack_strdup (objfile->objfile_obstack (), name);
this_type = init_type (objfile, TYPE_CODE_TYPEDEF, 0, aname);
set_tid_type (objfile, tid, this_type);
target_type = fetch_tid_type (ccp, btid);
@@ -1167,7 +1167,7 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg)
complaint (_("ctf_add_var_cb: %s has NO type (%ld)"), name, id);
type = objfile_type (ccp->of)->builtin_error;
}
sym = new (&ccp->of->objfile_obstack) symbol;
sym = new (ccp->of->objfile_obstack ()) symbol;
OBJSTAT (ccp->of, n_syms++);
sym->set_type (type);
sym->set_domain (VAR_DOMAIN);
@@ -1203,7 +1203,7 @@ add_stt_entries (struct ctf_context *ccp, int functions)
type = get_tid_type (ccp->of, tid);
if (type == nullptr)
continue;
sym = new (&ccp->of->objfile_obstack) symbol;
sym = new (ccp->of->objfile_obstack ()) symbol;
OBJSTAT (ccp->of, n_syms++);
sym->set_type (type);
sym->set_domain (VAR_DOMAIN);

View File

@@ -669,7 +669,7 @@ dbx_symfile_init (struct objfile *objfile)
DBX_STRINGTAB_SIZE (objfile));
DBX_STRINGTAB (objfile) =
(char *) obstack_alloc (&objfile->objfile_obstack,
(char *) obstack_alloc (objfile->objfile_obstack (),
DBX_STRINGTAB_SIZE (objfile));
OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile));
@@ -1440,7 +1440,7 @@ read_dbx_symtab (minimal_symbol_reader &reader,
if (new_name != nullptr)
{
sym_len = strlen (new_name.get ());
sym_name = obstack_strdup (&objfile->objfile_obstack,
sym_name = obstack_strdup (objfile->objfile_obstack (),
new_name.get ());
}
}
@@ -1945,7 +1945,7 @@ start_psymtab (psymtab_storage *partial_symtabs, struct objfile *objfile,
objfile->per_bfd, textlow);
result->read_symtab_private =
XOBNEW (&objfile->objfile_obstack, struct symloc);
XOBNEW (objfile->objfile_obstack (), struct symloc);
LDSYMOFF (result) = ldsymoff;
result->legacy_read_symtab = dbx_read_symtab;
result->legacy_expand_psymtab = dbx_expand_psymtab;
@@ -2068,7 +2068,7 @@ dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
new legacy_psymtab (include_list[i], partial_symtabs, objfile->per_bfd);
subpst->read_symtab_private =
XOBNEW (&objfile->objfile_obstack, struct symloc);
XOBNEW (objfile->objfile_obstack (), struct symloc);
LDSYMOFF (subpst) =
LDSYMLEN (subpst) = 0;
@@ -2452,7 +2452,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
/* For C++, set the block's scope. */
if (cstk.name->language () == language_cplus)
cp_set_block_scope (cstk.name, block, &objfile->objfile_obstack);
cp_set_block_scope (cstk.name, block, objfile->objfile_obstack ());
/* May be switching to an assembler file which may not be using
block relative stabs, so reset the offset. */
@@ -2819,7 +2819,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
/* For C++, set the block's scope. */
if (cstk.name->language () == language_cplus)
cp_set_block_scope (cstk.name, block,
&objfile->objfile_obstack);
objfile->objfile_obstack ());
}
newobj = push_context (0, valu);
@@ -2949,7 +2949,7 @@ coffstab_build_psymtabs (struct objfile *objfile,
if (stabstrsize > bfd_get_size (sym_bfd))
error (_("ridiculous string table size: %d bytes"), stabstrsize);
DBX_STRINGTAB (objfile) = (char *)
obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1);
obstack_alloc (objfile->objfile_obstack (), stabstrsize + 1);
OBJSTAT (objfile, sz_strtab += stabstrsize + 1);
/* Now read in the string table in one big gulp. */
@@ -3042,7 +3042,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
if (stabstrsize > bfd_get_size (sym_bfd))
error (_("ridiculous string table size: %d bytes"), stabstrsize);
DBX_STRINGTAB (objfile) = (char *)
obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1);
obstack_alloc (objfile->objfile_obstack (), stabstrsize + 1);
OBJSTAT (objfile, sz_strtab += stabstrsize + 1);
/* Now read in the string table in one big gulp. */
@@ -3137,7 +3137,7 @@ stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
error (_("ridiculous string table size: %d bytes"),
DBX_STRINGTAB_SIZE (objfile));
DBX_STRINGTAB (objfile) = (char *)
obstack_alloc (&objfile->objfile_obstack,
obstack_alloc (objfile->objfile_obstack (),
DBX_STRINGTAB_SIZE (objfile) + 1);
OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile) + 1);

View File

@@ -21,6 +21,7 @@
#include "dwarf2/cu.h"
#include "dwarf2/read.h"
#include "objfiles.h"
#include "gdbsupport/thread-pool.h"
/* Initialize dwarf2_cu to read PER_CU, in the context of PER_OBJFILE. */
@@ -161,8 +162,8 @@ dwarf2_cu::get_builder ()
if (m_builder != nullptr)
return m_builder.get ();
if (per_objfile->sym_cu != nullptr)
return per_objfile->sym_cu->m_builder.get ();
if (per_objfile->sym_cu[gdb::thread_pool::id()] != nullptr)
return per_objfile->sym_cu[gdb::thread_pool::id()]->m_builder.get ();
gdb_assert_not_reached ("");
}

View File

@@ -7067,6 +7067,13 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
using iter_type = decltype (per_bfd->all_comp_units.begin ());
std::function<unsigned int (iter_type)> task_size
= [=] (iter_type iter)
{
dwarf2_per_cu_data *per_cu = iter->get ();
return per_cu->length ();
};
/* Each thread returns a pair holding a cooked index, and a vector
of errors that should be printed. The latter is done because
GDB's I/O system is not thread-safe. run_on_main_thread could be
@@ -7095,7 +7102,7 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
}
}
return result_type (thread_storage.release (), std::move (errors));
});
}, &task_size);
/* Only show a given exception a single time. */
std::unordered_set<gdb_exception> seen_exceptions;
@@ -7479,7 +7486,7 @@ queue_comp_unit (dwarf2_per_cu_data *per_cu,
per_cu->queued = 1;
gdb_assert (per_objfile->queue.has_value ());
per_objfile->queue->emplace (per_cu, per_objfile, pretend_language);
per_objfile->queue->emplace_back (per_cu, per_objfile, pretend_language);
}
/* If PER_CU is not yet expanded of queued for expansion, add it to the queue.
@@ -7552,65 +7559,106 @@ maybe_queue_comp_unit (struct dwarf2_cu *dependent_cu,
return queued && cu == nullptr;
}
/* Process a queue item ITEM, helper function of process_queue. */
static void
process_queue_item (dwarf2_per_objfile *per_objfile, dwarf2_queue_item &item)
{
dwarf2_per_cu_data *per_cu = item.per_cu;
if (per_objfile->symtab_set_p (per_cu))
/* Nothing to do. */
return;
dwarf2_cu *cu = per_objfile->get_cu (per_cu);
if (cu == nullptr)
/* Skip dummy CUs. */
return;
unsigned int debug_print_threshold;
char buf[100];
if (per_cu->is_debug_types)
{
struct signatured_type *sig_type =
(struct signatured_type *) per_cu;
sprintf (buf, "TU %s at offset %s",
hex_string (sig_type->signature),
sect_offset_str (per_cu->sect_off));
/* There can be 100s of TUs.
Only print them in verbose mode. */
debug_print_threshold = 2;
}
else
{
sprintf (buf, "CU at offset %s",
sect_offset_str (per_cu->sect_off));
debug_print_threshold = 1;
}
if (dwarf_read_debug >= debug_print_threshold)
dwarf_read_debug_printf ("Expanding symtab of %s", buf);
if (per_cu->is_debug_types)
process_full_type_unit (cu, item.pretend_language);
else
process_full_comp_unit (cu, item.pretend_language);
if (dwarf_read_debug >= debug_print_threshold)
dwarf_read_debug_printf ("Done expanding %s", buf);
}
/* Process the queue. */
static void
process_queue (dwarf2_per_objfile *per_objfile)
{
if (per_objfile->queue->empty ())
return;
dwarf_read_debug_printf ("Expanding one or more symtabs of objfile %s ...",
objfile_name (per_objfile->objfile));
using iter_type = decltype (per_objfile->queue->begin ());
using result_type = int;
std::function<unsigned int (iter_type)> task_size
= [=] (iter_type iter)
{
dwarf2_queue_item &item = *iter;
dwarf2_per_cu_data *per_cu = item.per_cu;
return per_cu->length ();
};
/* The queue starts out with one item, but following a DIE reference
may load a new CU, adding it to the end of the queue. */
while (!per_objfile->queue->empty ())
{
dwarf2_queue_item &item = per_objfile->queue->front ();
dwarf2_per_cu_data *per_cu = item.per_cu;
size_t nr_to_be_processed = per_objfile->queue->size ();
if (!per_objfile->symtab_set_p (per_cu))
std::vector<result_type> results
= gdb::parallel_for_each (1, per_objfile->queue->begin (),
per_objfile->queue->end (),
[=] (iter_type iter, iter_type end)
{
dwarf2_cu *cu = per_objfile->get_cu (per_cu);
/* Skip dummy CUs. */
if (cu != nullptr)
for (; iter != end; ++iter)
{
unsigned int debug_print_threshold;
char buf[100];
if (per_cu->is_debug_types)
{
struct signatured_type *sig_type =
(struct signatured_type *) per_cu;
sprintf (buf, "TU %s at offset %s",
hex_string (sig_type->signature),
sect_offset_str (per_cu->sect_off));
/* There can be 100s of TUs.
Only print them in verbose mode. */
debug_print_threshold = 2;
}
else
{
sprintf (buf, "CU at offset %s",
sect_offset_str (per_cu->sect_off));
debug_print_threshold = 1;
}
if (dwarf_read_debug >= debug_print_threshold)
dwarf_read_debug_printf ("Expanding symtab of %s", buf);
if (per_cu->is_debug_types)
process_full_type_unit (cu, item.pretend_language);
else
process_full_comp_unit (cu, item.pretend_language);
if (dwarf_read_debug >= debug_print_threshold)
dwarf_read_debug_printf ("Done expanding %s", buf);
dwarf2_queue_item &item = *iter;
process_queue_item (per_objfile, item);
}
}
per_cu->queued = 0;
per_objfile->queue->pop ();
return result_type (1);
}, &task_size);
for (int i = 0; i < nr_to_be_processed; ++i)
{
dwarf2_queue_item &item = per_objfile->queue->front ();
dwarf2_per_cu_data *per_cu = item.per_cu;
per_cu->queued = 0;
per_objfile->queue->pop_front ();
}
}
dwarf_read_debug_printf ("Done expanding symtabs of %s.",
@@ -7831,8 +7879,8 @@ fixup_go_packaging (struct dwarf2_cu *cu)
saved_package_name);
struct symbol *sym;
sym = new (&objfile->objfile_obstack) symbol;
sym->set_language (language_go, &objfile->objfile_obstack);
sym = new (objfile->objfile_obstack ()) symbol;
sym->set_language (language_go, objfile->objfile_obstack ());
sym->compute_and_set_names (saved_package_name, false, objfile->per_bfd);
/* This is not VAR_DOMAIN because we want a way to ensure a lookup of,
e.g., "main" finds the "main" module and not C's main(). */
@@ -8009,11 +8057,11 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
type->field (1).set_name
(rust_last_path_segment (type->field (1).type ()->name ()));
type->field (1).type ()->set_name
(rust_fully_qualify (&objfile->objfile_obstack, type->name (),
(rust_fully_qualify (objfile->objfile_obstack (), type->name (),
type->field (1).name ()));
const char *dataless_name
= rust_fully_qualify (&objfile->objfile_obstack, type->name (),
= rust_fully_qualify (objfile->objfile_obstack (), type->name (),
name);
struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0,
dataless_name);
@@ -8025,7 +8073,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
/* Indicate that this is a variant type. */
static discriminant_range ranges[1] = { { 0, 0 } };
alloc_rust_variant (&objfile->objfile_obstack, type, 0, 1, ranges);
alloc_rust_variant (objfile->objfile_obstack (), type, 0, 1, ranges);
}
/* A union with a single anonymous field is probably an old-style
univariant enum. */
@@ -8040,10 +8088,10 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
= rust_last_path_segment (field_type->name ());
type->field (0).set_name (variant_name);
field_type->set_name
(rust_fully_qualify (&objfile->objfile_obstack,
(rust_fully_qualify (objfile->objfile_obstack (),
type->name (), variant_name));
alloc_rust_variant (&objfile->objfile_obstack, type, -1, 0, {});
alloc_rust_variant (objfile->objfile_obstack (), type, -1, 0, {});
}
else
{
@@ -8117,7 +8165,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
/* We don't need a range entry for the discriminant, but we do
need one for every other field, as there is no default
variant. */
discriminant_range *ranges = XOBNEWVEC (&objfile->objfile_obstack,
discriminant_range *ranges = XOBNEWVEC (objfile->objfile_obstack (),
discriminant_range,
n_fields - 1);
/* Skip the discriminant here. */
@@ -8149,12 +8197,12 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
}
type->field (i).set_name (variant_name);
sub_type->set_name
(rust_fully_qualify (&objfile->objfile_obstack,
(rust_fully_qualify (objfile->objfile_obstack (),
type->name (), variant_name));
}
/* Indicate that this is a variant type. */
alloc_rust_variant (&objfile->objfile_obstack, type, 0, -1,
alloc_rust_variant (objfile->objfile_obstack (), type, 0, -1,
gdb::array_view<discriminant_range> (ranges,
n_fields - 1));
}
@@ -8295,7 +8343,7 @@ compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu,
/* Now we have a transitive closure of all the included symtabs. */
len = result_symtabs.size ();
cust->includes
= XOBNEWVEC (&per_objfile->objfile->objfile_obstack,
= XOBNEWVEC (per_objfile->objfile->objfile_obstack (),
struct compunit_symtab *, len + 1);
memcpy (cust->includes, result_symtabs.data (),
len * sizeof (compunit_symtab *));
@@ -8423,8 +8471,14 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language)
per_objfile->set_symtab (cu->per_cu, cust);
/* Push it for inclusion processing later. */
per_objfile->per_bfd->just_read_cus.push_back (cu->per_cu);
#if CXX_STD_THREAD
{
static std::mutex just_read_cus_lock;
std::lock_guard<std::mutex> guard (just_read_cus_lock);
#endif
/* Push it for inclusion processing later. */
per_objfile->per_bfd->just_read_cus.push_back (cu->per_cu);
}
/* Not needed any more. */
cu->reset_builder ();
@@ -9311,7 +9365,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
canonical_name = imported_name_prefix;
}
else if (strlen (imported_name_prefix) > 0)
canonical_name = obconcat (&objfile->objfile_obstack,
canonical_name = obconcat (objfile->objfile_obstack (),
imported_name_prefix,
(cu->lang () == language_d
? "."
@@ -9372,7 +9426,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
imported_declaration,
excludes,
0,
&objfile->objfile_obstack);
objfile->objfile_obstack ());
}
/* ICC<14 does not output the required DW_AT_declaration on incomplete
@@ -9563,9 +9617,9 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
cu->start_compunit_symtab (fnd.get_name (), fnd.intern_comp_dir (objfile),
lowpc);
gdb_assert (per_objfile->sym_cu == nullptr);
gdb_assert (per_objfile->sym_cu[gdb::thread_pool::id()] == nullptr);
scoped_restore restore_sym_cu
= make_scoped_restore (&per_objfile->sym_cu, cu);
= make_scoped_restore (&per_objfile->sym_cu[gdb::thread_pool::id()], cu);
/* Decode line number information if present. We do this before
processing child DIEs, so that the line header table is available
@@ -9587,7 +9641,8 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
child_die = child_die->sibling;
}
}
per_objfile->sym_cu = nullptr;
per_objfile->sym_cu[gdb::thread_pool::id()] = nullptr;
/* Decode macro information, if present. Dwarf 2 macro information
refers to information in the line number info statement program
@@ -9683,7 +9738,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
time. */
tug_unshare->symtabs
= XOBNEWVEC (&cust->objfile ()->objfile_obstack,
= XOBNEWVEC (cust->objfile ()->objfile_obstack (),
struct symtab *, line_header->file_names_size ());
auto &file_names = line_header->file_names ();
@@ -11986,7 +12041,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
if (child_die->tag == DW_TAG_template_type_param
|| child_die->tag == DW_TAG_template_value_param)
{
templ_func = new (&objfile->objfile_obstack) template_symbol;
templ_func = new (objfile->objfile_obstack ()) template_symbol;
templ_func->subclass = SYMBOL_TEMPLATE;
break;
}
@@ -12013,7 +12068,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
if (attr != nullptr)
{
newobj->static_link
= XOBNEW (&objfile->objfile_obstack, struct dynamic_prop);
= XOBNEW (objfile->objfile_obstack (), struct dynamic_prop);
attr_to_dynamic_prop (attr, die, cu, newobj->static_link,
cu->addr_type ());
}
@@ -12078,7 +12133,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
|| cu->lang () == language_rust)
&& cu->processing_has_namespace_info)
block_set_scope (block, determine_prefix (die, cu),
&objfile->objfile_obstack);
objfile->objfile_obstack ());
/* If we have address ranges, record them. */
dwarf2_record_block_ranges (die, block, baseaddr, cu);
@@ -12092,7 +12147,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
templ_func->n_template_arguments = template_args.size ();
templ_func->template_arguments
= XOBNEWVEC (&objfile->objfile_obstack, struct symbol *,
= XOBNEWVEC (objfile->objfile_obstack (), struct symbol *,
templ_func->n_template_arguments);
memcpy (templ_func->template_arguments,
template_args.data (),
@@ -12242,7 +12297,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
if (cu->call_site_htab == NULL)
cu->call_site_htab = htab_create_alloc_ex (16, call_site::hash,
call_site::eq, NULL,
&objfile->objfile_obstack,
objfile->objfile_obstack (),
hashtab_obstack_allocate, NULL);
struct call_site call_site_local (pc, nullptr, nullptr);
slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT);
@@ -12275,7 +12330,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
}
struct call_site *call_site
= new (XOBNEWVAR (&objfile->objfile_obstack,
= new (XOBNEWVAR (objfile->objfile_obstack (),
struct call_site,
sizeof (*call_site) + sizeof (call_site->parameter[0]) * nparams))
struct call_site (pc, cu->per_cu, per_objfile);
@@ -12353,7 +12408,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
struct dwarf2_locexpr_baton *dlbaton;
struct dwarf_block *block = attr->as_block ();
dlbaton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton);
dlbaton = XOBNEW (objfile->objfile_obstack (), struct dwarf2_locexpr_baton);
dlbaton->data = block->data;
dlbaton->size = block->size;
dlbaton->per_objfile = per_objfile;
@@ -12394,7 +12449,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
std::vector<CORE_ADDR> addresses;
dwarf2_ranges_read_low_addrs (ranges_offset, target_cu,
target_die->tag, addresses);
CORE_ADDR *saved = XOBNEWVAR (&objfile->objfile_obstack, CORE_ADDR,
CORE_ADDR *saved = XOBNEWVAR (objfile->objfile_obstack (), CORE_ADDR,
addresses.size ());
std::copy (addresses.begin (), addresses.end (), saved);
call_site->target.set_loc_array (addresses.size (), saved);
@@ -12583,7 +12638,7 @@ read_variable (struct die_info *die, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->per_objfile->objfile;
storage = new (&objfile->objfile_obstack) rust_vtable_symbol;
storage = new (objfile->objfile_obstack ()) rust_vtable_symbol;
storage->concrete_type = containing_type;
storage->subclass = SYMBOL_RUST_VTABLE;
}
@@ -13420,7 +13475,7 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct objfile *objfile = per_objfile->objfile;
struct dwarf2_locexpr_baton *dlbaton
= XOBNEW (&objfile->objfile_obstack,
= XOBNEW (objfile->objfile_obstack (),
struct dwarf2_locexpr_baton);
dlbaton->data = attr->as_block ()->data;
dlbaton->size = attr->as_block ()->size;
@@ -13869,12 +13924,12 @@ add_variant_property (struct field_info *fip, struct type *type,
struct objfile *objfile = cu->per_objfile->objfile;
gdb::array_view<const variant_part> parts
= create_variant_parts (&objfile->objfile_obstack, offset_map, fip,
= create_variant_parts (objfile->objfile_obstack (), offset_map, fip,
fip->variant_parts);
struct dynamic_prop prop;
prop.set_variant_parts ((gdb::array_view<variant_part> *)
obstack_copy (&objfile->objfile_obstack, &parts,
obstack_copy (objfile->objfile_obstack (), &parts,
sizeof (parts)));
type->add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop);
@@ -14842,7 +14897,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
ALLOCATE_CPLUS_STRUCT_TYPE (type);
TYPE_N_TEMPLATE_ARGUMENTS (type) = template_args.size ();
TYPE_TEMPLATE_ARGUMENTS (type)
= XOBNEWVEC (&objfile->objfile_obstack,
= XOBNEWVEC (objfile->objfile_obstack (),
struct symbol *,
TYPE_N_TEMPLATE_ARGUMENTS (type));
memcpy (TYPE_TEMPLATE_ARGUMENTS (type),
@@ -15771,7 +15826,7 @@ mark_common_block_symbol_computed (struct symbol *sym,
gdb_assert (member_loc->form_is_block ()
|| member_loc->form_is_constant ());
baton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton);
baton = XOBNEW (objfile->objfile_obstack (), struct dwarf2_locexpr_baton);
baton->per_objfile = per_objfile;
baton->per_cu = cu->per_cu;
gdb_assert (baton->per_cu);
@@ -15786,7 +15841,7 @@ mark_common_block_symbol_computed (struct symbol *sym,
else
baton->size += member_loc->as_block ()->size;
ptr = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, baton->size);
ptr = (gdb_byte *) obstack_alloc (objfile->objfile_obstack (), baton->size);
baton->data = ptr;
*ptr++ = DW_OP_call4;
@@ -15864,7 +15919,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
size = (sizeof (struct common_block)
+ (n_entries - 1) * sizeof (struct symbol *));
common_block
= (struct common_block *) obstack_alloc (&objfile->objfile_obstack,
= (struct common_block *) obstack_alloc (objfile->objfile_obstack (),
size);
memset (common_block->contents, 0, n_entries * sizeof (struct symbol *));
common_block->n_entries = 0;
@@ -15946,7 +16001,7 @@ read_namespace_type (struct die_info *die, struct dwarf2_cu *cu)
previous_prefix = determine_prefix (die, cu);
if (previous_prefix[0] != '\0')
name = typename_concat (&objfile->objfile_obstack,
name = typename_concat (objfile->objfile_obstack (),
previous_prefix, name, 0, cu);
/* Create the type. */
@@ -15982,7 +16037,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
std::vector<const char *> excludes;
add_using_directive (using_directives (cu),
previous_prefix, type->name (), NULL,
NULL, excludes, 0, &objfile->objfile_obstack);
NULL, excludes, 0, objfile->objfile_obstack ());
}
}
@@ -17121,7 +17176,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
{
gdb_assert (startswith (gnat_encoding_suffix,
GNAT_FIXED_POINT_SUFFIX));
name = obstack_strndup (&cu->per_objfile->objfile->objfile_obstack,
name = obstack_strndup (cu->per_objfile->objfile->objfile_obstack (),
name, gnat_encoding_suffix - name);
/* Use -1 here so that SUFFIX points at the "_" after the
"XF". */
@@ -17151,7 +17206,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
if (name == nullptr)
{
struct obstack *obstack
= &cu->per_objfile->objfile->objfile_obstack;
= cu->per_objfile->objfile->objfile_obstack ();
name = obconcat (obstack, "_Complex ", type->name (),
nullptr);
}
@@ -17282,7 +17337,7 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
struct dwarf2_property_baton *baton;
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct objfile *objfile = per_objfile->objfile;
struct obstack *obstack = &objfile->objfile_obstack;
struct obstack *obstack = objfile->objfile_obstack ();
gdb_assert (default_type != NULL);
@@ -20675,11 +20730,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
if (space)
sym = space;
else
sym = new (&objfile->objfile_obstack) symbol;
sym = new (objfile->objfile_obstack ()) symbol;
OBJSTAT (objfile, n_syms++);
/* Cache this symbol's name and the name's demangled form (if any). */
sym->set_language (cu->lang (), &objfile->objfile_obstack);
sym->set_language (cu->lang (), objfile->objfile_obstack ());
/* Fortran does not have mangling standard and the mangling does differ
between gfortran, iFort etc. */
const char *physname
@@ -20692,7 +20747,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
sym->set_linkage_name (physname);
else
{
sym->set_demangled_name (physname, &objfile->objfile_obstack);
sym->set_demangled_name (physname, objfile->objfile_obstack ());
sym->set_linkage_name (linkagename);
}
@@ -21051,6 +21106,10 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
if (suppress_add)
{
#if CXX_STD_THREAD
static std::mutex template_symbols_lock;
std::lock_guard<std::mutex> guard (template_symbols_lock);
#endif
sym->hash_next = objfile->template_symbols;
objfile->template_symbols = sym;
list_to_add = NULL;
@@ -21227,7 +21286,7 @@ dwarf2_const_value (const struct attribute *attr, struct symbol *sym,
dwarf2_const_value_attr (attr, sym->type (),
sym->print_name (),
&objfile->objfile_obstack, cu,
objfile->objfile_obstack (), cu,
&value, &bytes, &baton);
if (baton != NULL)
@@ -21340,11 +21399,15 @@ build_error_marker_type (struct dwarf2_cu *cu, struct die_info *die)
objfile_name (objfile),
sect_offset_str (cu->header.sect_off),
sect_offset_str (die->sect_off));
saved = obstack_strdup (&objfile->objfile_obstack, message);
saved = obstack_strdup (objfile->objfile_obstack (), message);
return init_type (objfile, TYPE_CODE_ERROR, 0, saved);
}
#if CXX_STD_THREAD
static std::recursive_mutex lookup_die_type_lock;
#endif
/* Look up the type of DIE in CU using its type attribute ATTR.
ATTR must be one of: DW_AT_type, DW_AT_GNAT_descriptive_type,
DW_AT_containing_type.
@@ -21354,6 +21417,9 @@ static struct type *
lookup_die_type (struct die_info *die, const struct attribute *attr,
struct dwarf2_cu *cu)
{
#if CXX_STD_THREAD
std::lock_guard<std::recursive_mutex> guard (lookup_die_type_lock);
#endif
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct objfile *objfile = per_objfile->objfile;
struct type *this_type;
@@ -21430,6 +21496,9 @@ lookup_die_type (struct die_info *die, const struct attribute *attr,
static struct type *
read_type_die (struct die_info *die, struct dwarf2_cu *cu)
{
#if CXX_STD_THREAD
std::lock_guard<std::recursive_mutex> guard (lookup_die_type_lock);
#endif
struct type *this_type;
this_type = get_die_type (die, cu);
@@ -23327,7 +23396,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
{
struct dwarf2_loclist_baton *baton;
baton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_loclist_baton);
baton = XOBNEW (objfile->objfile_obstack (), struct dwarf2_loclist_baton);
fill_in_loclist_baton (cu, baton, attr);
@@ -23344,7 +23413,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
{
struct dwarf2_locexpr_baton *baton;
baton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton);
baton = XOBNEW (objfile->objfile_obstack (), struct dwarf2_locexpr_baton);
baton->per_objfile = per_objfile;
baton->per_cu = cu->per_cu;
gdb_assert (baton->per_cu);
@@ -23732,6 +23801,10 @@ per_cu_offset_and_type_eq (const void *item_lhs, const void *item_rhs)
&& ofs_lhs->sect_off == ofs_rhs->sect_off);
}
#if CXX_STD_THREAD
static std::mutex die_type_hash_lock;
#endif
/* Set the type associated with DIE to TYPE. Save it in CU's hash
table if necessary. For convenience, return TYPE.
@@ -23754,6 +23827,9 @@ static struct type *
set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
bool skip_data_location)
{
#if CXX_STD_THREAD
std::lock_guard<std::recursive_mutex> guard (lookup_die_type_lock);
#endif
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct dwarf2_per_cu_offset_and_type **slot, ofs;
struct objfile *objfile = per_objfile->objfile;
@@ -23812,25 +23888,30 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
type->add_dyn_prop (DYN_PROP_DATA_LOCATION, prop);
}
if (per_objfile->die_type_hash == NULL)
per_objfile->die_type_hash
= htab_up (htab_create_alloc (127,
per_cu_offset_and_type_hash,
per_cu_offset_and_type_eq,
NULL, xcalloc, xfree));
{
#if CXX_STD_THREAD
std::lock_guard<std::mutex> guard2 (die_type_hash_lock);
#endif
if (per_objfile->die_type_hash == NULL)
per_objfile->die_type_hash
= htab_up (htab_create_alloc (127,
per_cu_offset_and_type_hash,
per_cu_offset_and_type_eq,
NULL, xcalloc, xfree));
ofs.per_cu = cu->per_cu;
ofs.sect_off = die->sect_off;
ofs.type = type;
slot = (struct dwarf2_per_cu_offset_and_type **)
htab_find_slot (per_objfile->die_type_hash.get (), &ofs, INSERT);
if (*slot)
complaint (_("A problem internal to GDB: DIE %s has type already set"),
sect_offset_str (die->sect_off));
*slot = XOBNEW (&objfile->objfile_obstack,
struct dwarf2_per_cu_offset_and_type);
**slot = ofs;
return type;
ofs.per_cu = cu->per_cu;
ofs.sect_off = die->sect_off;
ofs.type = type;
slot = (struct dwarf2_per_cu_offset_and_type **)
htab_find_slot (per_objfile->die_type_hash.get (), &ofs, INSERT);
if (*slot)
complaint (_("A problem internal to GDB: DIE %s has type already set"),
sect_offset_str (die->sect_off));
*slot = XOBNEW (objfile->objfile_obstack (),
struct dwarf2_per_cu_offset_and_type);
**slot = ofs;
return type;
}
}
/* Look up the type for the die at SECT_OFF in PER_CU in die_type_hash,
@@ -23841,6 +23922,10 @@ get_die_type_at_offset (sect_offset sect_off,
dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile)
{
#if CXX_STD_THREAD
std::lock_guard<std::mutex> guard (die_type_hash_lock);
#endif
struct dwarf2_per_cu_offset_and_type *slot, ofs;
if (per_objfile->die_type_hash == NULL)

View File

@@ -20,7 +20,7 @@
#ifndef DWARF2READ_H
#define DWARF2READ_H
#include <queue>
#include <deque>
#include <unordered_map>
#include "dwarf2/comp-unit-head.h"
#include "dwarf2/cooked-index.h"
@@ -587,7 +587,12 @@ struct dwarf2_per_objfile
{
dwarf2_per_objfile (struct objfile *objfile, dwarf2_per_bfd *per_bfd)
: objfile (objfile), per_bfd (per_bfd)
{}
{
for (int i = 0;
i < gdb::thread_pool::g_thread_pool->thread_count () + 1;
++i)
sym_cu.push_back (nullptr);
}
~dwarf2_per_objfile ();
@@ -655,10 +660,10 @@ struct dwarf2_per_objfile
htab_up line_header_hash;
/* The CU containing the m_builder in scope. */
dwarf2_cu *sym_cu = nullptr;
std::vector<dwarf2_cu *> sym_cu;
/* CUs that are queued to be read. */
gdb::optional<std::queue<dwarf2_queue_item>> queue;
gdb::optional<std::deque<dwarf2_queue_item>> queue;
private:
/* Hold the corresponding compunit_symtab for each CU or TU. This

View File

@@ -164,7 +164,7 @@ dwarf2_section_info::read (struct objfile *objfile)
return;
}
buf = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, size);
buf = (gdb_byte *) obstack_alloc (objfile->objfile_obstack (), size);
buffer = buf;
/* When debugging .o files, we may need to apply relocations; see

View File

@@ -728,11 +728,11 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
}
entry_local.addr = addr;
obstack_grow (&objfile->objfile_obstack, &entry_local,
obstack_grow (objfile->objfile_obstack (), &entry_local,
offsetof (struct elf_gnu_ifunc_cache, name));
obstack_grow_str0 (&objfile->objfile_obstack, name);
obstack_grow_str0 (objfile->objfile_obstack (), name);
entry_p
= (struct elf_gnu_ifunc_cache *) obstack_finish (&objfile->objfile_obstack);
= (struct elf_gnu_ifunc_cache *) obstack_finish (objfile->objfile_obstack ());
slot = htab_find_slot (htab, entry_p, INSERT);
if (*slot != NULL)

View File

@@ -185,8 +185,8 @@ alloc_type (struct objfile *objfile)
gdb_assert (objfile != NULL);
/* Alloc the structure and start off with all fields zeroed. */
type = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct type);
TYPE_MAIN_TYPE (type) = OBSTACK_ZALLOC (&objfile->objfile_obstack,
type = OBSTACK_ZALLOC (objfile->objfile_obstack (), struct type);
TYPE_MAIN_TYPE (type) = OBSTACK_ZALLOC (objfile->objfile_obstack (),
struct main_type);
OBJSTAT (objfile, n_types++);
@@ -298,7 +298,7 @@ alloc_type_instance (struct type *oldtype)
if (!oldtype->is_objfile_owned ())
type = GDBARCH_OBSTACK_ZALLOC (oldtype->arch_owner (), struct type);
else
type = OBSTACK_ZALLOC (&oldtype->objfile_owner ()->objfile_obstack,
type = OBSTACK_ZALLOC (oldtype->objfile_owner ()->objfile_obstack (),
struct type);
TYPE_MAIN_TYPE (type) = TYPE_MAIN_TYPE (oldtype);
@@ -2411,7 +2411,7 @@ resolve_dynamic_array_or_string (struct type *type,
if (prop_list != nullptr)
{
struct obstack *obstack
= &type->objfile_owner ()->objfile_obstack;
= type->objfile_owner ()->objfile_obstack ();
TYPE_MAIN_TYPE (type)->dyn_prop_list
= copy_dynamic_prop_list (obstack, prop_list);
}
@@ -2933,7 +2933,7 @@ type::add_dyn_prop (dynamic_prop_node_kind prop_kind, dynamic_prop prop)
gdb_assert (this->is_objfile_owned ());
temp = XOBNEW (&this->objfile_owner ()->objfile_obstack,
temp = XOBNEW (this->objfile_owner ()->objfile_obstack (),
struct dynamic_prop_list);
temp->prop_kind = prop_kind;
temp->prop = prop;
@@ -5596,7 +5596,7 @@ htab_up
create_copied_types_hash (struct objfile *objfile)
{
return htab_up (htab_create_alloc_ex (1, type_pair_hash, type_pair_eq,
NULL, &objfile->objfile_obstack,
NULL, objfile->objfile_obstack (),
hashtab_obstack_allocate,
dummy_obstack_deallocate));
}
@@ -5657,7 +5657,7 @@ copy_type_recursive (struct objfile *objfile,
/* We must add the new type to the hash table immediately, in case
we encounter this type again during a recursive call below. */
struct type_pair *stored
= new (&objfile->objfile_obstack) struct type_pair (type, new_type);
= new (objfile->objfile_obstack ()) struct type_pair (type, new_type);
*slot = stored;
@@ -5736,7 +5736,7 @@ copy_type_recursive (struct objfile *objfile,
if (type->main_type->dyn_prop_list != NULL)
new_type->main_type->dyn_prop_list
= copy_dynamic_prop_list (&objfile->objfile_obstack,
= copy_dynamic_prop_list (objfile->objfile_obstack (),
type->main_type->dyn_prop_list);
@@ -5809,7 +5809,7 @@ copy_type (const struct type *type)
if (type->main_type->dyn_prop_list != NULL)
{
struct obstack *storage = (type->is_objfile_owned ()
? &type->objfile_owner ()->objfile_obstack
? type->objfile_owner ()->objfile_obstack ()
: gdbarch_obstack (type->arch_owner ()));
new_type->main_type->dyn_prop_list
= copy_dynamic_prop_list (storage, type->main_type->dyn_prop_list);
@@ -6330,7 +6330,7 @@ objfile_type (struct objfile *objfile)
if (objfile_type)
return objfile_type;
objfile_type = OBSTACK_CALLOC (&objfile->objfile_obstack,
objfile_type = OBSTACK_CALLOC (objfile->objfile_obstack (),
1, struct objfile_type);
/* Use the objfile architecture to determine basic type properties. */

View File

@@ -1488,7 +1488,9 @@ struct type
value of 1 means the alignment is 1, and a value of 9 means the
alignment is 256. */
unsigned align_log2 : TYPE_ALIGN_BITS;
struct {
unsigned align_log2 : TYPE_ALIGN_BITS;
};
/* * Flags specific to this instance of the type, indicating where
on the ring we are.
@@ -1500,7 +1502,9 @@ struct type
instance flags are completely inherited from the target type. No
qualifiers can be cleared by the typedef. See also
check_typedef. */
unsigned m_instance_flags : 9;
struct {
unsigned m_instance_flags : 9;
};
/* * Length of storage for a value of this type. The value is the
expression in host bytes of what sizeof(type) would return. This
@@ -2473,7 +2477,7 @@ extern const struct floatformat *floatformats_bfloat16[BFD_ENDIAN_UNKNOWN];
#define TYPE_ALLOC(t,size) \
(obstack_alloc (((t)->is_objfile_owned () \
? &((t)->objfile_owner ()->objfile_obstack) \
? ((t)->objfile_owner ()->objfile_obstack ()) \
: gdbarch_obstack ((t)->arch_owner ())), \
size))

View File

@@ -347,7 +347,7 @@ read_unwind_info (struct objfile *objfile)
struct hppa_objfile_private *obj_private;
text_offset = objfile->text_section_offset ();
ui = (struct hppa_unwind_info *) obstack_alloc (&objfile->objfile_obstack,
ui = (struct hppa_unwind_info *) obstack_alloc (objfile->objfile_obstack (),
sizeof (struct hppa_unwind_info));
ui->table = NULL;
@@ -397,7 +397,7 @@ read_unwind_info (struct objfile *objfile)
/* Allocate memory for the unwind table. */
ui->table = (struct unwind_table_entry *)
obstack_alloc (&objfile->objfile_obstack, total_size);
obstack_alloc (objfile->objfile_obstack (), total_size);
ui->last = total_entries - 1;
/* Now read in each unwind section and internalize the standard unwind

View File

@@ -550,13 +550,13 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
* sizeof (struct linetable_entry)
+ sizeof (struct linetable));
filetab->set_linetable ((struct linetable *)
obstack_alloc (&objfile->objfile_obstack, size));
obstack_alloc (objfile->objfile_obstack (), size));
memcpy (filetab->linetable (), stab->linetable.get (), size);
}
blockvector_size = (sizeof (struct blockvector)
+ (actual_nblocks - 1) * sizeof (struct block *));
bv = (struct blockvector *) obstack_alloc (&objfile->objfile_obstack,
bv = (struct blockvector *) obstack_alloc (objfile->objfile_obstack (),
blockvector_size);
cust->set_blockvector (bv);
@@ -573,15 +573,15 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
int block_idx = FIRST_LOCAL_BLOCK;
for (gdb_block &gdb_block_iter : stab->blocks)
{
struct block *new_block = allocate_block (&objfile->objfile_obstack);
struct symbol *block_name = new (&objfile->objfile_obstack) symbol;
struct block *new_block = allocate_block (objfile->objfile_obstack ());
struct symbol *block_name = new (objfile->objfile_obstack ()) symbol;
struct type *block_type = arch_type (objfile->arch (),
TYPE_CODE_VOID,
TARGET_CHAR_BIT,
"void");
new_block->set_multidict
(mdict_create_linear (&objfile->objfile_obstack, NULL));
(mdict_create_linear (objfile->objfile_obstack (), NULL));
/* The address range. */
new_block->set_start (gdb_block_iter.begin);
new_block->set_end (gdb_block_iter.end);
@@ -593,7 +593,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
block_name->set_type (lookup_function_type (block_type));
block_name->set_value_block (new_block);
block_name->m_name = obstack_strdup (&objfile->objfile_obstack,
block_name->m_name = obstack_strdup (objfile->objfile_obstack (),
gdb_block_iter.name.get ());
new_block->set_function (block_name);
@@ -616,10 +616,10 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
struct block *new_block;
new_block = (i == GLOBAL_BLOCK
? allocate_global_block (&objfile->objfile_obstack)
: allocate_block (&objfile->objfile_obstack));
? allocate_global_block (objfile->objfile_obstack ())
: allocate_block (objfile->objfile_obstack ()));
new_block->set_multidict
(mdict_create_linear (&objfile->objfile_obstack, NULL));
(mdict_create_linear (objfile->objfile_obstack (), NULL));
new_block->set_superblock (block_iter);
block_iter = new_block;

View File

@@ -350,7 +350,7 @@ mdebug_build_psymtabs (minimal_symbol_reader &reader,
char *fdr_end;
FDR *fdr_ptr;
info->fdr = (FDR *) XOBNEWVEC (&objfile->objfile_obstack, FDR,
info->fdr = (FDR *) XOBNEWVEC (objfile->objfile_obstack (), FDR,
info->symbolic_header.ifdMax);
fdr_src = (char *) info->external_fdr;
fdr_end = (fdr_src
@@ -503,7 +503,7 @@ add_pending (FDR *fh, char *sh, struct type *t)
/* Make sure we do not make duplicates. */
if (!p)
{
p = XOBNEW (&mdebugread_objfile->objfile_obstack, mdebug_pending);
p = XOBNEW (mdebugread_objfile->objfile_obstack (), mdebug_pending);
p->s = sh;
p->t = t;
p->next = pending_list[f_idx];
@@ -1018,7 +1018,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
if (sh->iss == 0 || name[0] == '.' || name[0] == '\0')
t->set_name (NULL);
else
t->set_name (obconcat (&mdebugread_objfile->objfile_obstack,
t->set_name (obconcat (mdebugread_objfile->objfile_obstack (),
name, (char *) NULL));
t->set_code (type_code);
@@ -1061,9 +1061,9 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
f->set_name (debug_info->ss + cur_fdr->issBase + tsym.iss);
FIELD_BITSIZE (*f) = 0;
enum_sym = new (&mdebugread_objfile->objfile_obstack) symbol;
enum_sym = new (mdebugread_objfile->objfile_obstack ()) symbol;
enum_sym->set_linkage_name
(obstack_strdup (&mdebugread_objfile->objfile_obstack,
(obstack_strdup (mdebugread_objfile->objfile_obstack (),
f->name ()));
enum_sym->set_aclass_index (LOC_CONST);
enum_sym->set_type (t);
@@ -1157,7 +1157,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
s->set_domain (LABEL_DOMAIN);
s->set_aclass_index (LOC_CONST);
s->set_type (objfile_type (mdebugread_objfile)->builtin_void);
e = OBSTACK_ZALLOC (&mdebugread_objfile->objfile_obstack,
e = OBSTACK_ZALLOC (mdebugread_objfile->objfile_obstack (),
mdebug_extra_func_info);
s->set_value_bytes ((gdb_byte *) e);
e->numargs = top_stack->numargs;
@@ -1370,7 +1370,7 @@ basic_type (int bt, struct objfile *objfile)
if (!map_bt)
{
map_bt = OBSTACK_CALLOC (&objfile->objfile_obstack,
map_bt = OBSTACK_CALLOC (objfile->objfile_obstack (),
btMax, struct type *);
basic_type_data.set (objfile, map_bt);
}
@@ -1681,7 +1681,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
tp->set_name (NULL);
else if (tp->name () == NULL
|| strcmp (tp->name (), name) != 0)
tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
tp->set_name (obstack_strdup (mdebugread_objfile->objfile_obstack (),
name));
}
}
@@ -1717,7 +1717,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
}
if (tp->name () == NULL
|| strcmp (tp->name (), name) != 0)
tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
tp->set_name (obstack_strdup (mdebugread_objfile->objfile_obstack (),
name));
}
}
@@ -2331,7 +2331,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
&& (bfd_section_flags (text_sect) & SEC_RELOC))
relocatable = 1;
extern_tab = XOBNEWVEC (&objfile->objfile_obstack, EXTR, hdr->iextMax);
extern_tab = XOBNEWVEC (objfile->objfile_obstack (), EXTR, hdr->iextMax);
includes_allocated = 30;
includes_used = 0;
@@ -2373,7 +2373,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
}
/* Allocate the global pending list. */
pending_list = XOBNEWVEC (&objfile->objfile_obstack, mdebug_pending *,
pending_list = XOBNEWVEC (objfile->objfile_obstack (), mdebug_pending *,
hdr->ifdMax);
memset (pending_list, 0,
hdr->ifdMax * sizeof (struct mdebug_pending *));
@@ -2604,7 +2604,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
textlow = 0;
pst = new legacy_psymtab (fdr_name (fh), partial_symtabs,
objfile->per_bfd, textlow);
pst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, md_symloc);
pst->read_symtab_private = XOBNEW (objfile->objfile_obstack (), md_symloc);
memset (pst->read_symtab_private, 0, sizeof (struct md_symloc));
save_pst = pst;
@@ -3980,7 +3980,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
/* Make up special symbol to contain
procedure specific info. */
mdebug_extra_func_info *e
= OBSTACK_ZALLOC (&mdebugread_objfile->objfile_obstack,
= OBSTACK_ZALLOC (mdebugread_objfile->objfile_obstack (),
mdebug_extra_func_info);
struct symbol *s = new_symbol (MDEBUG_EFI_SYMBOL_NAME);
@@ -4173,7 +4173,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
--size;
cust->primary_filetab ()->set_linetable
((struct linetable *)
obstack_copy (&mdebugread_objfile->objfile_obstack,
obstack_copy (mdebugread_objfile->objfile_obstack (),
lines, (sizeof (struct linetable)
+ size * sizeof (lines->item))));
xfree (lines);
@@ -4649,7 +4649,7 @@ new_psymtab (const char *name, psymtab_storage *partial_symtabs,
/* Keep a backpointer to the file's symbols. */
psymtab->read_symtab_private
= OBSTACK_ZALLOC (&objfile->objfile_obstack, md_symloc);
= OBSTACK_ZALLOC (objfile->objfile_obstack (), md_symloc);
CUR_BFD (psymtab) = cur_bfd;
DEBUG_SWAP (psymtab) = debug_swap;
DEBUG_INFO (psymtab) = debug_info;
@@ -4735,9 +4735,9 @@ new_block (enum block_type type, enum language language)
static struct symbol *
new_symbol (const char *name)
{
struct symbol *s = new (&mdebugread_objfile->objfile_obstack) symbol;
struct symbol *s = new (mdebugread_objfile->objfile_obstack ()) symbol;
s->set_language (psymtab_language, &mdebugread_objfile->objfile_obstack);
s->set_language (psymtab_language, mdebugread_objfile->objfile_obstack ());
s->compute_and_set_names (name, true, mdebugread_objfile->per_bfd);
return s;
}
@@ -4773,7 +4773,7 @@ elfmdebug_build_psymtabs (struct objfile *objfile,
minimal_symbol_reader reader (objfile);
info = XOBNEW (&objfile->objfile_obstack, ecoff_debug_info);
info = XOBNEW (objfile->objfile_obstack (), ecoff_debug_info);
if (!(*swap->read_debug_info) (abfd, sec, info))
error (_("Error reading ECOFF debugging information: %s"),

View File

@@ -225,7 +225,7 @@ objfile_register_static_link (struct objfile *objfile,
slot = htab_find_slot (objfile->static_links.get (), &lookup_entry, INSERT);
gdb_assert (*slot == NULL);
entry = XOBNEW (&objfile->objfile_obstack, static_link_htab_entry);
entry = XOBNEW (objfile->objfile_obstack (), static_link_htab_entry);
entry->block = block;
entry->static_link = static_link;
*slot = (void *) entry;
@@ -291,7 +291,7 @@ build_objfile_section_table (struct objfile *objfile)
{
int count = gdb_bfd_count_sections (objfile->obfd);
objfile->sections = OBSTACK_CALLOC (&objfile->objfile_obstack,
objfile->sections = OBSTACK_CALLOC (objfile->objfile_obstack (),
count,
struct obj_section);
objfile->sections_end = (objfile->sections + count);
@@ -327,7 +327,7 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_)
/* We could use obstack_specify_allocation here instead, but
gdb_obstack.h specifies the alloc/dealloc functions. */
obstack_init (&objfile_obstack);
obstack_init (objfile_obstack ());
objfile_alloc_data (this);
@@ -346,7 +346,7 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_)
name_holder = gdb_abspath (name);
expanded_name = name_holder.c_str ();
}
original_name = obstack_strdup (&objfile_obstack, expanded_name);
original_name = obstack_strdup (objfile_obstack (), expanded_name);
/* Update the per-objfile information that comes from the bfd, ensuring
that any data that is reference is saved in the per-objfile data
@@ -594,7 +594,7 @@ objfile::~objfile ()
}
/* Free the obstacks for non-reusable objfiles. */
obstack_free (&objfile_obstack, 0);
obstack_free (objfile_obstack (), 0);
/* Rebuild section map next time we need it. */
get_objfile_pspace_data (pspace)->section_map_dirty = 1;

View File

@@ -39,6 +39,7 @@
#include "jit.h"
#include "quick-symbol.h"
#include <forward_list>
#include "gdbsupport/thread-pool.h"
struct htab;
struct objfile_data;
@@ -166,13 +167,13 @@ struct entry_info
struct objstats
{
/* Number of full symbols read. */
int n_syms = 0;
std::atomic<int> n_syms {0};
/* Number of ".stabs" read (if applicable). */
int n_stabs = 0;
/* Number of types. */
int n_types = 0;
std::atomic<int> n_types {0};
/* Size of stringtable, (if applicable). */
int sz_strtab = 0;
@@ -666,7 +667,24 @@ public:
/* Obstack to hold objects that should be freed when we load a new symbol
table from this object file. */
struct obstack objfile_obstack {};
std::vector<struct obstack *> m_objfile_obstack;
struct obstack *objfile_obstack ()
{
unsigned id = gdb::thread_pool::id ();
size_t count = gdb::thread_pool::g_thread_pool->thread_count () + 1;
if (m_objfile_obstack.empty ())
for (size_t i = 0; i < count; ++i)
{
struct obstack *p
= (struct obstack *)malloc (sizeof (struct obstack));
m_objfile_obstack.push_back (p);
if (i == 0)
/* Main thread initializes it. */
continue;
obstack_init (m_objfile_obstack[i]);
}
return m_objfile_obstack[id];
}
/* Structure which keeps track of functions that manipulate objfile's
of the same type as this objfile. I.e. the function to read partial

View File

@@ -423,11 +423,11 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
/* On xcoff, if a global is defined and never referenced,
ld will remove it from the executable. There is then
a N_GSYM stab for it, but no regular (C_EXT) symbol. */
sym = new (&objfile->objfile_obstack) symbol;
sym = new (objfile->objfile_obstack ()) symbol;
sym->set_domain (VAR_DOMAIN);
sym->set_aclass_index (LOC_OPTIMIZED_OUT);
sym->set_linkage_name
(obstack_strndup (&objfile->objfile_obstack, name, pp - name));
(obstack_strndup (objfile->objfile_obstack (), name, pp - name));
pp += 2;
if (*(pp - 1) == 'F' || *(pp - 1) == 'f')
{
@@ -687,7 +687,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
e.g. ":t10=*2" or a nameless enum like " :T16=ered:0,green:1,blue:2,;" */
nameless = (p == string || ((string[0] == ' ') && (string[1] == ':')));
current_symbol = sym = new (&objfile->objfile_obstack) symbol;
current_symbol = sym = new (objfile->objfile_obstack ()) symbol;
if (processing_gcc_compilation)
{
@@ -701,7 +701,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
}
sym->set_language (get_current_subfile ()->language,
&objfile->objfile_obstack);
objfile->objfile_obstack ());
if (is_cplus_marker (string[0]))
{
@@ -799,7 +799,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
dbl_type = objfile_type (objfile)->builtin_double;
dbl_valu
= (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
= (gdb_byte *) obstack_alloc (objfile->objfile_obstack (),
TYPE_LENGTH (dbl_type));
target_float_from_string (dbl_valu, dbl_type, std::string (p));
@@ -884,7 +884,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
(create_array_type (NULL, objfile_type (objfile)->builtin_char,
range_type));
string_value
= (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, ind + 1);
= (gdb_byte *) obstack_alloc (objfile->objfile_obstack (), ind + 1);
memcpy (string_value, string_local, ind + 1);
p++;
@@ -1283,7 +1283,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
if (synonym)
{
/* Create the STRUCT_DOMAIN clone. */
struct symbol *struct_sym = new (&objfile->objfile_obstack) symbol;
struct symbol *struct_sym = new (objfile->objfile_obstack ()) symbol;
*struct_sym = *sym;
struct_sym->set_aclass_index (LOC_TYPEDEF);
@@ -1291,7 +1291,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
struct_sym->set_domain (STRUCT_DOMAIN);
if (sym->type ()->name () == 0)
sym->type ()->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(obconcat (objfile->objfile_obstack (), sym->linkage_name (),
(char *) NULL));
add_symbol_to_list (struct_sym, get_file_symbols ());
}
@@ -1318,14 +1318,14 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
sym->set_domain (STRUCT_DOMAIN);
if (sym->type ()->name () == 0)
sym->type ()->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(obconcat (objfile->objfile_obstack (), sym->linkage_name (),
(char *) NULL));
add_symbol_to_list (sym, get_file_symbols ());
if (synonym)
{
/* Clone the sym and then modify it. */
struct symbol *typedef_sym = new (&objfile->objfile_obstack) symbol;
struct symbol *typedef_sym = new (objfile->objfile_obstack ()) symbol;
*typedef_sym = *sym;
typedef_sym->set_aclass_index (LOC_TYPEDEF);
@@ -1333,7 +1333,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
typedef_sym->set_domain (VAR_DOMAIN);
if (sym->type ()->name () == 0)
sym->type ()->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(obconcat (objfile->objfile_obstack (), sym->linkage_name (),
(char *) NULL));
add_symbol_to_list (typedef_sym, get_file_symbols ());
}
@@ -1599,13 +1599,13 @@ again:
gdb::unique_xmalloc_ptr<char> new_name = cp_canonicalize_string (name);
if (new_name != nullptr)
type_name = obstack_strdup (&objfile->objfile_obstack,
type_name = obstack_strdup (objfile->objfile_obstack (),
new_name.get ());
}
if (type_name == NULL)
{
char *to = type_name = (char *)
obstack_alloc (&objfile->objfile_obstack, p - *pp + 1);
obstack_alloc (objfile->objfile_obstack (), p - *pp + 1);
/* Copy the name. */
from = *pp + 1;
@@ -1633,7 +1633,7 @@ again:
&& (sym->type ()->code () == code)
&& strcmp (sym->linkage_name (), type_name) == 0)
{
obstack_free (&objfile->objfile_obstack, type_name);
obstack_free (objfile->objfile_obstack (), type_name);
type = sym->type ();
if (typenums[0] != -1)
*dbx_lookup_type (typenums, objfile) = type;
@@ -2038,7 +2038,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
if (!negative_types)
{
/* This includes an empty slot for type number -0. */
negative_types = OBSTACK_CALLOC (&objfile->objfile_obstack,
negative_types = OBSTACK_CALLOC (objfile->objfile_obstack (),
NUMBER_RECOGNIZED + 1, struct type *);
rs6000_builtin_type_data.set (objfile, negative_types);
}
@@ -2584,11 +2584,11 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
struct next_fnfieldlist);
destr_fnlist->fn_fieldlist.name
= obconcat (&objfile->objfile_obstack, "~",
= obconcat (objfile->objfile_obstack (), "~",
new_fnlist->fn_fieldlist.name, (char *) NULL);
destr_fnlist->fn_fieldlist.fn_fields =
XOBNEWVEC (&objfile->objfile_obstack,
XOBNEWVEC (objfile->objfile_obstack (),
struct fn_field, has_destructor);
memset (destr_fnlist->fn_fieldlist.fn_fields, 0,
sizeof (struct fn_field) * has_destructor);
@@ -2643,13 +2643,13 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
else if (has_destructor && new_fnlist->fn_fieldlist.name[0] != '~')
{
new_fnlist->fn_fieldlist.name =
obconcat (&objfile->objfile_obstack,
obconcat (objfile->objfile_obstack (),
"~", main_fn_name, (char *)NULL);
xfree (main_fn_name);
}
new_fnlist->fn_fieldlist.fn_fields
= OBSTACK_CALLOC (&objfile->objfile_obstack, length, fn_field);
= OBSTACK_CALLOC (objfile->objfile_obstack (), length, fn_field);
for (i = length; (i--, sublist); sublist = sublist->next)
{
new_fnlist->fn_fieldlist.fn_fields[i] = sublist->fn_field;
@@ -2712,7 +2712,7 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp,
{
name = "";
}
fip->list->field.set_name (obconcat (&objfile->objfile_obstack,
fip->list->field.set_name (obconcat (objfile->objfile_obstack (),
vptr_name, name, (char *) NULL));
break;
@@ -2725,13 +2725,13 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp,
symnum);
name = "FOO";
}
fip->list->field.set_name (obconcat (&objfile->objfile_obstack,
fip->list->field.set_name (obconcat (objfile->objfile_obstack (),
vb_name, name, (char *) NULL));
break;
default:
invalid_cpp_abbrev_complaint (*pp);
fip->list->field.set_name (obconcat (&objfile->objfile_obstack,
fip->list->field.set_name (obconcat (objfile->objfile_obstack (),
"INVALID_CPLUSPLUS_ABBREV",
(char *) NULL));
break;
@@ -2782,7 +2782,7 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp,
struct gdbarch *gdbarch = objfile->arch ();
fip->list->field.set_name
(obstack_strndup (&objfile->objfile_obstack, *pp, p - *pp));
(obstack_strndup (objfile->objfile_obstack (), *pp, p - *pp));
*pp = p + 1;
/* This means we have a visibility for a field coming. */
@@ -3582,16 +3582,16 @@ read_enum_type (const char **pp, struct type *type,
p = *pp;
while (*p != ':')
p++;
name = obstack_strndup (&objfile->objfile_obstack, *pp, p - *pp);
name = obstack_strndup (objfile->objfile_obstack (), *pp, p - *pp);
*pp = p + 1;
n = read_huge_number (pp, ',', &nbits, 0);
if (nbits != 0)
return error_type (pp, objfile);
sym = new (&objfile->objfile_obstack) symbol;
sym = new (objfile->objfile_obstack ()) symbol;
sym->set_linkage_name (name);
sym->set_language (get_current_subfile ()->language,
&objfile->objfile_obstack);
objfile->objfile_obstack ());
sym->set_aclass_index (LOC_CONST);
sym->set_domain (VAR_DOMAIN);
sym->set_value_longest (n);
@@ -4232,7 +4232,7 @@ common_block_start (const char *name, struct objfile *objfile)
}
common_block = *get_local_symbols ();
common_block_i = common_block ? common_block->nsyms : 0;
common_block_name = obstack_strdup (&objfile->objfile_obstack, name);
common_block_name = obstack_strdup (objfile->objfile_obstack (), name);
}
/* Process a N_ECOMM symbol. */
@@ -4257,7 +4257,7 @@ common_block_end (struct objfile *objfile)
return;
}
sym = new (&objfile->objfile_obstack) symbol;
sym = new (objfile->objfile_obstack ()) symbol;
/* Note: common_block_name already saved on objfile_obstack. */
sym->set_linkage_name (common_block_name);
sym->set_aclass_index (LOC_BLOCK);
@@ -4497,6 +4497,11 @@ cleanup_undefined_types_1 (void)
void
cleanup_undefined_stabs_types (struct objfile *objfile)
{
#if CXX_STD_THREAD
static std::mutex cleanup_undefined_stabs_types_lock;
std::lock_guard<std::mutex> guard (cleanup_undefined_stabs_types_lock);
#endif
cleanup_undefined_types_1 ();
cleanup_undefined_types_noname (objfile);
}

View File

@@ -2525,7 +2525,7 @@ reread_symbols (int from_tty)
/* NB: after this call to obstack_free, objfiles_changed
will need to be called (see discussion below). */
obstack_free (&objfile->objfile_obstack, 0);
obstack_free (objfile->objfile_obstack (), 0);
objfile->sections = NULL;
objfile->section_offsets.clear ();
objfile->sect_index_bss = -1;
@@ -2539,7 +2539,7 @@ reread_symbols (int from_tty)
/* obstack_init also initializes the obstack so it is
empty. We could use obstack_specify_allocation but
gdb_obstack.h specifies the alloc/dealloc functions. */
obstack_init (&objfile->objfile_obstack);
obstack_init (objfile->objfile_obstack ());
/* set_objfile_per_bfd potentially allocates the per-bfd
data on the objfile's obstack (if sharing data across
@@ -2548,7 +2548,7 @@ reread_symbols (int from_tty)
set_objfile_per_bfd (objfile);
objfile->original_name
= obstack_strdup (&objfile->objfile_obstack, original_name);
= obstack_strdup (objfile->objfile_obstack (), original_name);
/* Reset the sym_fns pointer. The ELF reader can change it
based on whether .gdb_index is present, and we need it to
@@ -2776,7 +2776,7 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename)
{
struct objfile *objfile = cust->objfile ();
struct symtab *symtab
= OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symtab);
= OBSTACK_ZALLOC (objfile->objfile_obstack (), struct symtab);
symtab->filename = objfile->intern (filename);
symtab->fullname = NULL;
@@ -2819,7 +2819,7 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename)
struct compunit_symtab *
allocate_compunit_symtab (struct objfile *objfile, const char *name)
{
struct compunit_symtab *cu = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct compunit_symtab *cu = OBSTACK_ZALLOC (objfile->objfile_obstack (),
struct compunit_symtab);
const char *saved_name;
@@ -2829,7 +2829,7 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name)
Just save the basename to avoid path issues (too long for display,
relative vs absolute, etc.). */
saved_name = lbasename (name);
cu->name = obstack_strdup (&objfile->objfile_obstack, saved_name);
cu->name = obstack_strdup (objfile->objfile_obstack (), saved_name);
cu->set_debugformat ("unknown");
@@ -2849,6 +2849,10 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name)
void
add_compunit_symtab_to_objfile (struct compunit_symtab *cu)
{
#if CXX_STD_THREAD
static std::mutex add_compunit_symtab_to_objfile_lock;
std::lock_guard<std::mutex> guard (add_compunit_symtab_to_objfile_lock);
#endif
cu->next = cu->objfile ()->compunit_symtabs;
cu->objfile ()->compunit_symtabs = cu;
}

View File

@@ -66,10 +66,10 @@ print_objfile_statistics (void)
objfile->per_bfd->n_minsyms);
if (OBJSTAT (objfile, n_syms) > 0)
gdb_printf (_(" Number of \"full\" symbols read: %d\n"),
OBJSTAT (objfile, n_syms));
OBJSTAT (objfile, n_syms).load ());
if (OBJSTAT (objfile, n_types) > 0)
gdb_printf (_(" Number of \"types\" defined: %d\n"),
OBJSTAT (objfile, n_types));
OBJSTAT (objfile, n_types).load ());
i = linetables = 0;
for (compunit_symtab *cu : objfile->compunits ())
@@ -95,8 +95,8 @@ print_objfile_statistics (void)
gdb_printf (_(" Space used by string tables: %d\n"),
OBJSTAT (objfile, sz_strtab));
gdb_printf (_(" Total memory used for objfile obstack: %s\n"),
pulongest (obstack_memory_used (&objfile
->objfile_obstack)));
pulongest (obstack_memory_used (objfile
->objfile_obstack ())));
gdb_printf (_(" Total memory used for BFD obstack: %s\n"),
pulongest (obstack_memory_used (&objfile->per_bfd
->storage_obstack)));

View File

@@ -1005,7 +1005,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
{
char *p;
p = (char *) obstack_alloc (&objfile->objfile_obstack,
p = (char *) obstack_alloc (objfile->objfile_obstack (),
E_SYMNMLEN + 1);
strncpy (p, cs->c_name, E_SYMNMLEN);
p[E_SYMNMLEN] = '\0';
@@ -1450,7 +1450,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
}
#define SYMNAME_ALLOC(NAME, ALLOCED) \
((ALLOCED) ? (NAME) : obstack_strdup (&objfile->objfile_obstack, \
((ALLOCED) ? (NAME) : obstack_strdup (objfile->objfile_obstack (), \
(NAME)))
@@ -1499,7 +1499,7 @@ process_xcoff_symbol (struct xcoff_symbol *cs, struct objfile *objfile)
sym->set_type (objfile_type (objfile)->nodebug_text_symbol);
sym->set_aclass_index (LOC_BLOCK);
sym2 = new (&objfile->objfile_obstack) symbol (*sym);
sym2 = new (objfile->objfile_obstack ()) symbol (*sym);
if (cs->c_sclass == C_EXT || C_WEAKEXT)
add_symbol_to_list (sym2, get_global_symbols ());
@@ -1850,7 +1850,7 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile)
/* Allocate string table from objfile_obstack. We will need this table
as long as we have its symbol table around. */
strtbl = (char *) obstack_alloc (&objfile->objfile_obstack, length);
strtbl = (char *) obstack_alloc (objfile->objfile_obstack (), length);
xcoff->strtbl = strtbl;
/* Copy length buffer, the first byte is usually zero and is
@@ -1893,7 +1893,7 @@ xcoff_start_psymtab (psymtab_storage *partial_symtabs,
objfile->per_bfd, 0);
result->read_symtab_private =
XOBNEW (&objfile->objfile_obstack, struct xcoff_symloc);
XOBNEW (objfile->objfile_obstack (), struct xcoff_symloc);
((struct xcoff_symloc *) result->read_symtab_private)->first_symnum = first_symnum;
result->legacy_read_symtab = xcoff_read_symtab;
result->legacy_expand_psymtab = xcoff_expand_psymtab;
@@ -1948,7 +1948,7 @@ xcoff_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
legacy_psymtab *subpst =
new legacy_psymtab (include_list[i], partial_symtabs, objfile->per_bfd);
subpst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, xcoff_symloc);
subpst->read_symtab_private = XOBNEW (objfile->objfile_obstack (), xcoff_symloc);
((struct xcoff_symloc *) subpst->read_symtab_private)->first_symnum = 0;
((struct xcoff_symloc *) subpst->read_symtab_private)->numsyms = 0;
@@ -1999,7 +1999,7 @@ swap_sym (struct internal_syment *symbol, union internal_auxent *aux,
into the minimal symbols. */
char *p;
p = (char *) obstack_alloc (&objfile->objfile_obstack,
p = (char *) obstack_alloc (objfile->objfile_obstack (),
E_SYMNMLEN + 1);
strncpy (p, symbol->n_name, E_SYMNMLEN);
p[E_SYMNMLEN] = '\0';
@@ -2826,7 +2826,7 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags)
if (length)
{
debugsec
= (bfd_byte *) obstack_alloc (&objfile->objfile_obstack,
= (bfd_byte *) obstack_alloc (objfile->objfile_obstack (),
length);
if (!bfd_get_full_section_contents (abfd, secp, &debugsec))
@@ -2847,7 +2847,7 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags)
error (_("Error reading symbols from %s: %s"),
name, bfd_errmsg (bfd_get_error ()));
size = coff_data (abfd)->local_symesz * num_symbols;
info->symtbl = (char *) obstack_alloc (&objfile->objfile_obstack, size);
info->symtbl = (char *) obstack_alloc (objfile->objfile_obstack (), size);
info->symtbl_num_syms = num_symbols;
val = bfd_bread (info->symtbl, size, abfd);

View File

@@ -134,7 +134,9 @@ typename gdb::detail::par_for_accumulator<
typename std::result_of<RangeFunction (RandomIt, RandomIt)>::type
>::result_type
parallel_for_each (unsigned n, RandomIt first, RandomIt last,
RangeFunction callback)
RangeFunction callback,
std::function<unsigned int(RandomIt)> *task_size_ptr
= (std::function<unsigned int(RandomIt)> *)nullptr)
{
using result_type
= typename std::result_of<RangeFunction (RandomIt, RandomIt)>::type;
@@ -148,17 +150,33 @@ parallel_for_each (unsigned n, RandomIt first, RandomIt last,
size_t n_elements = last - first;
size_t elts_per_thread = 0;
size_t elts_left_over = 0;
size_t total_size = 0;
size_t size_per_thread = 0;
if (n_threads > 1)
{
/* Require that there should be at least N elements in a
thread. */
gdb_assert (n > 0);
if (n_elements / n_threads < n)
n_threads = std::max (n_elements / n, (size_t) 1);
elts_per_thread = n_elements / n_threads;
elts_left_over = n_elements % n_threads;
/* n_elements == n_threads * elts_per_thread + elts_left_over. */
if (task_size_ptr != nullptr)
{
gdb_assert (n == 1);
for (RandomIt i = first; i != last; ++i)
{
std::function<unsigned int(RandomIt)> f = *task_size_ptr;
size_t s = (size_t)f (i);
total_size += s;
}
size_per_thread = total_size / n_threads;
}
else
{
/* Require that there should be at least N elements in a
thread. */
gdb_assert (n > 0);
if (n_elements / n_threads < n)
n_threads = std::max (n_elements / n, (size_t) 1);
elts_per_thread = n_elements / n_threads;
elts_left_over = n_elements % n_threads;
/* n_elements == n_threads * elts_per_thread + elts_left_over. */
}
}
size_t count = n_threads == 0 ? 0 : n_threads - 1;
@@ -167,20 +185,47 @@ parallel_for_each (unsigned n, RandomIt first, RandomIt last,
if (parallel_for_each_debug)
{
debug_printf (_("Parallel for: n_elements: %zu\n"), n_elements);
debug_printf (_("Parallel for: minimum elements per thread: %u\n"), n);
debug_printf (_("Parallel for: elts_per_thread: %zu\n"), elts_per_thread);
if (task_size_ptr != nullptr)
{
debug_printf (_("Parallel for: total_size: %zu\n"), total_size);
debug_printf (_("Parallel for: size_per_thread: %zu\n"), size_per_thread);
}
else
{
debug_printf (_("Parallel for: minimum elements per thread: %u\n"), n);
debug_printf (_("Parallel for: elts_per_thread: %zu\n"), elts_per_thread);
}
}
size_t remaining_size = total_size;
for (int i = 0; i < count; ++i)
{
RandomIt end = first + elts_per_thread;
if (i < elts_left_over)
/* Distribute the leftovers over the worker threads, to avoid having
to handle all of them in a single thread. */
end++;
RandomIt end;
size_t s = 0;
if (task_size_ptr == nullptr)
{
end = first + elts_per_thread;
if (i < elts_left_over)
/* Distribute the leftovers over the worker threads, to avoid having
to handle all of them in a single thread. */
end++;
}
else
{
RandomIt j;
for (j = first; j < last && s < size_per_thread; ++j)
s += (size_t)(*task_size_ptr) (j);
end = j;
remaining_size -= s;
}
if (parallel_for_each_debug)
debug_printf (_("Parallel for: elements on worker thread %i\t: %zu\n"),
i, (size_t)(end - first));
{
debug_printf (_("Parallel for: elements on worker thread %i\t: %zu"),
i, (size_t)(end - first));
if (task_size_ptr != nullptr)
debug_printf (_("\t(size: %zu)"), s);
debug_printf (_("\n"));
}
results.post (i, [=] ()
{
return callback (first, end);
@@ -190,12 +235,22 @@ parallel_for_each (unsigned n, RandomIt first, RandomIt last,
for (int i = count; i < n_worker_threads; ++i)
if (parallel_for_each_debug)
debug_printf (_("Parallel for: elements on worker thread %i\t: 0\n"), i);
{
debug_printf (_("Parallel for: elements on worker thread %i\t: 0"), i);
if (task_size_ptr != nullptr)
debug_printf (_("\t(size: 0)"));
debug_printf (_("\n"));
}
/* Process all the remaining elements in the main thread. */
if (parallel_for_each_debug)
debug_printf (_("Parallel for: elements on main thread\t\t: %zu\n"),
(size_t)(last - first));
{
debug_printf (_("Parallel for: elements on main thread\t\t: %zu"),
(size_t)(last - first));
if (task_size_ptr != nullptr)
debug_printf (_("\t(size: %zu)"), remaining_size);
debug_printf (_("\n"));
}
return results.finish ([=] ()
{
return callback (first, last);

View File

@@ -29,12 +29,7 @@
char *
get_print_cell (void)
{
static char buf[NUMCELLS][PRINT_CELL_SIZE];
static int cell = 0;
if (++cell >= NUMCELLS)
cell = 0;
return buf[cell];
return (char *)malloc (PRINT_CELL_SIZE);
}
static char *

View File

@@ -149,12 +149,25 @@ thread_pool::~thread_pool ()
case -- see the comment by the definition of g_thread_pool. */
}
unsigned thread_pool::id ()
{
#if CXX_STD_THREAD
std::thread::id id = std::this_thread::get_id();
return g_thread_pool->m_thread_ids[id];
#else
return 0;
#endif
}
void
thread_pool::set_thread_count (size_t num_threads)
{
#if CXX_STD_THREAD
std::lock_guard<std::mutex> guard (m_tasks_mutex);
m_thread_ids[std::this_thread::get_id ()] = 0;
m_thread_ids_reverse[0] = std::this_thread::get_id ();
/* If the new size is larger, start some new threads. */
if (m_thread_count < num_threads)
{
@@ -166,6 +179,8 @@ thread_pool::set_thread_count (size_t num_threads)
try
{
std::thread thread (&thread_pool::thread_function, this);
m_thread_ids[thread.get_id ()] = i + 1;
m_thread_ids_reverse[i + 1] = thread.get_id ();
thread.detach ();
}
catch (const std::system_error &)
@@ -182,7 +197,12 @@ thread_pool::set_thread_count (size_t num_threads)
if (num_threads < m_thread_count)
{
for (size_t i = num_threads; i < m_thread_count; ++i)
m_tasks.emplace ();
{
std::thread::id id = m_thread_ids_reverse[i];
m_thread_ids.erase (id);
m_thread_ids_reverse.erase (i);
m_tasks.emplace ();
}
m_tasks_cv.notify_all ();
}

View File

@@ -22,6 +22,7 @@
#include <queue>
#include <vector>
#include <unordered_map>
#include <functional>
#if CXX_STD_THREAD
#include <thread>
@@ -119,6 +120,8 @@ public:
#endif
}
static unsigned id ();
/* Post a task to the thread pool. A future is returned, which can
be used to wait for the result. */
future<void> post_task (std::function<void ()> &&func)
@@ -177,6 +180,8 @@ private:
between the main thread and the worker threads. */
std::condition_variable m_tasks_cv;
std::mutex m_tasks_mutex;
std::unordered_map<std::thread::id, unsigned> m_thread_ids;
std::unordered_map<unsigned, std::thread::id> m_thread_ids_reverse;
#endif /* CXX_STD_THREAD */
};