From 30add090cbcbb6367c06c8bcc3c270e60c2f928e Mon Sep 17 00:00:00 2001 From: hunt Date: Tue, 17 May 2005 07:30:19 +0000 Subject: [PATCH] Updated for latest runtime. --- runtime/probes/where_func/Makefile | 18 +++++- runtime/probes/where_func/build | 16 ------ .../probes/where_func/kprobe_where_funct.c | 57 ++++++------------- 3 files changed, 31 insertions(+), 60 deletions(-) delete mode 100755 runtime/probes/where_func/build diff --git a/runtime/probes/where_func/Makefile b/runtime/probes/where_func/Makefile index 431ddc4fa..30a3a41fb 100644 --- a/runtime/probes/where_func/Makefile +++ b/runtime/probes/where_func/Makefile @@ -1,11 +1,23 @@ # Makefile -# -# -# make -C path/to/kernel/src M=`pwd` modules STP_RUNTIME=path_to_systemtap_rt + +PWD := $(shell pwd) +KVERSION := $(shell uname -r) +KDIR := /lib/modules/$(KVERSION)/build include + +KALLSYMS_LOOKUP_NAME := $(firstword $(shell grep " kallsyms_lookup_name" /boot/System.map-$(KVERSION))) +KALLSYMS_LOOKUP := $(firstword $(shell grep " kallsyms_lookup$$" /boot/System.map-$(KVERSION))) +KTA := $(firstword $(shell grep "__kernel_text_address" /boot/System.map-$(KVERSION))) CFLAGS += -I $(STP_RUNTIME) -I $(STP_RUNTIME)/relayfs -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME) \ -D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP) + obj-m := kprobe_where_funct.o +default: + $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules \ + KALLSYMS_LOOKUP_NAME=0x$(KALLSYMS_LOOKUP_NAME) \ + KALLSYMS_LOOKUP=0x$(KALLSYMS_LOOKUP) KTA=0x$(KTA)\ + STP_RUNTIME=$(PWD)/../.. + clean: /bin/rm -rf *.o *.ko *~ *.mod.c .*.cmd .tmp_versions diff --git a/runtime/probes/where_func/build b/runtime/probes/where_func/build deleted file mode 100755 index 3713f08a9..000000000 --- a/runtime/probes/where_func/build +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -KVERSION=`uname -r` -echo $KVERSION -KALLSYMS_LOOKUP_NAME=`grep " kallsyms_lookup_name" /boot/System.map-$KVERSION |awk '{print $1}'` -KALLSYMS_LOOKUP=`grep " kallsyms_lookup$" /boot/System.map-$KVERSION |awk '{print $1}'` - -make V=1 -C /lib/modules/`uname -r`/build M=`pwd` modules \ - KALLSYMS_LOOKUP_NAME=0x$KALLSYMS_LOOKUP_NAME \ - KALLSYMS_LOOKUP=0x$KALLSYMS_LOOKUP \ - STP_RUNTIME=`pwd`/../.. - - - - - diff --git a/runtime/probes/where_func/kprobe_where_funct.c b/runtime/probes/where_func/kprobe_where_funct.c index 960f2290e..d75d70f90 100644 --- a/runtime/probes/where_func/kprobe_where_funct.c +++ b/runtime/probes/where_func/kprobe_where_funct.c @@ -1,19 +1,23 @@ /* kprobe_where_funct.c - this is a simple module to get information about calls to a function that is passed as a module option + this is a simple module to get information about calls to a function + that is passed as a module option Will Cohen */ -#define HASH_TABLE_BITS 8 -#define HASH_TABLE_SIZE (1<val); - _stp_symbol_print (key1int(ptr)); - _stp_print_flush(); - } - + _stp_map_print (funct_locations, "locations"); _stp_map_del(funct_locations); } void cleanup_module(void) { - if (!exited) - probe_exit(); - _stp_transport_close(); } -- 2.43.5