Re: [PATCH] [GDB 18] gdb: resolve class name via DW_AT_signature in cooked index
Tom Tromey <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "Andrew" == Andrew Burgess <[email protected]> writes: Andrew> The problem is that the cooked index is unable to determine the name Andrew> of the parent class `base1` in this case, and so decides not to index Andrew> any of the member functions. Andrew> 2. cooked-indexer.c (scan_attributes): Handle DW_AT_signature by Andrew> looking up the signatured_type via lookup_signatured_type and Andrew> constructing a section_and_offset origin pointing to the type DIE Andrew> in the type unit. Restructure the is_declaration / origin- Andrew> following control flow: change the "else if (origin)" to a Andrew> standalone "if" so that class declaration stubs marked with Andrew> IS_TYPE_DECLARATION can still follow their origin to retrieve the Andrew> class name from the type unit. Add origin.reset() in the other Andrew> declaration paths to preserve the original behaviour for non-class Andrew> declarations and Ada imports. It's been a while since I was deep in the indexer, but looking at done_reading makes me wonder if this approach is safe: void cooked_index_worker_debug_info::done_reading () { /* This has to wait until we read the CUs, we need the list of DWOs. */ process_skeletonless_type_units (m_per_objfile, &m_index_storage); That is, I think skeletonless type units aren't processed until all other indexing is done. So if the signatured type appears in one of these, doesn't this mean the fix will fail? I don't remember how to set one of these up. Also my first thought when seeing this patch was that it might not be thread-safe. I'm still not completely sure. Perhaps it's fine because other type units seem to be (unfortunately) processed serially. A typical fix for these kinds of issues is to defer some of the work to the finalization step in the shard. I guess here the idea would be to store the signature and the relevant entry in some data structure, then patch up the parentage or whatever when finalizing. Tom