summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--ChangeLog18
-rw-r--r--Makefile.am4
-rw-r--r--Makefile.in4
-rw-r--r--doc/Makefile.in4
-rw-r--r--parse.h2
-rw-r--r--runtime/ChangeLog22
-rw-r--r--runtime/regs-ia64.c8
-rw-r--r--runtime/task_finder.c61
-rw-r--r--tapsets.cxx4
10 files changed, 108 insertions, 20 deletions
diff --git a/.gitignore b/.gitignore
index ad272dc6..72fca2ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
autom4te.*
cscope.files
cscope*out
+gmon.out
config.h
config.log
config.status
diff --git a/ChangeLog b/ChangeLog
index 5e137fe7..96bf7747 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,22 @@
+2008-09-12 Masami Hiramatsu <mhiramat@redhat.com>
+
+ BZ 6028
+ * tapsets.cxx (dwarf_derived_probe::emit_probe_local_init): Use REG_IP
+ instead of pp to check probe address.
+
+2008-09-12 Frank Ch. Eigler <fche@elastic.org>
+
+ GCC 4.4 (var-tracking) build-compatilibity.
+ * parse.h: #include <stdint.h>.
+ * tapsets.cxx (utrace_...::visit_target_symbol_arg): Use
+ lex_cast<int>(foo) instead of atoi(foo.c_str()) for simpler
+ c++ object lifetime.
+ * Makefile.am (staprun_CFLAGS, stapio_CFLAGS): Add
+ -fno-strict-aliasing, since that code is too casual with pointers.
+ * Makefile.in: Regenerated.
+
2008-09-12 Dave Brolley <brolley@redhat.com>
+
PR6881.
From Eugeniy Meshcheryakov eugen@debian.org:
* stap-server.8.in: Correct formatting problems.
diff --git a/Makefile.am b/Makefile.am
index c1bcd11e..1e356a4f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -100,14 +100,14 @@ staprun_SOURCES = runtime/staprun/staprun.c runtime/staprun/staprun_funcs.c\
runtime/staprun/ctl.c runtime/staprun/common.c
staprun_CPPFLAGS = $(AM_CPPFLAGS)
-staprun_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -DSINGLE_THREADED
+staprun_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -DSINGLE_THREADED -fno-strict-aliasing
staprun_LDADD = @PROCFLAGS@
stapio_SOURCES = runtime/staprun/stapio.c \
runtime/staprun/mainloop.c runtime/staprun/common.c \
runtime/staprun/ctl.c \
runtime/staprun/relay.c runtime/staprun/relay_old.c
-stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS)
+stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -fno-strict-aliasing
stapio_LDADD = @PROCFLAGS@ -lpthread
install-exec-hook:
diff --git a/Makefile.in b/Makefile.in
index 08d82151..22336ec0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -292,14 +292,14 @@ staprun_SOURCES = runtime/staprun/staprun.c runtime/staprun/staprun_funcs.c\
runtime/staprun/ctl.c runtime/staprun/common.c
staprun_CPPFLAGS = $(AM_CPPFLAGS)
-staprun_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -DSINGLE_THREADED
+staprun_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -DSINGLE_THREADED -fno-strict-aliasing
staprun_LDADD = @PROCFLAGS@
stapio_SOURCES = runtime/staprun/stapio.c \
runtime/staprun/mainloop.c runtime/staprun/common.c \
runtime/staprun/ctl.c \
runtime/staprun/relay.c runtime/staprun/relay_old.c
-stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS)
+stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -fno-strict-aliasing
stapio_LDADD = @PROCFLAGS@ -lpthread
loc2c_test_SOURCES = loc2c-test.c loc2c.c
loc2c_test_CPPFLAGS = $(stap_CPPFLAGS)
diff --git a/doc/Makefile.in b/doc/Makefile.in
index aed03ee2..c003c742 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
diff --git a/parse.h b/parse.h
index 50b1507d..cf31f4f8 100644
--- a/parse.h
+++ b/parse.h
@@ -16,7 +16,7 @@
#include <iostream>
#include <vector>
#include <stdexcept>
-
+#include <stdint.h>
struct source_loc
{
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index 97b1a0c0..6ad7e51f 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,25 @@
+2008-09-12 Masami Hiramatsu <mhiramat@redhat.com>
+
+ BZ 6028
+ * regs-ia64.c (bspcache): Use REG_IP instead of pp to check probe
+ address.
+
+2008-09-12 David Smith <dsmith@redhat.com>
+
+ BZ 6755
+ * task_finder.c: Added 'inuse' count to know when handlers are still
+ running.
+ (__stp_utrace_task_finder_report_clone): If state isn't correct,
+ detach. Increase 'inuse' count when starting, decrement when
+ exiting.
+ (__stp_utrace_task_finder_report_exec): Ditto.
+ (__stp_utrace_task_finder_target_death): Ditto.
+ (__stp_utrace_task_finder_target_quiesce): Increase 'inuse' count
+ when starting, decrement when exiting.
+ (__stp_utrace_task_finder_target_syscall_entry): Ditto.
+ (__stp_utrace_task_finder_target_syscall_exit): Ditto.
+ (stap_stop_task_finder): Wait until all callbacks are finished.
+
2008-09-10 Frank Ch. Eigler <fche@elastic.org>
* runtime.h (STP_USE_FRAME_POINTER): Remove architecture #if's.
diff --git a/runtime/regs-ia64.c b/runtime/regs-ia64.c
index 8ce3e4c3..b0eb9829 100644
--- a/runtime/regs-ia64.c
+++ b/runtime/regs-ia64.c
@@ -39,10 +39,10 @@ static void ia64_stap_get_arbsp(struct unw_frame_info *info, void *arg)
* bspcache: get cached unwound address and
* set a probe local cache of the offset of unwound address.
*/
-#define bspcache(cache, regs, pp)\
+#define bspcache(cache, regs)\
if(regs) {\
static unsigned __offset = 0; /* probe local cache */\
- static const char * __pp = NULL; /* reference probe point */\
+ static void * __ip = NULL; /* reference ip */\
unsigned long *bsp;\
asm volatile("{ flushrs }\n"); /* flushrs for fixing bsp */\
bsp = (void*)ia64_getreg(_IA64_REG_AR_BSP);\
@@ -53,10 +53,10 @@ static void ia64_stap_get_arbsp(struct unw_frame_info *info, void *arg)
if (pa.address != 0) {\
__offset = ia64_rse_num_regs(pa.address, bsp)\
-(regs->cr_ifs & 127);\
- __pp = (const char *)pp;\
+ __ip = (void *)REG_IP(regs);\
cache = pa.address;\
}\
- } else if (pp == __pp)\
+ } else if ((void *)REG_IP(regs) == __ip)\
cache = ia64_rse_skip_regs(bsp,\
-(__offset + (regs->cr_ifs & 127)));\
}
diff --git a/runtime/task_finder.c b/runtime/task_finder.c
index cbb10d35..493ca6f7 100644
--- a/runtime/task_finder.c
+++ b/runtime/task_finder.c
@@ -23,6 +23,10 @@ struct stap_task_finder_target;
#define __STP_TF_STOPPING 2
#define __STP_TF_STOPPED 3
atomic_t __stp_task_finder_state = ATOMIC_INIT(__STP_TF_STARTING);
+atomic_t __stp_inuse_count = ATOMIC_INIT (0);
+
+#define __stp_tf_handler_start() (atomic_inc(&__stp_inuse_count))
+#define __stp_tf_handler_end() (atomic_dec(&__stp_inuse_count))
#ifdef DEBUG_TASK_FINDER
atomic_t __stp_attach_count = ATOMIC_INIT (0);
@@ -30,7 +34,9 @@ atomic_t __stp_attach_count = ATOMIC_INIT (0);
#define debug_task_finder_attach() (atomic_inc(&__stp_attach_count))
#define debug_task_finder_detach() (atomic_dec(&__stp_attach_count))
#define debug_task_finder_report() (_stp_dbug(__FUNCTION__, __LINE__, \
- "attach count: %d\n", atomic_read(&__stp_attach_count)))
+ "attach count: %d, inuse count: %d\n", \
+ atomic_read(&__stp_attach_count), \
+ atomic_read(&__stp_inuse_count)))
#else
#define debug_task_finder_attach() /* empty */
#define debug_task_finder_detach() /* empty */
@@ -587,17 +593,24 @@ __stp_utrace_task_finder_report_clone(enum utrace_resume_action action,
char *mmpath_buf;
char *mmpath;
- if (atomic_read(&__stp_task_finder_state) != __STP_TF_RUNNING)
- return UTRACE_RESUME;
+ if (atomic_read(&__stp_task_finder_state) != __STP_TF_RUNNING) {
+ debug_task_finder_detach();
+ return UTRACE_DETACH;
+ }
+
+ __stp_tf_handler_start();
// On clone, attach to the child.
rc = stap_utrace_attach(child, engine->ops, 0,
__STP_TASK_FINDER_EVENTS);
- if (rc != 0 && rc != EPERM)
+ if (rc != 0 && rc != EPERM) {
+ __stp_tf_handler_end();
return UTRACE_RESUME;
+ }
__stp_utrace_attach_match_tsk(parent, child, 1,
(clone_flags & CLONE_THREAD) == 0);
+ __stp_tf_handler_end();
return UTRACE_RESUME;
}
@@ -622,8 +635,12 @@ __stp_utrace_task_finder_report_exec(enum utrace_resume_action action,
struct stap_task_finder_target *tgt;
int found_node = 0;
- if (atomic_read(&__stp_task_finder_state) != __STP_TF_RUNNING)
- return UTRACE_RESUME;
+ if (atomic_read(&__stp_task_finder_state) != __STP_TF_RUNNING) {
+ debug_task_finder_detach();
+ return UTRACE_DETACH;
+ }
+
+ __stp_tf_handler_start();
// When exec'ing, we need to let callers detach from the
// parent thread (if necessary). For instance, assume
@@ -646,6 +663,7 @@ __stp_utrace_task_finder_report_exec(enum utrace_resume_action action,
// relative.
__stp_utrace_attach_match_tsk(tsk, tsk, 1, 1);
+ __stp_tf_handler_end();
return UTRACE_RESUME;
}
@@ -682,6 +700,7 @@ __stp_utrace_task_finder_target_death(struct utrace_attached_engine *engine,
return UTRACE_DETACH;
}
+ __stp_tf_handler_start();
// The first implementation of this added a
// UTRACE_EVENT(DEATH) handler to
// __stp_utrace_task_finder_ops. However, dead threads don't
@@ -703,6 +722,7 @@ __stp_utrace_task_finder_target_death(struct utrace_attached_engine *engine,
(int)tsk->pid, rc);
}
}
+ __stp_tf_handler_end();
debug_task_finder_detach();
return UTRACE_DETACH;
}
@@ -727,8 +747,12 @@ __stp_utrace_task_finder_target_quiesce(enum utrace_resume_action action,
return UTRACE_DETACH;
}
- if (tgt == NULL)
+ if (tgt == NULL) {
+ debug_task_finder_detach();
return UTRACE_DETACH;
+ }
+
+ __stp_tf_handler_start();
// Turn off quiesce handling
rc = utrace_set_events(tsk, engine,
@@ -807,6 +831,7 @@ __stp_utrace_task_finder_target_quiesce(enum utrace_resume_action action,
}
utftq_out:
+ __stp_tf_handler_end();
return UTRACE_RESUME;
}
@@ -865,6 +890,7 @@ __stp_utrace_task_finder_target_syscall_entry(enum utrace_resume_action action,
&& syscall_no != MUNMAP_SYSCALL_NO(tsk))
return UTRACE_RESUME;
+ __stp_tf_handler_start();
// We need the first syscall argument to see what address
// we're operating on.
@@ -889,6 +915,7 @@ __stp_utrace_task_finder_target_syscall_entry(enum utrace_resume_action action,
mmput(mm);
}
}
+ __stp_tf_handler_end();
return UTRACE_RESUME;
}
@@ -1003,6 +1030,7 @@ __stp_utrace_task_finder_target_syscall_exit(enum utrace_resume_action action,
: "UNKNOWN")))),
arg0, rv);
#endif
+ __stp_tf_handler_start();
// Try to find the vma info we might have saved.
if (arg0 != (unsigned long)NULL)
@@ -1110,6 +1138,7 @@ __stp_utrace_task_finder_target_syscall_exit(enum utrace_resume_action action,
// Cleanup by deleting the saved vma info.
__stp_tf_remove_vma_entry(entry);
}
+ __stp_tf_handler_end();
return UTRACE_RESUME;
}
@@ -1232,12 +1261,30 @@ stap_start_task_finder(void)
static void
stap_stop_task_finder(void)
{
+#ifdef DEBUG_TASK_FINDER
+ int i = 0;
+#endif
+
atomic_set(&__stp_task_finder_state, __STP_TF_STOPPING);
debug_task_finder_report();
stap_utrace_detach_ops(&__stp_utrace_task_finder_ops);
__stp_task_finder_cleanup();
debug_task_finder_report();
atomic_set(&__stp_task_finder_state, __STP_TF_STOPPED);
+
+ /* Now that all the engines are detached, make sure
+ * all the callbacks are finished. If they aren't, we'll
+ * crash the kernel when the module is removed. */
+ while (atomic_read(&__stp_inuse_count) != 0) {
+ schedule();
+#ifdef DEBUG_TASK_FINDER
+ i++;
+#endif
+ }
+#ifdef DEBUG_TASK_FINDER
+ if (i > 0)
+ printk(KERN_ERR "it took %d polling loops to quit.\n", i);
+#endif
}
diff --git a/tapsets.cxx b/tapsets.cxx
index 4d47dca1..85505084 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -4747,7 +4747,7 @@ void
dwarf_derived_probe::emit_probe_local_init(translator_output * o)
{
// emit bsp cache setup
- o->newline() << "bspcache(c->unwaddr, c->regs, c->probe_point);";
+ o->newline() << "bspcache(c->unwaddr, c->regs);";
}
// ------------------------------------------------------------------------
@@ -5927,7 +5927,7 @@ void
utrace_var_expanding_copy_visitor::visit_target_symbol_arg (target_symbol* e)
{
string argnum_s = e->base_name.substr(4,e->base_name.length()-4);
- int argnum = atoi (argnum_s.c_str());
+ int argnum = lex_cast<int>(argnum_s);
if (flags != UDPF_SYSCALL)
throw semantic_error ("only \"process(PATH_OR_PID).syscall\" support $argN.", e->tok);