This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH add more syntax for shared library probing


Comments on this patch to add more syntax for shared library probing?
Example:
1. library wildcard for function in libc.so
stap -c "/usr/bin/printf '%s\n' 'ABCD'" -e 'probe process("/usr/bin/printf").library("*").function("__snprintf_chk") {printf("at printf begin\n")} probe process("/usr/bin/printf").library("*").function("__snprintf_chk").return {printf("at printf end\n")} probe process("/usr/bin/printf").library("*").statement("__snprintf_chk@snprintf_chk.c+2") {printf("in printf body\n")}'
ABCD
at printf begin
in printf body
at printf end


2. Similar for -L. Perhaps filling in the wildcard with the matched library would be useful.
stap -L 'process("/usr/bin/printf").library("*").function("__snprintf_chk")'
process("/usr/bin/printf").library("*").function("__snprintf_chk")? $s:char* $maxlen:size_t $flags:int $slen:size_t $format:char const* $arg:va_list $done:int


3. Probe in a user SO
stap -c ./sdt_misc_uprobe_shared.x -e 'probe process ("./sdt_misc_uprobe_shared.x").library("*").statement("bar@sdt_misc.c+9") ? {printf ("In bar i=%d\n",$i)}'
In bar i=2


	* dwflpp.cxx (iterate_over_libraries): New.  Just calls
	iterate_over_libraries_dynamic with the Dwfl_Module.

	(iterate_over_libraries_dynamic): Iterate through SHT_DYNAMIC for
	the Dwfl_Module.  Save DT_RPATH/DT_RUNPATH for library search.
	DT_NEEDED/DT_SONAME are potentially SOs to search.  Insure we
	haven't already seen it, call the callback, then find the SOs
	that this so references via iterate_over_libraries_module.  The
	system default library paths are explicitly appended to runpath.

	(iterate_over_libraries_module): Get the Dwfl_Module for this SO
	via dwfl_getmodules which just callbacks iterate_over_libraries_dynamic.

	* util.cxx (find_executable):  Add rpath and runpath default parameters.
	Search: 1. LD_RPATH 2. LD_LIBRARY_PATH 3. LD_RUNPATH 4. system libraries

	* tapsets.cxx (base_query): If this is a library then save the
	executable path.
	(query_module): For a library, call query_library_callback via
	iterate_over_libraries.
	(query_library_callback): New. Calls query_library.
	(query_library): Substitute the library name into the chain then
	derive_probes.


Attachment: ,git.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]