call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
{
struct compunit_symtab *cust;
- void **slot = NULL;
+ call_site *cs = nullptr;
/* -1 as tail call PC can be already after the compilation unit range. */
cust = find_pc_compunit_symtab (pc - 1);
- if (cust != NULL && COMPUNIT_CALL_SITE_HTAB (cust) != NULL)
- slot = htab_find_slot (COMPUNIT_CALL_SITE_HTAB (cust), &pc, NO_INSERT);
+ if (cust != nullptr)
+ cs = cust->find_call_site (pc);
- if (slot == NULL)
+ if (cs == nullptr)
{
struct bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (pc);
: msym.minsym->print_name ()));
}
- return (struct call_site *) *slot;
+ return cs;
}
/* Return the blockvector immediately containing the innermost lexical block
if (gcc_4_minor >= 5)
cust->epilogue_unwind_valid = 1;
- cust->call_site_htab = cu->call_site_htab;
+ cust->set_call_site_htab (cu->call_site_htab);
}
per_objfile->set_symtab (cu->per_cu, cust);
/* See symtab.h. */
+call_site *
+compunit_symtab::find_call_site (CORE_ADDR pc) const
+{
+ if (m_call_site_htab == nullptr)
+ return nullptr;
+
+ void **slot = htab_find_slot (m_call_site_htab, &pc, NO_INSERT);
+ if (slot == nullptr)
+ return nullptr;
+
+ return (call_site *) *slot;
+}
+
+/* See symtab.h. */
+
+void
+compunit_symtab::set_call_site_htab (htab_t call_site_htab)
+{
+ gdb_assert (m_call_site_htab == nullptr);
+ m_call_site_htab = call_site_htab;
+}
+
+/* See symtab.h. */
+
struct symtab *
compunit_primary_filetab (const struct compunit_symtab *cust)
{
struct compunit_symtab
{
+ /* Set m_call_site_htab. */
+ void set_call_site_htab (htab_t call_site_htab);
+
+ /* Find call_site info for PC. */
+ call_site *find_call_site (CORE_ADDR pc) const;
+
/* Unordered chain of all compunit symtabs of this objfile. */
struct compunit_symtab *next;
unsigned int epilogue_unwind_valid : 1;
/* struct call_site entries for this compilation unit or NULL. */
- htab_t call_site_htab;
+ htab_t m_call_site_htab;
/* The macro table for this symtab. Like the blockvector, this
is shared between different symtabs in a given compilation unit.
#define COMPUNIT_BLOCK_LINE_SECTION(cust) ((cust)->block_line_section)
#define COMPUNIT_LOCATIONS_VALID(cust) ((cust)->locations_valid)
#define COMPUNIT_EPILOGUE_UNWIND_VALID(cust) ((cust)->epilogue_unwind_valid)
-#define COMPUNIT_CALL_SITE_HTAB(cust) ((cust)->call_site_htab)
#define COMPUNIT_MACRO_TABLE(cust) ((cust)->macro_table)
/* A range adapter to allowing iterating over all the file tables