Do the search save_stack_trace_regs() in the stap module's initialization

Previously, the search for save_stack_trace_regs() was done the first
time the _stp_stack_print_fallback was called. However, want to avoid
calling kallsyms_lookup_name() in some arbitrary probe handler as it
may take a signficant amount of time to search for
save_stack_trace_regs().  Moving this search to where other
initialization operations are done and there are fewer contraints on
runninging it.
diff --git a/runtime/stack.c b/runtime/stack.c
index 3539dd3..90ad8b5 100644
--- a/runtime/stack.c
+++ b/runtime/stack.c
@@ -47,10 +47,19 @@
 #include <asm/unwind.h>
 #endif
 
-static int checked_stack_trace_fns;
 static void (*(save_stack_trace_regs_fn))(struct pt_regs *regs,
 				  struct stack_trace *trace);
 
+static int
+_stp_init_stack(void)
+{
+	/* check for save_stack_trace_regs function for fallback stack print */
+	save_stack_trace_regs_fn = (void *)kallsyms_lookup_name("save_stack_trace_regs");
+	dbug_unwind(1, "save_stack_trace_regs_fn=%lx for _stp_stack_print_fallback().\n",
+		    (unsigned long) save_stack_trace_regs_fn);
+	return 0;
+}
+
 static void _stp_stack_print_fallback(unsigned long, struct pt_regs*, int, int, int);
 
 #ifdef STP_USE_DWARF_UNWINDER
@@ -162,13 +171,6 @@
 	struct stack_trace trace;
 	int i;
 
-	/* One time check for save_stack_trace_regs */
-	if (!checked_stack_trace_fns) {
-		dbug_unwind(1, "fallback kernel stacktrace search for save_stack_trace_regs\n");
-		save_stack_trace_regs_fn = (void *)kallsyms_lookup_name("save_stack_trace_regs");
-		checked_stack_trace_fns = 1;
-	}
-
 	/* If don't have save_stack_trace_regs unwinder, just give up. */
 	if (!save_stack_trace_regs_fn) {
 		dbug_unwind(1, "no fallback kernel stacktrace (giving up)\n");
diff --git a/translate.cxx b/translate.cxx
index b15cbc2..2524f4e 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -1918,6 +1918,15 @@
   o->newline(-1) << "}";
   o->newline() << "#endif";
 
+  // initialize stack setup (if needed)
+  o->newline() << "#ifdef STP_NEED_UNWIND_DATA";
+  o->newline() << "rc = _stp_init_stack();";
+  o->newline() << "if (rc) {";
+  o->newline(1) << "_stp_error (\"couldn't initialize stack support\");";
+  o->newline() << "goto out;";
+  o->newline(-1) << "}";
+  o->newline() << "#endif";
+
   // NB: we don't need per-_stp_module task_finders, since a single common one
   // set up in runtime/sym.c's _stp_sym_init() will scan through all _stp_modules. XXX - check this!
   o->newline() << "(void) probe_point;";