summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddomingo <ddomingo@redhat.com>2009-03-09 18:49:41 +1000
committerddomingo <ddomingo@redhat.com>2009-03-09 18:49:41 +1000
commit7516b286e0909504bd958ad2b8050d5d8afbd508 (patch)
tree72b7ecd89f80c278f3489119fa3bd26282e6e66a
parent2e802851f3c72d841fe436ec1e178d858bb37f6d (diff)
parentf9355a6c0645c7efa0b7bc7894231b51b9f7e91c (diff)
downloadsystemtap-steved-7516b286e0909504bd958ad2b8050d5d8afbd508.tar.gz
systemtap-steved-7516b286e0909504bd958ad2b8050d5d8afbd508.tar.xz
systemtap-steved-7516b286e0909504bd958ad2b8050d5d8afbd508.zip
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
-rw-r--r--buildrun.cxx1
-rw-r--r--elaborate.cxx1
-rw-r--r--runtime/alloc.c25
-rw-r--r--runtime/autoconf-alloc-percpu-align.c6
-rw-r--r--session.h2
-rw-r--r--tapsets.cxx6
-rw-r--r--testsuite/systemtap.base/labels.exp86
-rw-r--r--translate.cxx3
8 files changed, 102 insertions, 28 deletions
diff --git a/buildrun.cxx b/buildrun.cxx
index 2685949d..b9d648ef 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -147,6 +147,7 @@ compile_pass (systemtap_session& s)
output_autoconf(s, o, "autoconf-task-uid.c", "STAPCONF_TASK_UID", NULL);
output_autoconf(s, o, "autoconf-vm-area.c", "STAPCONF_VM_AREA", NULL);
output_autoconf(s, o, "autoconf-procfs-owner.c", "STAPCONF_PROCFS_OWNER", NULL);
+ output_autoconf(s, o, "autoconf-alloc-percpu-align.c", "STAPCONF_ALLOC_PERCPU_ALIGN", NULL);
#if 0
/* NB: For now, the performance hit of probe_kernel_read/write (vs. our
diff --git a/elaborate.cxx b/elaborate.cxx
index 0a00ebf2..34e6ab16 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1448,6 +1448,7 @@ systemtap_session::systemtap_session ():
timer_derived_probes(0),
profile_derived_probes(0),
mark_derived_probes(0),
+ tracepoint_derived_probes(0),
hrtimer_derived_probes(0),
perfmon_derived_probes(0),
procfs_derived_probes(0),
diff --git a/runtime/alloc.c b/runtime/alloc.c
index 89d16612..439e8a7e 100644
--- a/runtime/alloc.c
+++ b/runtime/alloc.c
@@ -233,30 +233,14 @@ static void *_stp_vmalloc(unsigned long size)
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
static void *_stp_alloc_percpu(size_t size)
{
-#ifdef DEBUG_MEM
+#ifdef STAPCONF_ALLOC_PERCPU_ALIGN
void *ret = __alloc_percpu(size, 8);
- if (likely(ret)) {
- struct _stp_mem_entry *m = kmalloc(sizeof(struct _stp_mem_entry), STP_ALLOC_FLAGS);
- if (unlikely(m == NULL)) {
- free_percpu(ret);
- return NULL;
- }
- _stp_mem_debug_percpu(m, ret, size);
- _stp_allocated_memory += size * num_online_cpus();
- }
- return ret;
#else
- return __alloc_percpu(size, 8);
+ void *ret = __alloc_percpu(size);
#endif
-}
-#else
-static void *_stp_alloc_percpu(size_t size)
-{
#ifdef DEBUG_MEM
- void *ret = __alloc_percpu(size);
if (likely(ret)) {
struct _stp_mem_entry *m = kmalloc(sizeof(struct _stp_mem_entry), STP_ALLOC_FLAGS);
if (unlikely(m == NULL)) {
@@ -266,12 +250,9 @@ static void *_stp_alloc_percpu(size_t size)
_stp_mem_debug_percpu(m, ret, size);
_stp_allocated_memory += size * num_online_cpus();
}
- return ret;
-#else
- return __alloc_percpu(size);
#endif
+ return ret;
}
-#endif /* LINUX_VERSION_CODE */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
#define _stp_kmalloc_node(size,node) _stp_kmalloc(size)
diff --git a/runtime/autoconf-alloc-percpu-align.c b/runtime/autoconf-alloc-percpu-align.c
new file mode 100644
index 00000000..158d579c
--- /dev/null
+++ b/runtime/autoconf-alloc-percpu-align.c
@@ -0,0 +1,6 @@
+#include <linux/percpu.h>
+
+/* kernel commit f2a8205c */
+void foo (void) {
+ (void) __alloc_percpu(sizeof(int), 8);
+}
diff --git a/session.h b/session.h
index 8fa491fd..bc99385b 100644
--- a/session.h
+++ b/session.h
@@ -167,6 +167,8 @@ struct systemtap_session
hrtimer_derived_probe_group* hrtimer_derived_probes;
perfmon_derived_probe_group* perfmon_derived_probes;
procfs_derived_probe_group* procfs_derived_probes;
+ // NB: It is very important for all of the above (and below) fields
+ // to be cleared in the systemtap_session ctor (elaborate.cxx).
// unparser data
translator_output* op;
diff --git a/tapsets.cxx b/tapsets.cxx
index 02f0b553..d99eebe2 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -3920,9 +3920,9 @@ query_dwarf_func (Dwarf_Die * func, base_query * bq)
else if (q->has_function_num || q->has_statement_num)
{
Dwarf_Addr query_addr =
- q->dw.module_address_to_global(q->has_function_num ? q->function_num_val :
- q->has_statement_num ? q->statement_num_val :
- (assert(0) , 0));
+ (q->has_function_num ? q->function_num_val :
+ q->has_statement_num ? q->statement_num_val :
+ (assert(0) , 0));
Dwarf_Die d;
q->dw.function_die (&d);
diff --git a/testsuite/systemtap.base/labels.exp b/testsuite/systemtap.base/labels.exp
index 9c92d69c..1b538dbb 100644
--- a/testsuite/systemtap.base/labels.exp
+++ b/testsuite/systemtap.base/labels.exp
@@ -13,6 +13,7 @@ if {$utrace_support_found == 0} { untested "$test"; return }
# Compile a C program to use as the user-space probing target
set label_srcpath "[pwd]/labels.c"
set label_exepath "[pwd]/labels.x"
+set label_sopath "[pwd]/labels.so"
set label_flags "additional_flags=-g"
set fp [open $label_srcpath "w"]
puts $fp "
@@ -54,9 +55,12 @@ if { $res != "" } {
pass "compiling labels.c -g"
}
+# label in an executable
+
verbose -log "spawn stap -c $label_exepath $label_stppath"
spawn stap -c $label_exepath $label_stppath
+wait
expect {
-timeout 180
-re {VARS a=0x0 b=0x0.*VARS a=0x2 b=0x0.*VARS a=0x2 b=0x3 c=0x[a-f01-9]} { incr ok; exp_continue }
@@ -64,7 +68,83 @@ expect {
eof { }
}
-wait
+if {$ok == 1} { pass "$test exe .label" } { fail "$test exe .label" }
+
+# address of label in an executable
+
+set label_shpath "[pwd]/label.sh"
+set fp [open $label_shpath "w"]
+puts $fp "
+readelf --debug-dump $label_exepath | awk \"
+/init_another_int/ {have_label=1}
+/DW_AT_low_pc/ {if (have_label) {print \$3;exit;}}
+\"
+"
+close $fp
+spawn sh $label_shpath
+expect {
+ -re {0x[0-9a-f]*}
+}
+set nomatch 0
+spawn stap -p2 -l "process\(\"$label_exepath\"\).statement($expect_out(0,string))"
+expect {
+ -timeout 180
+ -re {semantic error: no match} { incr nomatch; exp_continue }
+ timeout { fail "$test (timeout)" }
+ eof { }
+}
+
+if {$nomatch == 0} { pass "$test exe .statement" } { fail "$test exe .statement" }
+
+set ok 0
+
+set label_flags "additional_flags=-g additional_flags=-shared additional_flags=-fPIC"
+set res [target_compile $label_srcpath $label_sopath executable $label_flags]
+if { $res != "" } {
+ verbose "target_compile failed: $res" 2
+ fail "compiling labels.c -g"
+ catch {exec rm -f $label_srcpath $label_stppath}
+ return
+} else {
+ pass "compiling labels.c -g"
+}
+
+# label in a shared object
+
+spawn stap -p2 -l "process\(\"$label_sopath\"\).function\(\"\*\"\).label\(\"init_another_int\"\)"
+expect {
+ -timeout 180
+ -re {process.*function} { incr ok; exp_continue }
+ timeout { fail "$test (timeout)" }
+ eof { }
+}
+
+if {$ok == 1} { pass "$test so .label" } { fail "$test so .label" }
+
+# address of label in a shared object
+
+set label_shpath "[pwd]/label.sh"
+set fp [open $label_shpath "w"]
+puts $fp "
+readelf --debug-dump $label_sopath | awk \"
+/init_another_int/ {have_label=1}
+/DW_AT_low_pc/ {if (have_label) {print \$3;exit;}}
+\"
+"
+close $fp
+spawn sh $label_shpath
+expect {
+ -re {0x[0-9a-f]*}
+}
+set nomatch 0
+spawn stap -p2 -l "process\(\"$label_sopath\"\).statement($expect_out(0,string))"
+expect {
+ -timeout 180
+ -re {semantic error: no match} { incr nomatch; exp_continue }
+ timeout { fail "$test (timeout)" }
+ eof { }
+}
+
+if {$nomatch == 0} { pass "$test so .statement" } { fail "$test so .statement" }
-if {$ok == 1} { pass "$test" } { fail "$test ($ok)" }
-catch {exec rm -f $label_srcpath $label_stppath $label_exepath}
+# catch {exec rm -f $label_srcpath $label_stppath $label_exepath}
diff --git a/translate.cxx b/translate.cxx
index c679e0f1..b2ba5c72 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4458,6 +4458,9 @@ dump_unwindsyms (Dwfl_Module *m,
string modname = name;
+ if (pending_interrupts)
+ return DWARF_CB_ABORT;
+
// skip modules/files we're not actually interested in
if (c->session.unwindsym_modules.find(modname) == c->session.unwindsym_modules.end())
return DWARF_CB_OK;