aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.h
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-10-04 18:16:40 +0200
committerTom de Vries <tdevries@suse.de>2021-10-04 18:16:40 +0200
commit0dd8295da24ae58c1e808b906b7c0aafea22a259 (patch)
treefd64ad6c5a426a23828288c537100bbd561ca8eb /gdb/gdbtypes.h
parentabe19f1119ef3d33acd9c8699ebeb110feed55d8 (diff)
downloadfsf-binutils-gdb-0dd8295da24ae58c1e808b906b7c0aafea22a259.zip
fsf-binutils-gdb-0dd8295da24ae58c1e808b906b7c0aafea22a259.tar.gz
fsf-binutils-gdb-0dd8295da24ae58c1e808b906b7c0aafea22a259.tar.bz2
[gdb/symtab] Add call_site_eq and call_site_hash
In commit b4c919f7525 "[gdb/symtab] Fix htab_find_slot call in read_call_site_scope" , I removed the comment: ... It must be the first field as we overload core_addr_hash and core_addr_eq for it. ... for field pc of struct call_site. However, this was not tested, and when indeed moving field pc to the second location, we run into a testsuite failure in gdb.trace/entry-values.exp. This is caused by core_addr_eq (the eq_f function for the htab) being called with a pointer to the pc field (as passed into htab_find_slot) and a pointer to a hash table element. Now that pc is no longer the first field, the pointer to hash table element no longer points to the pc field. This could be fixed by simply reinstating the comment, but we're trying to get rid of this kind of tricks that make refactoring more difficult. Instead, fix this by: - reverting commit b4c919f7525, apart from the comment removal, such that we're passing a pointer to element to htab_find_slot - updating the htab_find_slot call in compunit_symtab::find_call_site in a similar manner - adding a call_site_eq and call_site_hash, and using these in the hash table instead of core_addr_eq and core_addr_hash. Tested on x86_64-linux, both with and without a trigger patch that moves pc to the second location in struct call_site.
Diffstat (limited to 'gdb/gdbtypes.h')
-rw-r--r--gdb/gdbtypes.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 6d09576..8021cb2 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1824,6 +1824,21 @@ struct call_site
struct call_site_parameter parameter[1];
};
+static inline int
+call_site_eq (const void *a_, const void *b_)
+{
+ const struct call_site *a = (const call_site *)a_;
+ const struct call_site *b = (const call_site *)b_;
+ return core_addr_eq (&a->pc, &b->pc);
+}
+
+static inline hashval_t
+call_site_hash (const void *a_)
+{
+ const struct call_site *a = (const call_site *)a_;
+ return core_addr_hash (&a->pc);
+}
+
/* The type-specific info for TYPE_CODE_FIXED_POINT types. */
struct fixed_point_type_info