[gdb/symtab] Fix htab_find_slot call in read_call_site_scope
authorSimon Marchi <simon.marchi@polymtl.ca>
Fri, 1 Oct 2021 15:15:20 +0000 (17:15 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 1 Oct 2021 15:15:20 +0000 (17:15 +0200)
commitb4c919f75256a8f2263950ce2f970ba40d279b57
treeef15543e80a88c36798131be2e055ccc9db841e1
parent242fe37867ce33d8f8158bc2ee154d1e2e026a49
[gdb/symtab] Fix htab_find_slot call in read_call_site_scope

In read_call_site_scope we have:
...
  call_site_local.pc = pc;
  slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT);
...

The call passes a call_site pointer as element.  OTOH, the hashtab is created
using hash_f == core_addr_hash and eq_f == core_addr_eq, so the element
will be accessed through a CORE_ADDR pointer.

This is not wrong (at least in C), given that pc is the first field in
call_site.

Nevertheless, as in call_site_for_pc, make the htab_find_slot call match the
used hash_f and eq_f by using &pc instead:
...
  slot = htab_find_slot (cu->call_site_htab, &pc, INSERT);
...

Tested on x86_64-linux.

Co-Authored-By: Tom de Vries <tdevries@suse.de>
gdb/dwarf2/read.c
gdb/gdbtypes.h