struct minimal_symbol *msymbol,
std::vector<symtab_and_line> *result)
{
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
- CORE_ADDR pc;
struct symtab_and_line sal;
- if (msymbol_is_text (msymbol))
+ CORE_ADDR func_addr;
+ if (msymbol_is_function (objfile, msymbol, &func_addr))
{
- sal = find_pc_sect_line (MSYMBOL_VALUE_ADDRESS (objfile, msymbol),
- (struct obj_section *) 0, 0);
- sal.section = MSYMBOL_OBJ_SECTION (objfile, msymbol);
-
- /* The minimal symbol might point to a function descriptor;
- resolve it to the actual code address instead. */
- pc = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc,
- ¤t_target);
- if (pc != sal.pc)
- sal = find_pc_sect_line (pc, NULL, 0);
+ sal = find_pc_sect_line (func_addr, NULL, 0);
if (self->funfirstline)
{
&& (COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (sal.symtab))
|| SYMTAB_LANGUAGE (sal.symtab) == language_asm))
{
- /* If gdbarch_convert_from_func_ptr_addr does not apply then
- sal.SECTION, sal.LINE&co. will stay correct from above.
- If gdbarch_convert_from_func_ptr_addr applies then
- sal.SECTION is cleared from above and sal.LINE&co. will
- stay correct from the last find_pc_sect_line above. */
- sal.pc = MSYMBOL_VALUE_ADDRESS (objfile, msymbol);
- sal.pc = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc,
- ¤t_target);
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
+
+ sal.pc = func_addr;
if (gdbarch_skip_entrypoint_p (gdbarch))
sal.pc = gdbarch_skip_entrypoint (gdbarch, sal.pc);
}
add_minsym (struct minimal_symbol *minsym, void *d)
{
struct collect_minsyms *info = (struct collect_minsyms *) d;
- bound_minimal_symbol_d mo;
-
- mo.minsym = minsym;
- mo.objfile = info->objfile;
if (info->symtab != NULL)
{
- CORE_ADDR pc;
- struct symtab_and_line sal;
- struct gdbarch *gdbarch = get_objfile_arch (info->objfile);
-
- sal = find_pc_sect_line (MSYMBOL_VALUE_ADDRESS (info->objfile, minsym),
- NULL, 0);
- sal.section = MSYMBOL_OBJ_SECTION (info->objfile, minsym);
- pc
- = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, ¤t_target);
- if (pc != sal.pc)
- sal = find_pc_sect_line (pc, NULL, 0);
+ /* We're looking for a label for which we don't have debug
+ info. */
+ CORE_ADDR func_addr;
+ if (msymbol_is_function (info->objfile, minsym, &func_addr))
+ {
+ symtab_and_line sal = find_pc_sect_line (func_addr, NULL, 0);
- if (info->symtab != sal.symtab)
- return;
+ if (info->symtab != sal.symtab)
+ return;
+ }
}
- /* Exclude data symbols when looking for breakpoint locations. */
- if (!info->list_mode)
- switch (minsym->type)
- {
- case mst_slot_got_plt:
- case mst_data:
- case mst_bss:
- case mst_abs:
- case mst_file_data:
- case mst_file_bss:
- {
- /* Make sure this minsym is not a function descriptor
- before we decide to discard it. */
- struct gdbarch *gdbarch = get_objfile_arch (info->objfile);
- CORE_ADDR addr = gdbarch_convert_from_func_ptr_addr
- (gdbarch, BMSYMBOL_VALUE_ADDRESS (mo),
- ¤t_target);
-
- if (addr == BMSYMBOL_VALUE_ADDRESS (mo))
- return;
- }
- }
+ /* Exclude data symbols when looking for breakpoint locations. */
+ if (!info->list_mode && !msymbol_is_function (info->objfile, minsym))
+ return;
+ bound_minimal_symbol_d mo = {minsym, info->objfile};
VEC_safe_push (bound_minimal_symbol_d, info->msyms, &mo);
}
/* See minsyms.h. */
bool
-msymbol_is_text (minimal_symbol *msymbol)
+msymbol_is_function (struct objfile *objfile, minimal_symbol *minsym,
+ CORE_ADDR *func_address_p)
{
- switch (MSYMBOL_TYPE (msymbol))
+ CORE_ADDR msym_addr = MSYMBOL_VALUE_ADDRESS (objfile, minsym);
+
+ switch (minsym->type)
{
- case mst_text:
- case mst_text_gnu_ifunc:
- case mst_solib_trampoline:
- case mst_file_text:
- return true;
+ case mst_slot_got_plt:
+ case mst_data:
+ case mst_bss:
+ case mst_abs:
+ case mst_file_data:
+ case mst_file_bss:
+ {
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ CORE_ADDR pc = gdbarch_convert_from_func_ptr_addr (gdbarch, msym_addr,
+ ¤t_target);
+ if (pc != msym_addr)
+ {
+ if (func_address_p != NULL)
+ *func_address_p = pc;
+ return true;
+ }
+ return false;
+ }
default:
- return false;
+ if (func_address_p != NULL)
+ *func_address_p = msym_addr;
+ return true;
}
}