From: Mathieu Desnoyers Date: Thu, 22 May 2014 12:06:10 +0000 (-0400) Subject: Fix: lttng modules system call generation script X-Git-Tag: v2.5.0-rc1~3 X-Git-Url: http://git.lttng.org/?p=lttng-modules.git;a=commitdiff_plain;h=94f9e23353016f630bf9be45128f8cf4c57b4888 Fix: lttng modules system call generation script Fixes #771 Signed-off-by: Mathieu Desnoyers --- diff --git a/instrumentation/syscalls/3.10.0-rc7/x86-64-syscalls-3.10.0-rc7 b/instrumentation/syscalls/3.10.0-rc7/x86-64-syscalls-3.10.0-rc7 index d9f81c0f..5db1a4f1 100644 --- a/instrumentation/syscalls/3.10.0-rc7/x86-64-syscalls-3.10.0-rc7 +++ b/instrumentation/syscalls/3.10.0-rc7/x86-64-syscalls-3.10.0-rc7 @@ -287,4 +287,3 @@ syscall sys_getcpu nr 309 nbargs 3 types: (unsigned *, unsigned *, struct getcpu syscall sys_process_vm_readv nr 310 nbargs 6 types: (pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long) args: (pid, lvec, liovcnt, rvec, riovcnt, flags) syscall sys_process_vm_writev nr 311 nbargs 6 types: (pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long) args: (pid, lvec, liovcnt, rvec, riovcnt, flags) syscall sys_finit_module nr 313 nbargs 3 types: (int, const char *, int) args: (fd, uargs, flags) -SUCCESS diff --git a/instrumentation/syscalls/README b/instrumentation/syscalls/README index 1e9bec49..a2a66fa0 100644 --- a/instrumentation/syscalls/README +++ b/instrumentation/syscalls/README @@ -10,9 +10,25 @@ is expected). See the dmesg output for system call metadata. 2) Generate system call TRACE_EVENT(). -Take the dmesg metadata and feed it to lttng-syscalls-generate-headers.sh, e.g., -from the instrumentation/syscalls directory. See the script header for -usage example. It should be run for both the integers and pointers types. +Take the dmesg metadata and feed it to lttng-syscalls-generate-headers.sh +(do not include the ending SUCCESS line), e.g., from the +instrumentation/syscalls directory. See the script header for usage example. +It should be run for both the integers and pointers types. After these are created, we just need to follow the new system call additions, no need to regenerate the whole thing, since system calls are only appended to. + +3) Override headers + +You need to provide override headers (even if they don't contain +overrides) for each architecture. Those are meant to contain manual +overrides for specific system calls for cases where the script do not +generate the correct typing for specific system calls. + +4) Integrating the new architecture, updating architecture header + +Edit instrumentation/syscalls/headers/syscalls_integers.h and +syscalls_pointers.h. Add the new architecture +(e.g. CONFIG_X86_64) to the newly-generated headers +(e.g. changing the current x86-64-syscalls-3.10.0-rc7_.h into +x86-64-syscalls-3.13.7_.h), then rebuild lttng-modules. diff --git a/instrumentation/syscalls/lttng-syscalls-generate-headers.sh b/instrumentation/syscalls/lttng-syscalls-generate-headers.sh index 4ab4599b..a0ae0f2a 100755 --- a/instrumentation/syscalls/lttng-syscalls-generate-headers.sh +++ b/instrumentation/syscalls/lttng-syscalls-generate-headers.sh @@ -19,6 +19,21 @@ SRCFILE=gen.tmp.0 TMPFILE=gen.tmp.1 HEADER=headers/${INPUTFILE}_${CLASS}.h +if [ x"$INPUTDIR" = x"" ]; then + echo "Error: Please specify input directory as second argument" + exit 1 +fi + +if [ x"$INPUTFILE" = x"" ]; then + echo "Error: Please specify input file as third argument" + exit 1 +fi + +if [ x"$BITNESS" != x"32" ] && [ x"$BITNESS" != x"64" ]; then + echo "Error: Please specify bitness as fourth argument (\"32\" or \"64\")" + exit 1 +fi + cp ${INPUT} ${SRCFILE} #Cleanup @@ -45,6 +60,12 @@ if [ "$CLASS" = pointers ]; then mv ${TMPFILE} ${SRCFILE} fi +if [ x"$CLASSCAP" = x"" ]; then + echo "Error: Please specify \"integers\" or \"pointers\" as first argument" + rm -f ${SRCFILE} + exit 1 +fi + echo "/* THIS FILE IS AUTO-GENERATED. DO NOT EDIT */" > ${HEADER} echo \ @@ -68,7 +89,7 @@ printf \ ' TP_STRUCT__entry(),\n'\ ' TP_fast_assign(),\n'\ ' TP_printk()\n'\ -')'\ +')\n'\ >> ${HEADER} grep "^syscall [^ ]* nr [^ ]* nbargs ${NRARGS} " ${SRCFILE} > ${TMPFILE} @@ -201,11 +222,6 @@ perl -p -e 's/^syscall ([^ ]*) nr ([^ ]*) nbargs ([^ ]*) '\ # Macro for tracing syscall table -rm -f ${TMPFILE} -for NRARGS in $(seq 0 6); do - grep "^syscall [^ ]* nr [^ ]* nbargs ${NRARGS} " ${SRCFILE} >> ${TMPFILE} -done - echo \ " #endif /* _TRACE_SYSCALLS_${CLASSCAP}_H */