summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--buildrun.cxx2
-rw-r--r--runtime/ChangeLog5
-rw-r--r--runtime/autoconf-module-nsections.c8
-rw-r--r--runtime/transport/ChangeLog6
-rw-r--r--runtime/transport/symbols.c19
6 files changed, 40 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a9c22930..0aee4d96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-15 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 6405
+ * buildrun.cxx (compile_pass): Add STAPCONF_MODULE_NSECTIONS.
+
2008-04-14 David Smith <dsmith@redhat.com>
* elaborate.h (struct derived_probe_group): Removed
diff --git a/buildrun.cxx b/buildrun.cxx
index a186326f..76efe7c0 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -93,9 +93,9 @@ compile_pass (systemtap_session& s)
o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-tsc-khz.c, -DSTAPCONF_TSC_KHZ,)" << endl;
o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-ktime-get-real.c, -DSTAPCONF_KTIME_GET_REAL,)" << endl;
o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-x86-uniregs.c, -DSTAPCONF_X86_UNIREGS,)" << endl;
-
o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-nameidata.c, -DSTAPCONF_NAMEIDATA_CLEANUP,)" << endl;
o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-unregister-kprobes.c, -DSTAPCONF_UNREGISTER_KPROBES,)" << endl;
+ o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-module-nsections.c, -DSTAPCONF_MODULE_NSECTIONS,)" << endl;
for (unsigned i=0; i<s.macros.size(); i++)
o << "EXTRA_CFLAGS += -D " << lex_cast_qstring(s.macros[i]) << endl;
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index 69eb6c36..b33fa22a 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,5 +1,10 @@
2008-04-15 Frank Ch. Eigler <fche@elastic.org>
+ PR 6405
+ * autoconf-module-nsections.c: New file.
+
+2008-04-15 Frank Ch. Eigler <fche@elastic.org>
+
* unwind/i386.h (STACK_BOTTOM, STACK_TOP): Comment out these
unused definitions, for they collide with some kernels
(2.6.25-0.121.rc5.git4 rawhide).
diff --git a/runtime/autoconf-module-nsections.c b/runtime/autoconf-module-nsections.c
new file mode 100644
index 00000000..c1ce58b7
--- /dev/null
+++ b/runtime/autoconf-module-nsections.c
@@ -0,0 +1,8 @@
+#include <linux/module.h>
+
+struct module_sect_attrs x;
+
+void foo (void)
+{
+ (void) x.nsections;
+}
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog
index b3a159e3..f031c088 100644
--- a/runtime/transport/ChangeLog
+++ b/runtime/transport/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-15 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 6405
+ * symbols.c (_stp_load_module_symbols): Support older kernels
+ without module->sect_attrs->nsections.
+
2008-04-09 Martin Hunt <hunt@dragon>
* symbols.c (_stp_init_kernel_symbols): Print error
diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c
index b0e7c319..8cce2fd4 100644
--- a/runtime/transport/symbols.c
+++ b/runtime/transport/symbols.c
@@ -401,14 +401,25 @@ static int _stp_section_is_interesting(const char *name)
static struct _stp_module *_stp_load_module_symbols(struct module *mod)
{
int i, num, overflow = 0;
- struct module_sect_attrs *sa;
+ struct module_sect_attrs *sa = mod->sect_attrs;
+ struct attribute_group *sag = & sa->grp;
unsigned sect_size = 0, sect_num = 0, sym_size, sym_num;
struct _stp_module *sm;
char *dataptr, *endptr;
+ unsigned nsections = 0;
+
+#ifdef STAPCONF_MODULE_NSECTIONS
+ nsections = sa->nsections;
+#else
+ /* count section attributes on older kernel */
+ struct attribute** gattr;
+ for (gattr = sag->attrs; *gattr; gattr++)
+ nsections++;
+ dbug_sym(2, "\tcount %d\n", nsections);
+#endif
- sa = mod->sect_attrs;
/* calculate how much space to allocate for section strings */
- for (i = 0; i < sa->nsections; i++) {
+ for (i = 0; i < nsections; i++) {
if (_stp_section_is_interesting(sa->attrs[i].name)) {
sect_num++;
sect_size += strlen(sa->attrs[i].name) + 1;
@@ -438,7 +449,7 @@ static struct _stp_module *_stp_load_module_symbols(struct module *mod)
dataptr = (char *)((long)sm->sections + sect_num * sizeof(struct _stp_symbol));
endptr = (char *)((long)sm->sections + sect_size);
num = 0;
- for (i = 0; i < sa->nsections; i++) {
+ for (i = 0; i < nsections; i++) {
size_t len, maxlen;
if (_stp_section_is_interesting(sa->attrs[i].name)) {
sm->sections[num].addr = sa->attrs[i].address;