From: Mathieu Desnoyers Date: Sat, 17 Sep 2011 01:47:48 +0000 (-0400) Subject: Support generation of syscall probes for those with pointers X-Git-Tag: v2.0-pre9~52 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=25631135724387849b45eaed70d75e072c29e2f5;p=lttng-modules.git Support generation of syscall probes for those with pointers Signed-off-by: Mathieu Desnoyers --- diff --git a/instrumentation/syscalls/lttng-syscalls-generate-headers.sh b/instrumentation/syscalls/lttng-syscalls-generate-headers.sh index 91e282c4..231bd5c4 100644 --- a/instrumentation/syscalls/lttng-syscalls-generate-headers.sh +++ b/instrumentation/syscalls/lttng-syscalls-generate-headers.sh @@ -2,10 +2,13 @@ # Generate system call probe description macros from syscall metadata dump file. # example usage: -# lttng-syscalls-generate-headers.sh 3.0.4 x86-64-syscalls-3.0.4 +# +# lttng-syscalls-generate-headers.sh integers 3.0.4 x86-64-syscalls-3.0.4 +# lttng-syscalls-generate-headers.sh pointers 3.0.4 x86-64-syscalls-3.0.4 -INPUTDIR=$1 -INPUTFILE=$2 +CLASS=$1 +INPUTDIR=$2 +INPUTFILE=$3 INPUT=${INPUTDIR}/${INPUTFILE} SRCFILE=gen.tmp.0 TMPFILE=gen.tmp.1 @@ -21,17 +24,18 @@ mv ${TMPFILE} ${SRCFILE} #Filter -#select only syscalls we currently support -#move non-pointers with and without arguments to a integer-only file. -CLASS=integers -grep -v "\\*\|cap_user_header_t" ${SRCFILE} > ${TMPFILE} -mv ${TMPFILE} ${SRCFILE} +if [ "$CLASS" = integers ]; then + #select integers and no-args. + grep -v "\\*\|cap_user_header_t" ${SRCFILE} > ${TMPFILE} + mv ${TMPFILE} ${SRCFILE} +fi + -#TODO -# move all system calls using pointers to a separate file. -#CLASS=pointers -#grep "\\*\|cap_#user_header_t" ${SRCFILE} > ${TMPFILE} -#mv ${TMPFILE} ${SRCFILE} +if [ "$CLASS" = pointers ]; then + #select system calls using pointers. + grep "\\*\|cap_#user_header_t" ${SRCFILE} > ${TMPFILE} + mv ${TMPFILE} ${SRCFILE} +fi HEADER=headers/${INPUTFILE}-${CLASS}.h @@ -50,6 +54,8 @@ echo \ #include " >> ${HEADER} +if [ "$CLASS" = integers ]; then + NRARGS=0 echo \ @@ -68,6 +74,7 @@ sed 's/^syscall \([^ ]*\) nr \([^ ]*\) nbargs \([^ ]*\) '\ '/g'\ ${TMPFILE} >> ${HEADER} +fi # types: 4 # args 5 @@ -192,12 +199,14 @@ echo \ NRARGS=0 -grep "^syscall [^ ]* nr [^ ]* nbargs ${NRARGS} " ${SRCFILE} > ${TMPFILE} +if [ "$CLASS" = integers ]; then #noargs +grep "^syscall [^ ]* nr [^ ]* nbargs ${NRARGS} " ${SRCFILE} > ${TMPFILE} sed 's/^syscall \([^ ]*\) nr \([^ ]*\) nbargs \([^ ]*\) .*$/'\ 'TRACE_SYSCALL_TABLE(syscalls_noargs, sys_\1, \2, \3)/g'\ ${TMPFILE} >> ${HEADER} +fi #others. grep -v "^syscall [^ ]* nr [^ ]* nbargs ${NRARGS} " ${SRCFILE} > ${TMPFILE} diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 09e48c45..2a63ad52 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -50,8 +50,6 @@ struct trace_syscall_entry { unsigned int nrargs; }; -static int sc_table_desc_filled; - #define CREATE_SYSCALL_TABLE #undef TRACE_SYSCALL_TABLE diff --git a/probes/lttng-events.h b/probes/lttng-events.h index 022b4a83..63bde185 100644 --- a/probes/lttng-events.h +++ b/probes/lttng-events.h @@ -293,7 +293,7 @@ static const struct lttng_event_desc *TP_ID(__event_desc___, TRACE_SYSTEM)[] = { #define TP_ID(_token, _system) TP_ID1(_token, _system) /* non-const because list head will be modified when registered. */ -static struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = { +static __used struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = { .event_desc = TP_ID(__event_desc___, TRACE_SYSTEM), .nr_events = ARRAY_SIZE(TP_ID(__event_desc___, TRACE_SYSTEM)), };