diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-04-15 01:22:46 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-04-15 01:22:46 -0400 |
commit | d9bdb83d6f14ddfb2980b62655a12cd11771af88 (patch) | |
tree | 38330b0f1865bae9baab8a9343bc501371aade71 /runtime/transport/symbols.c | |
parent | 184b2d42207667089c20208d8c63c4fcb2d481aa (diff) | |
download | systemtap-steved-d9bdb83d6f14ddfb2980b62655a12cd11771af88.tar.gz systemtap-steved-d9bdb83d6f14ddfb2980b62655a12cd11771af88.tar.xz systemtap-steved-d9bdb83d6f14ddfb2980b62655a12cd11771af88.zip |
PR6405: unwinder build compatibility with RHEL5
Diffstat (limited to 'runtime/transport/symbols.c')
-rw-r--r-- | runtime/transport/symbols.c | 19 |
1 files changed, 15 insertions, 4 deletions
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; |