Author: markj Date: Thu Aug 7 18:37:15 2014 New Revision: 269681 URL: http://svnweb.freebsd.org/changeset/base/269681
Log: MFC r265456, r265578: 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). Modified: stable/9/libexec/rtld-elf/Symbol.map stable/9/libexec/rtld-elf/rtld.c Directory Properties: stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/libexec/rtld-elf/Symbol.map ============================================================================== --- stable/9/libexec/rtld-elf/Symbol.map Thu Aug 7 18:36:47 2014 (r269680) +++ stable/9/libexec/rtld-elf/Symbol.map Thu Aug 7 18:37:15 2014 (r269681) @@ -30,4 +30,5 @@ FBSDprivate_1.0 { _rtld_atfork_post; _rtld_addr_phdr; _rtld_get_stack_prot; + _r_debug_postinit; }; Modified: stable/9/libexec/rtld-elf/rtld.c ============================================================================== --- stable/9/libexec/rtld-elf/rtld.c Thu Aug 7 18:36:47 2014 (r269680) +++ stable/9/libexec/rtld-elf/rtld.c Thu Aug 7 18:37:15 2014 (r269681) @@ -161,6 +161,7 @@ static bool matched_symbol(SymLook *, co const unsigned long); void r_debug_state(struct r_debug *, struct link_map *) __noinline; +void _r_debug_postinit(struct link_map *) __noinline; /* * Data declarations. @@ -635,6 +636,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ 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) { @@ -3501,7 +3503,20 @@ r_debug_state(struct r_debug* rd, struct * even when marked __noinline. However, gdb depends on those * calls being made. */ - __asm __volatile("" : : : "memory"); + __compiler_membar(); +} + +/* + * 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(). */ + __compiler_membar(); } /* _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"