diff options
author | Tim Moore <timoore@redhat.com> | 2009-12-10 21:36:43 +0100 |
---|---|---|
committer | Tim Moore <timoore@redhat.com> | 2009-12-10 21:36:43 +0100 |
commit | a6b3c131a27bbf3533d7ce52bb320698edb60f9c (patch) | |
tree | e11b9ef96482de802cb4c078296dcb7ee88f13c5 | |
parent | 1b9fad80af5504ef03c2a88504dbc47bea003721 (diff) | |
parent | b25c01a187d636f1bd3c8c414e7dbe3e84c1b266 (diff) | |
download | systemtap-steved-a6b3c131a27bbf3533d7ce52bb320698edb60f9c.tar.gz systemtap-steved-a6b3c131a27bbf3533d7ce52bb320698edb60f9c.tar.xz systemtap-steved-a6b3c131a27bbf3533d7ce52bb320698edb60f9c.zip |
Merge commit 'origin/master'
-rw-r--r-- | includes/sys/sdt.h | 18 | ||||
-rw-r--r-- | loc2c.c | 19 | ||||
-rw-r--r-- | runtime/addr-map.c | 11 | ||||
-rw-r--r-- | runtime/itrace.c | 9 | ||||
-rw-r--r-- | runtime/stat-common.c | 18 | ||||
-rw-r--r-- | tapsets.cxx | 10 |
6 files changed, 58 insertions, 27 deletions
diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index d85d8e2e..7c23d55a 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -12,9 +12,11 @@ #ifdef __LP64__ -#define STAP_PROBE_ADDR "\t.quad " +#define STAP_PROBE_ADDR(arg) "\t.quad " arg +#elif defined (__BIG_ENDIAN__) +#define STAP_PROBE_ADDR(arg) "\t.long 0\n\t.long " arg #else -#define STAP_PROBE_ADDR "\t.long " +#define STAP_PROBE_ADDR(arg) "\t.long " arg #endif /* Allocated section needs to be writable when creating pic shared objects @@ -26,14 +28,14 @@ /* An allocated section .probes that holds the probe names and addrs. */ #define STAP_PROBE_DATA_(probe,guard,arg) \ __asm__ volatile (".section .probes," ALLOCSEC "\n" \ - "\t.align 8\n" \ + "\t.balign 8\n" \ "1:\n\t.asciz " #probe "\n" \ - "\t.align 4\n" \ + "\t.balign 4\n" \ "\t.int " #guard "\n" \ - "\t.align 8\n" \ - STAP_PROBE_ADDR "1b\n" \ - "\t.align 8\n" \ - STAP_PROBE_ADDR #arg "\n" \ + "\t.balign 8\n" \ + STAP_PROBE_ADDR("1b\n") \ + "\t.balign 8\n" \ + STAP_PROBE_ADDR(#arg "\n") \ "\t.int 0\n" \ "\t.previous\n") @@ -76,6 +76,15 @@ struct location }; }; +/* Select the C type to use in the emitted code to represent slots in the + DWARF expression stack. For really proper semantics this should be the + target address size. */ +static const char * +stack_slot_type (struct location *context __attribute__ ((unused)), bool sign) +{ + return sign ? STACK_TYPE : UTYPE; +} + static struct location * alloc_location (struct obstack *pool, struct location *origin) { @@ -491,7 +500,8 @@ translate (struct obstack *pool, int indent, Dwarf_Addr addrbias, POP (b); POP (a); push ("(%s) " STACKFMT " >> (%s)" STACKFMT, - UTYPE, a, UTYPE, b); + stack_slot_type (loc, true), a, + stack_slot_type (loc, true), b); break; } @@ -2187,7 +2197,8 @@ emit_loc_address (FILE *out, struct location *loc, unsigned int indent, else { emit ("%*s{\n", indent * 2, ""); - emit ("%*s%s " STACKFMT, (indent + 1) * 2, "", STACK_TYPE, 0); + emit ("%*s%s " STACKFMT, (indent + 1) * 2, "", + stack_slot_type (loc, false), 0); unsigned i; for (i = 1; i < loc->address.stack_depth; ++i) emit (", " STACKFMT, i); @@ -2207,7 +2218,7 @@ emit_loc_value (FILE *out, struct location *loc, unsigned int indent, bool *used_deref, unsigned int *max_stack) { if (declare) - emit ("%*s%s %s;\n", indent * 2, "", STACK_TYPE, target); + emit ("%*s%s %s;\n", indent * 2, "", stack_slot_type (loc, false), target); emit_header (out, loc, indent++); @@ -2260,7 +2271,7 @@ c_emit_location (FILE *out, struct location *loc, int indent, { if (l->byte_size == 0 || l->byte_size == (Dwarf_Word) -1) emit ("%*s%s %s;\n", (indent + 1) * 2, "", - STACK_TYPE, l->address.declare); + stack_slot_type (l, false), l->address.declare); else emit ("%*suint%" PRIu64 "_t %s;\n", (indent + 1) * 2, "", l->byte_size * 8, l->address.declare); diff --git a/runtime/addr-map.c b/runtime/addr-map.c index 35de7a64..abb723f3 100644 --- a/runtime/addr-map.c +++ b/runtime/addr-map.c @@ -163,12 +163,11 @@ add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr, spin_unlock(&addr_map_lock); if (new_map) { - kfree(new_map); + _stp_kfree(new_map); new_map = 0; } - new_map = kmalloc(sizeof(*new_map) - + sizeof(*new_entry) * (old_size + 1), - GFP_KERNEL); + new_map = _stp_kmalloc(sizeof(*new_map) + + sizeof(*new_entry) * (old_size + 1)); if (!new_map) return -ENOMEM; new_map->size = old_size + 1; @@ -191,7 +190,7 @@ add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr, if (existing_max) *existing_max = max_entry; spin_unlock(&addr_map_lock); - kfree(new_map); + _stp_kfree(new_map); return 1; } existing = upper_bound(min_addr, old_map); @@ -210,7 +209,7 @@ add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr, blackmap = new_map; spin_unlock(&addr_map_lock); if (old_map) - kfree(old_map); + _stp_kfree(old_map); return 0; } diff --git a/runtime/itrace.c b/runtime/itrace.c index f2ed86f2..5b2437a4 100644 --- a/runtime/itrace.c +++ b/runtime/itrace.c @@ -219,7 +219,12 @@ static struct itrace_info *create_itrace_info( if (debug) printk(KERN_INFO "create_itrace_info: tid=%d\n", tsk->pid); /* initialize ui */ - ui = kzalloc(sizeof(struct itrace_info), GFP_USER); + ui = _stp_kzalloc(sizeof(struct itrace_info)); + if (ui == NULL) { + printk(KERN_ERR "%s:%d: Unable to allocate memory\n", + __FUNCTION__, __LINE__); + return NULL; + } ui->tsk = tsk; ui->tid = tsk->pid; ui->step_flag = step_flag; @@ -329,7 +334,7 @@ void static remove_usr_itrace_info(struct itrace_info *ui) spin_lock(&itrace_lock); list_del(&ui->link); spin_unlock(&itrace_lock); - kfree(ui); + _stp_kfree(ui); } void static cleanup_usr_itrace(void) diff --git a/runtime/stat-common.c b/runtime/stat-common.c index f9703049..fabe8404 100644 --- a/runtime/stat-common.c +++ b/runtime/stat-common.c @@ -34,9 +34,10 @@ static int _stp_stat_calc_buckets(int stop, int start, int interval) return buckets; } -static int needed_space(uint64_t v) +static int needed_space(int64_t v) { int space = 0; + uint64_t tmp; if (v == 0) return 1; @@ -45,9 +46,10 @@ static int needed_space(uint64_t v) space++; v = -v; } - while (v) { + tmp = v; + while (tmp) { /* v /= 10; */ - do_div (v, 10); + do_div(tmp, 10); space++; } return space; @@ -134,7 +136,8 @@ static void _stp_stat_print_histogram_buf(char *buf, size_t size, Hist st, stat { int scale, i, j, val_space, cnt_space; int low_bucket = -1, high_bucket = 0, over = 0, under = 0; - uint64_t val, v, valmax = 0; + int64_t val, valmax = 0; + uint64_t v; int eliding = 0; char *cur_buf = buf, *fake = buf; char **bufptr = (buf == NULL ? &fake : &cur_buf); @@ -282,7 +285,7 @@ static void _stp_stat_print_histogram(Hist st, stat *sd) _stp_print_flush(); } -static void __stp_stat_add (Hist st, stat *sd, uint64_t val) +static void __stp_stat_add(Hist st, stat *sd, int64_t val) { int n; if (sd->count == 0) { @@ -310,7 +313,10 @@ static void __stp_stat_add (Hist st, stat *sd, uint64_t val) if (val < 0) val = 0; else { - do_div (val, st->interval); + uint64_t tmp = val; + + do_div(tmp, st->interval); + val = tmp; val++; } diff --git a/tapsets.cxx b/tapsets.cxx index bad72091..555a6587 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -3829,7 +3829,13 @@ sdt_query::init_probe_scn() bool sdt_query::get_next_probe() { - // Extract probe info from the .probes section + // Extract probe info from the .probes section, e.g. + // 74657374 5f70726f 62655f32 00000000 test_probe_2.... + // 50524233 00000000 980c2000 00000000 PRB3...... ..... + // 01000000 00000000 00000000 00000000 ................ + // test_probe_2 is probe_name, probe_type is 50524233, + // *probe_name (pbe->name) is 980c2000, probe_arg (pbe->arg) is 1 + // probe_scn_offset is position currently being scanned in .probes while (probe_scn_offset < pdata->d_size) { @@ -3855,6 +3861,8 @@ sdt_query::get_next_probe() probe_scn_offset += sizeof(__uint32_t); probe_scn_offset += probe_scn_offset % sizeof(__uint64_t); pbe = (struct probe_entry*) ((char*)pdata->d_buf + probe_scn_offset); + if (pbe->name == 0) + return false; probe_name = (char*)((char*)pdata->d_buf + pbe->name - (char*)probe_scn_addr); probe_arg = pbe->arg; if (sess.verbose > 4) |