diff options
author | hunt <hunt> | 2005-07-01 19:27:52 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-07-01 19:27:52 +0000 |
commit | 07a4738f117eca68c7076ff09b7f93230ab9fedd (patch) | |
tree | 2bece162ba58674d1699ee9d94c524ffb5c42855 | |
parent | f5548c07826ab136c199055769ccfc34e01c0cd7 (diff) | |
download | systemtap-steved-07a4738f117eca68c7076ff09b7f93230ab9fedd.tar.gz systemtap-steved-07a4738f117eca68c7076ff09b7f93230ab9fedd.tar.xz systemtap-steved-07a4738f117eca68c7076ff09b7f93230ab9fedd.zip |
2005-07-01 Martin Hunt <hunt@redhat.com>
* Makefile.template (debug): New target.
* build: Support "debug" target.
* build_probe: Ditto.
-rw-r--r-- | runtime/probes/ChangeLog | 8 | ||||
-rw-r--r-- | runtime/probes/Makefile.template | 10 | ||||
-rwxr-xr-x | runtime/probes/build | 7 | ||||
-rwxr-xr-x | runtime/probes/build_probe | 112 |
4 files changed, 86 insertions, 51 deletions
diff --git a/runtime/probes/ChangeLog b/runtime/probes/ChangeLog index 7806ba54..fe634c16 100644 --- a/runtime/probes/ChangeLog +++ b/runtime/probes/ChangeLog @@ -1,3 +1,11 @@ +2005-07-01 Martin Hunt <hunt@redhat.com> + + * Makefile.template (debug): New target. + + * build: Support "debug" target. + + * build_probe: Ditto. + 2005-06-28 Martin Hunt <hunt@redhat.com> * bench/bench_ret.c (inst_sys_write_ret): Fix prototype. diff --git a/runtime/probes/Makefile.template b/runtime/probes/Makefile.template index ccdbbdee..23122fab 100644 --- a/runtime/probes/Makefile.template +++ b/runtime/probes/Makefile.template @@ -8,12 +8,18 @@ KALLSYMS_LOOKUP_NAME := 0x$(firstword $(shell grep " kallsyms_lookup_name" /boot KALLSYMS_LOOKUP := 0x$(firstword $(shell grep " kallsyms_lookup$$" /boot/System.map-$(KVERSION))) KTA := 0x$(firstword $(shell grep "__kernel_text_address" /boot/System.map-$(KVERSION))) -EXTRA_CFLAGS := -I $(RT) -I $(RT)/relayfs -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME) -D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP) -DKTA=$(KTA) +FLAGS := -I $(RT) -I $(RT)/relayfs -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME) -D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP) -DKTA=$(KTA) + +DFLAGS := $(FLAGS) -D DEBUG obj-m := XXX.o default: - $(MAKE) V=1 -C $(KDIR) M=$(PWD) RT=$(RT) modules + $(MAKE) V=1 -C $(KDIR) M=$(PWD) RT=$(RT) EXTRA_CFLAGS="$(FLAGS)" modules + +debug: + $(MAKE) V=1 -C $(KDIR) M=$(PWD) RT=$(RT) EXTRA_CFLAGS="$(DFLAGS)" modules + clean: /bin/rm -rf *.o *.o.d *.ko *~ *.mod.c .*.cmd .tmp_versions diff --git a/runtime/probes/build b/runtime/probes/build index 584f792a..ad65b0dc 100755 --- a/runtime/probes/build +++ b/runtime/probes/build @@ -4,18 +4,21 @@ # simple script to build each probe directory proc usage {} { - puts "Usage: build \[-v\] \[clean\]" + puts "Usage: build \[-v\] \[clean\] \[debug\]" exit } set clean "" set verbose "" +set debug "" foreach arg $argv { if {$arg == "clean"} { set clean $arg } elseif {$arg == "-v"} { set verbose $arg + } elseif {$arg == "debug"} { + set debug $arg } else { usage } @@ -26,7 +29,7 @@ set cmd "exec ../build_probe $verbose $clean" foreach filename [lsort [glob *]] { if {$filename != "CVS" && [file isdirectory $filename]} { cd $filename - if {[catch {exec ../build_probe $verbose $clean} res]} { + if {[catch {exec ../build_probe $verbose $clean $debug} res]} { puts $res exit } diff --git a/runtime/probes/build_probe b/runtime/probes/build_probe index d97d4a42..9eadebd2 100755 --- a/runtime/probes/build_probe +++ b/runtime/probes/build_probe @@ -27,7 +27,7 @@ proc create_makefile {target} { } proc build {{target ""}} { - global clean verbose + global clean verbose debug if {$target == ""} { set target [file tail [pwd]] } @@ -39,79 +39,97 @@ proc build {{target ""}} { } } else { puts "Building $target" - if {[catch {exec make >& compile.errors} res]} { - puts "\n------------ Compile error in $target -------------------\n" - if {[catch {open compile.errors r} fd]} { - puts "Compile failed for unknown reasons" - exit -1 - } - while {[gets $fd line] >= 0} { - puts $line - } - close $fd - exit -1 + + if {$debug == ""} { + if {[catch {exec make >& compile.errors} res]} { + puts "\n------------ Compile error in $target -------------------\n" + if {[catch {open compile.errors r} fd]} { + puts "Compile failed for unknown reasons" + exit -1 + } + while {[gets $fd line] >= 0} { + puts $line + } + close $fd + exit -1 + } } else { - if {![catch {open compile.errors r} fd]} { - # search for warnings - set bad 0 + if {[catch {exec make debug >& compile.errors} res]} { + puts "\n------------ Compile error in $target -------------------\n" + if {[catch {open compile.errors r} fd]} { + puts "Compile failed for unknown reasons" + exit -1 + } while {[gets $fd line] >= 0} { - if {$verbose} { - puts $line - } else { - if {[regexp {[^W]*([A-Za-z][A-Za-z0-9_]*)[^\"]*\"([^\"]*)} $line match warn var]} { - if {$warn == "Warning"} { - switch $var { - _stp_ctrl_unregister - - _stp_ctrl_register - - relay_subbufs_consumed - - _stp_ctrl_send - - relay_open - - relayfs_create_dir - - relayfs_remove_dir - - relay_flush - - relay_switch_subbuf - - relay_close {} - default { - if {$bad == 0} { - puts "\n------------ Unexpected Warnings in $target -------------------\n" - } + puts $line + } + close $fd + exit -1 + } + } + + if {![catch {open compile.errors r} fd]} { + # search for warnings + set bad 0 + while {[gets $fd line] >= 0} { + if {$verbose} { + puts $line + } else { + if {[regexp {[^W]*([A-Za-z][A-Za-z0-9_]*)[^\"]*\"([^\"]*)} $line match warn var]} { + if {$warn == "Warning"} { + switch $var { + _stp_ctrl_unregister - + _stp_ctrl_register - + relay_subbufs_consumed - + _stp_ctrl_send - + relay_open - + relayfs_create_dir - + relayfs_remove_dir - + relay_flush - + relay_switch_subbuf - + relay_close {} + default { + if {$bad == 0} { + puts "\n------------ Unexpected Warnings in $target -------------------\n" + } puts $line set bad 1 - } } } } } } - close $fd - } - if {$bad} { - exit -1 } + close $fd + } + if {$bad} { + exit -1 } } } set clean 0 set verbose 0 - +set debug "" foreach arg $argv { if {$arg == "clean"} { set clean 1 } elseif {$arg == "-v"} { set verbose 1 + } elseif {$arg == "debug"} { + set debug $arg } elseif {$arg != ""} { usage } } if {![catch {open targets r} tfd]} { - while {[gets $tfd line] >= 0} { - set target [lindex $line 0] - create_makefile $target - build $target - catch {exec /bin/rm Makefile} - } + while {[gets $tfd line] >= 0} { + set target [lindex $line 0] + create_makefile $target + build $target + catch {exec /bin/rm Makefile} + } close $tfd } else { if {![file exists Makefile]} { |