Add a postinit debugger hook to rtld. This will be used by dtrace(1) to halt
the victim process before its entry point is called, at which point probes and DOF data are registered with the kernel. The r_debug_state hook cannot be used for this purpose, as it is called before the program's init routines are invoked and in particular before DOF data is registered (via drti.o). Reviewed by: kib MFC after: 2 weeks
This commit is contained in:
parent
4aa74d8b65
commit
a8509eb20e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=265456
@ -30,4 +30,5 @@ FBSDprivate_1.0 {
|
||||
_rtld_atfork_post;
|
||||
_rtld_addr_phdr;
|
||||
_rtld_get_stack_prot;
|
||||
_rtld_debug_postinit;
|
||||
};
|
||||
|
@ -162,6 +162,7 @@ static bool matched_symbol(SymLook *, const Obj_Entry *, Sym_Match_Result *,
|
||||
const unsigned long);
|
||||
|
||||
void r_debug_state(struct r_debug *, struct link_map *) __noinline;
|
||||
void _r_debug_postinit(struct link_map *) __noinline;
|
||||
|
||||
/*
|
||||
* Data declarations.
|
||||
@ -637,6 +638,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||
if (obj_main->crt_no_init)
|
||||
preinit_main();
|
||||
objlist_call_init(&initlist, &lockstate);
|
||||
_r_debug_postinit(&obj_main->linkmap);
|
||||
objlist_clear(&initlist);
|
||||
dbg("loading filtees");
|
||||
for (obj = obj_list->next; obj != NULL; obj = obj->next) {
|
||||
@ -3552,6 +3554,19 @@ r_debug_state(struct r_debug* rd, struct link_map *m)
|
||||
__asm __volatile("" : : : "memory");
|
||||
}
|
||||
|
||||
/*
|
||||
* A function called after init routines have completed. This can be used to
|
||||
* break before a program's entry routine is called, and can be used when
|
||||
* main is not available in the symbol table.
|
||||
*/
|
||||
void
|
||||
_r_debug_postinit(struct link_map *m)
|
||||
{
|
||||
|
||||
/* See r_debug_state(). */
|
||||
__asm __volatile("" : : : "memory");
|
||||
}
|
||||
|
||||
/*
|
||||
* Get address of the pointer variable in the main program.
|
||||
* Prefer non-weak symbol over the weak one.
|
||||
|
Loading…
Reference in New Issue
Block a user