[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>
This commit is contained in:
Simon Marchi
2021-10-01 17:15:20 +02:00
committed by Tom de Vries
parent 242fe37867
commit b4c919f752
2 changed files with 3 additions and 6 deletions

View File

@ -1793,9 +1793,7 @@ struct call_site_parameter
struct call_site
{
/* * Address of the first instruction after this call. It must be
the first field as we overload core_addr_hash and core_addr_eq
for it. */
/* Address of the first instruction after this call. */
CORE_ADDR pc;