diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/runtime.h | 2 | ||||
-rw-r--r-- | runtime/staprun/common.c | 9 | ||||
-rw-r--r-- | runtime/staprun/relay.c | 2 | ||||
-rw-r--r-- | runtime/staprun/relay_old.c | 4 | ||||
-rw-r--r-- | runtime/sym.c | 26 | ||||
-rw-r--r-- | runtime/uprobes/.gitignore | 7 |
6 files changed, 37 insertions, 13 deletions
diff --git a/runtime/runtime.h b/runtime/runtime.h index 822562a2..0a656b78 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -86,6 +86,8 @@ static struct #include "io.c" #include "arith.c" #include "copy.c" +#include "regs.c" +#include "regs-ia64.c" #include "task_finder.c" diff --git a/runtime/staprun/common.c b/runtime/staprun/common.c index 8200ec9d..26b166c2 100644 --- a/runtime/staprun/common.c +++ b/runtime/staprun/common.c @@ -82,7 +82,7 @@ int stap_strfloctime(char *buf, size_t max, const char *fmt, time_t t) num = tm.tm_year % 100; goto numbering02; case 'C': - num = ((tm.tm_year + 1900 - 1) / 100) + 1; + num = ((tm.tm_year + 1900) / 100); goto numbering; case 'm': num = tm.tm_mon + 1; @@ -107,7 +107,7 @@ int stap_strfloctime(char *buf, size_t max, const char *fmt, time_t t) if (num == 0) num = 12; goto numbering02; case 'j': - ret = snprintf(c, end - c, "%03d", tm.tm_yday); + ret = snprintf(c, end - c, "%03d", tm.tm_yday + 1); if (ret < 0) return ret; c += ret; break; @@ -117,7 +117,10 @@ int stap_strfloctime(char *buf, size_t max, const char *fmt, time_t t) case 'l': num = tm.tm_hour % 12; if (num == 0) num = 12; - goto numbering; + ret = snprintf(c, end - c, "%2d", num); + if (ret < 0) return ret; + c += ret; + break; case 'M': num = tm.tm_min; goto numbering02; diff --git a/runtime/staprun/relay.c b/runtime/staprun/relay.c index 50f295b5..694cb27e 100644 --- a/runtime/staprun/relay.c +++ b/runtime/staprun/relay.c @@ -200,7 +200,7 @@ static void *reader_thread(void *data) perr("Couldn't open file for cpu %d, exiting.", cpu); return(NULL); } - wsize = 0; + wsize = rc; } if (write(out_fd[cpu], buf, rc) != rc) { perr("Couldn't write to output %d for cpu %d, exiting.", out_fd[cpu], cpu); diff --git a/runtime/staprun/relay_old.c b/runtime/staprun/relay_old.c index ef8fd0da..469a5831 100644 --- a/runtime/staprun/relay_old.c +++ b/runtime/staprun/relay_old.c @@ -241,7 +241,7 @@ static int process_subbufs(struct _stp_buf_info *info, perr("Couldn't open file for cpu %d, exiting.", cpu); exit(1); } - scb->wsize = 0; + scb->wsize = len; } if (len) { if (fwrite_unlocked (subbuf_ptr, len, 1, percpu_tmpfile[cpu]) != 1) { @@ -320,7 +320,7 @@ int write_realtime_data(void *data, ssize_t nb) perr("Couldn't open file, exiting."); return -1; } - global_scb.wsize = 0; + global_scb.wsize = nb; } bw = write(out_fd[0], data, nb); if (bw >= 0 && bw != nb) { diff --git a/runtime/sym.c b/runtime/sym.c index d0c5d9fd..ecd64fee 100644 --- a/runtime/sym.c +++ b/runtime/sym.c @@ -106,8 +106,8 @@ static unsigned long _stp_module_relocate(const char *module, const char *sectio } -/* Return module owner and fills in closest section of the address - if found, return NULL otherwise. +/* Return module owner and, if sec != NULL, fills in closest section + of the address if found, return NULL otherwise. XXX: needs to be address-space-specific. */ static struct _stp_module *_stp_mod_sec_lookup(unsigned long addr, struct task_struct *task, @@ -151,7 +151,8 @@ static struct _stp_module *_stp_mod_sec_lookup(unsigned long addr, { closest_section_offset = this_section_offset; m = _stp_modules[midx]; - *sec = & m->sections[secidx]; + if (sec) + *sec = & m->sections[secidx]; } } } @@ -338,8 +339,15 @@ static int _stp_func_print(unsigned long address, int verbose, int exact) return 0; } +/** Puts symbolic information of an address in a string. + * @param src The string to fill in. + * @param len The length of the given src string. + * @param address The address to lookup. + * @param add_mod Whether to include module name information if found. + */ + static void _stp_symbol_snprint(char *str, size_t len, unsigned long address, - struct task_struct *task) + struct task_struct *task, int add_mod) { const char *modname; const char *name; @@ -347,9 +355,13 @@ static void _stp_symbol_snprint(char *str, size_t len, unsigned long address, name = _stp_kallsyms_lookup(address, &size, &offset, &modname, NULL, task); - if (name) - strlcpy(str, name, len); - else + if (name) { + if (add_mod && modname && *modname) + _stp_printf("%s %s+%#lx/%#lx\n", + name, modname, offset, size); + else + strlcpy(str, name, len); + } else _stp_snprintf(str, len, "%p", (int64_t) address); } diff --git a/runtime/uprobes/.gitignore b/runtime/uprobes/.gitignore new file mode 100644 index 00000000..c8172c41 --- /dev/null +++ b/runtime/uprobes/.gitignore @@ -0,0 +1,7 @@ +/*.o +/*.cmd +/.tmp_versions +/Module.* +/modules.order +/uprobes.ko +/uprobes.mod.c |