diff options
-rw-r--r-- | gdb/dwarf2/loc.c | 9 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 4 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 5 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 10 | ||||
-rw-r--r-- | gdb/symtab.c | 6 |
5 files changed, 25 insertions, 9 deletions
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 27a1c97..16e0be7 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -713,7 +713,14 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch, } case FIELD_LOC_KIND_PHYSADDR: - return FIELD_STATIC_PHYSADDR (call_site->target); + { + dwarf2_per_objfile *per_objfile = call_site->per_objfile; + compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu); + int sect_idx = COMPUNIT_BLOCK_LINE_SECTION (cust); + CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx]; + + return FIELD_STATIC_PHYSADDR (call_site->target) + delta; + } default: internal_error (__FILE__, __LINE__, _("invalid call site target kind")); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 230eb6a..e036b2e 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -13363,6 +13363,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) } pc = attr->as_address () + baseaddr; pc = gdbarch_adjust_dwarf2_addr (gdbarch, pc); + pc -= baseaddr; if (cu->call_site_htab == NULL) cu->call_site_htab = htab_create_alloc_ex (16, call_site::hash, @@ -13519,7 +13520,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) sect_offset_str (die->sect_off), objfile_name (objfile)); else { - lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr); + lowpc = (gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr) + - baseaddr); SET_FIELD_PHYSADDR (call_site->target, lowpc); } } diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 8954c37..8535328 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -6314,7 +6314,10 @@ objfile_type (struct objfile *objfile) CORE_ADDR call_site::pc () const { - return m_pc; + compunit_symtab *cust = this->per_objfile->get_symtab (this->per_cu); + CORE_ADDR delta + = this->per_objfile->objfile->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (cust)]; + return m_unrelocated_pc + delta; } void _initialize_gdbtypes (); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 5fe10cb..4e5b2f1 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1795,19 +1795,19 @@ struct call_site { call_site (CORE_ADDR pc, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile) - : per_cu (per_cu), per_objfile (per_objfile), m_pc (pc) + : per_cu (per_cu), per_objfile (per_objfile), m_unrelocated_pc (pc) {} static int eq (const call_site *a, const call_site *b) { - return core_addr_eq (&a->m_pc, &b->m_pc); + return core_addr_eq (&a->m_unrelocated_pc, &b->m_unrelocated_pc); } static hashval_t hash (const call_site *a) { - return core_addr_hash (&a->m_pc); + return core_addr_hash (&a->m_unrelocated_pc); } static int @@ -1849,8 +1849,8 @@ struct call_site dwarf2_per_objfile *const per_objfile = nullptr; private: - /* Address of the first instruction after this call. */ - const CORE_ADDR m_pc; + /* Unrelocated address of the first instruction after this call. */ + const CORE_ADDR m_unrelocated_pc; public: /* * Describe DW_TAG_call_site's DW_TAG_formal_parameter. */ diff --git a/gdb/symtab.c b/gdb/symtab.c index cb58384..85e6b08 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -337,7 +337,11 @@ compunit_symtab::find_call_site (CORE_ADDR pc) const if (m_call_site_htab == nullptr) return nullptr; - struct call_site call_site_local (pc, nullptr, nullptr); + CORE_ADDR delta + = this->objfile->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (this)]; + CORE_ADDR unrelocated_pc = pc - delta; + + struct call_site call_site_local (unrelocated_pc, nullptr, nullptr); void **slot = htab_find_slot (m_call_site_htab, &call_site_local, NO_INSERT); if (slot == nullptr) |