From d9bdb83d6f14ddfb2980b62655a12cd11771af88 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 15 Apr 2008 01:22:46 -0400 Subject: PR6405: unwinder build compatibility with RHEL5 --- runtime/ChangeLog | 5 +++++ runtime/autoconf-module-nsections.c | 8 ++++++++ runtime/transport/ChangeLog | 6 ++++++ runtime/transport/symbols.c | 19 +++++++++++++++---- 4 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 runtime/autoconf-module-nsections.c (limited to 'runtime') diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 69eb6c36..b33fa22a 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,8 @@ +2008-04-15 Frank Ch. Eigler + + PR 6405 + * autoconf-module-nsections.c: New file. + 2008-04-15 Frank Ch. Eigler * unwind/i386.h (STACK_BOTTOM, STACK_TOP): Comment out these 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 + +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 + + PR 6405 + * symbols.c (_stp_load_module_symbols): Support older kernels + without module->sect_attrs->nsections. + 2008-04-09 Martin Hunt * 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; -- cgit