This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Fix inconsistency in blockvector addrmap vs non-addrmap handling
On Fri, Jun 22, 2012 at 12:35 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Tue, 05 Jun 2012 03:14:46 +0200, Doug Evans wrote:
>> --- buildsym.c ? ? ? ?29 May 2012 20:23:17 -0000 ? ? ?1.97
>> +++ buildsym.c ? ? ? ?5 Jun 2012 00:26:01 -0000
>> @@ -1024,8 +1027,15 @@ end_symtab (CORE_ADDR end_addr, struct o
>> ? ? ?{
>> ? ? ? ?/* Define the STATIC_BLOCK & GLOBAL_BLOCK, and build the
>> ? ? ? ? ? blockvector. ?*/
>> - ? ? ?finish_block (0, &file_symbols, 0, last_source_start_addr,
>> - ? ? ? ? ? ? ? ? end_addr, objfile);
>> + ? ? ?struct block *static_block;
>> +
>> + ? ? ?static_block = finish_block (0, &file_symbols, 0,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?last_source_start_addr, end_addr,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?objfile);
>> + ? ? ?/* Mark the range of the static block so that if we end up using
>> + ? ? ?blockvector.map then find_block_in_blockvector behaves identically
>> + ? ? ?regardless of whether the addrmap is present. ?*/
>> + ? ? ?record_block_range (static_block, last_source_start_addr, end_addr - 1);
>
> On IRC Doug made a note:
> ? ? ? ?Arguably the second is the better fix but it's still a hack as
> ? ? ? ?addrmaps are intended to handle discontiguous symtabs and this defeats
> ? ? ? ?that.
>
> Where "the first fix" was:
> ? ? ? ?[RFA] Fix gdb segv in dw2_find_pc_sect_symtab
> ? ? ? ?http://sourceware.org/ml/gdb-patches/2012-05/msg00958.html
>
> I think the right way is to call dwarf2_record_block_ranges for
> DW_AT_compilation_unit but I haven't tried to write such patch yet, is there
> a problem?
>
>
>> ? ? ? ?finish_block_internal (0, &global_symbols, 0, last_source_start_addr,
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ?end_addr, objfile, 1);
>> ? ? ? ?blockvector = make_blockvector (objfile);
With some work that could be made to work.
But remember that the static block (or global block) doesn't exist
until the call to end_symtab, and, barring even more work, you need to
get the range into pending_addrmap before the call to make_blockvector
where pending_addrmap is turned into a fixed addrmap.