diff options
36 files changed, 490 insertions, 489 deletions
@@ -1,5 +1,75 @@ +2007-10-19 Jim Keniston <jkenisto@us.ibm.com> + + * runtime/uprobes/uprobes_ppc64.h,uprobes_s390.c: Fixed 10/16 + update to arch_validate_probed_insn() decl. + +2007-10-19 Masami Hiramatsu <mhiramat@redhat.com> + + * staplog.c: Cleanup code and remove end-of-line spaces. + (create_output_filename): Use snprintf instead of sprintf and remove + malloc(). + (print_rchan_info): Merge into output_cpu_logs(). + (open_output_file): Use GETBUF() instead of malloc(). + (output_cpu_logs): Simplify logic and remove unused code. + (do_staplog): Merge into cmd_staplog(). + (help_staplog): Fix typos. + * Makefile.am (STAPLOG): Add -Wall option. + * Makefile.in: Regenerated. + +2007-10-19 Masami Hiramatsu <mhiramat@redhat.com> + + From Satoru Moriya <satoru.moriya.br@hitachi.com>: + * staplog.c (create_output_dir): New function for creating output + directory. + (create_output_filename): New function for making output filename. + (print_rchan_info): New function for displaying relay channel status. + (open_output_file): New function for opening output file. + (output_cpu_logs): Cleanup code and fix bugs to retrieve buffer + data even when the last buffer is full and even if the systemtap + uses old(non-utt) format. Add a routine for '-a' option. + (cmd_staplog): Add '-a' option. + (help_staplog): Ditto. + +2007-10-18 Mike Mason <mmlnx@us.ibm.com> + + * stapprobes.5.in: Removed C label reference. + Clarified source path requirements for probe + definitions. Fixed some vertical spacing + issues. + +2007-10-18 Mike Mason <mmlnx@us.ibm.com> + + * stapfuncs.5.in: Corrected tokenize description. + Added task_* functions. + +2007-10-16 Jim Keniston <jkenisto@us.ibm.com> + + * runtime/uprobes/uprobes.[ch], uprobes_i386.[ch], + uprobes_ppc64.h, uprobes_s390.h: Adjusted SLOT_IP and + arch_validate_probed_insn to accept task pointer (needed by + x86_64); added uprobe_probept_arch_info and uprobe_task_arch_info + (ditto). + * runtime/uprobes/uprobes_i386.c: Fixed a couple of glitches + discovered when porting to x86_64 + +2007-10-15 Roland McGrath <roland@redhat.com> + + PR 5101 + * loc2c.c (struct location): Replace regno union member with struct + member reg, fields regno and offset. + (translate): Update uses. + (emit_base_fetch, emit_base_store, emit_loc_register): Likewise. + Fail if reg.offset is not zero. + (location_relative): Handle DW_OP_plus_uconst relative to loc_register. + (c_translate_array): Handle array index into loc_register. + 2007-10-15 David Smith <dsmith@redhat.com> + * tapsets.cxx (mark_query::handle_query_module): Checks for marker + to be in the proper section. + (mark_derived_probe_group::emit_module_decls): Updated emitted + marker C code for 10/2/2007 markers patch. Fixes PR 5178. + From David Wilder <dwilder@us.ibm.com> * tapsets.cxx (mark_query::handle_query_module): Updated to handle 64-bit platforms correctly. @@ -23,7 +93,7 @@ (mark_query::handle_query_module): Updated for 10/2/2007 markers patch. Currently only handles markers in the kernel image itself - not in modules. - + 2007-10-12 Martin Hunt <hunt@redhat.com> * Makefile.am (staprun_LDADD): Add -lpthread. @@ -65,8 +135,8 @@ * runtime/staprun/staprun.h: Reflect insert_module() and need_uprobes changes - * runtime/uprobes/*.[c,h]: uprobes is built as a module, - rather than included into the source of the stap-generated + * runtime/uprobes/*.[c,h]: uprobes is built as a module, + rather than included into the source of the stap-generated module. * runtime/uprobes/Makefile: Added @@ -119,7 +189,7 @@ * translate.cxx (emit_global): Wrap all globals and locks into one top-level struct. Update references to former "global_VAR" prefix. * translate.h (emit_global_init): New function. - + 2007-10-02 Frank Ch. Eigler <fche@redhat.com> PR 5078 @@ -180,7 +250,7 @@ * tapsets.cxx (procfs_var_expanding_copy_visitor::visit_target_symbol): Disallows reading from $value in a procfs read probe. - + 2007-09-14 David Smith <dsmith@redhat.com> PR 1154 @@ -215,12 +285,12 @@ * translate.cxx (assert_hist_compatible): Ditto. * staptree.cxx (hist_op::print): Ditto. * session.h (statistic_decl): Ditto. - + * parse.cxx (expect_number): Allow negative numbers. - Also validate that input is really numeric. This is used + Also validate that input is really numeric. This is used by histograms to get the parameters. (parse_hist_op_or_bare_name): Remove code to get parameter - for log histograms. + for log histograms. 2007-09-12 David Smith <dsmith@redhat.com> @@ -238,7 +308,7 @@ 2007-09-10 Martin Hunt <hunt@redhat.com> - * tapsets.cxx, session.h, elaborate.cxx: Start of procfs + * tapsets.cxx, session.h, elaborate.cxx: Start of procfs interaction support. PR 1154. 2007-09-06 Masami Hiramatsu <mhiramat@redhat.com> @@ -292,7 +362,7 @@ PR 2424 From Lai Jiangshan <laijs@cn.fujitsu.com: - * util.cxx (cmdstr_quoted): New. Properly quote + * util.cxx (cmdstr_quoted): New. Properly quote command string. * buildrun.cxx (run_pass): Call cmdstr_quoted(). @@ -431,7 +501,7 @@ 2007-07-11 William Cohen <wcohen@redhat.com> * systemtap.spec.in: Make sqlite support selectable. - + 2007-07-11 Frank Ch. Eigler <fche@elastic.org> * configure.ac: Don't AC_MSG_ERROR if don't HAVE_LIBSQLITE3. @@ -463,7 +533,7 @@ (print_coverage_info(systemtap_session): Relocate vector. (sql_update_used_probes): Ditto. (sql_update_unused_probes): Ditto. - + 2007-07-03 Frank Ch. Eigler <fche@elastic.org> * configure.ac: Bumped version to 0.5.15 for development. diff --git a/Makefile.am b/Makefile.am index 2da4da73..df86dc80 100644 --- a/Makefile.am +++ b/Makefile.am @@ -88,7 +88,7 @@ if BUILD_CRASHMOD STAPLOG=staplog.so $(STAPLOG): staplog.c - $(CC) -shared -rdynamic $(LDFLAGS) $(CFLAGS) -fPIC -o $@ $< + $(CC) -Wall -shared -rdynamic $(LDFLAGS) $(CFLAGS) -fPIC -o $@ $< all-local: $(STAPLOG) install-exec-local: $(STAPLOG) -$(MKDIR_P) $(DESTDIR)$(pkglibdir) diff --git a/Makefile.in b/Makefile.in index 77e5be8d..27577e66 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1473,7 +1473,7 @@ install-exec-hook: if [ `id -u` -eq 0 ]; then chmod 04111 "$(DESTDIR)$(bindir)/staprun"; fi @BUILD_CRASHMOD_TRUE@$(STAPLOG): staplog.c -@BUILD_CRASHMOD_TRUE@ $(CC) -shared -rdynamic $(LDFLAGS) $(CFLAGS) -fPIC -o $@ $< +@BUILD_CRASHMOD_TRUE@ $(CC) -Wall -shared -rdynamic $(LDFLAGS) $(CFLAGS) -fPIC -o $@ $< @BUILD_CRASHMOD_TRUE@all-local: $(STAPLOG) @BUILD_CRASHMOD_TRUE@install-exec-local: $(STAPLOG) @BUILD_CRASHMOD_TRUE@ -$(MKDIR_P) $(DESTDIR)$(pkglibdir) @@ -48,7 +48,11 @@ struct location unsigned int stack_depth; /* Temporaries "s0..<N>" used by it. */ bool used_deref; /* Program uses "deref" macro. */ } address; - unsigned int regno; /* loc_register */ + struct /* loc_register */ + { + unsigned int regno; + Dwarf_Word offset; + } reg; struct location *pieces; /* loc_noncontiguous */ }; }; @@ -182,7 +186,7 @@ translate (struct obstack *pool, int indent, Dwarf_Addr addrbias, break; case loc_register: - tos_register = input->regno; + tos_register = input->reg.regno; break; default: @@ -215,7 +219,8 @@ translate (struct obstack *pool, int indent, Dwarf_Addr addrbias, else { piece->type = loc_register; - piece->regno = tos_register; + piece->reg.regno = tos_register; + piece->reg.offset = 0; } return NULL; } @@ -914,7 +919,9 @@ location_relative (struct obstack *pool, } case loc_register: - // XXX + /* This piece (or the whole struct) fits in a register. */ + (*input)->reg.offset += value; + return head ?: *input; default: abort (); @@ -1020,11 +1027,10 @@ emit_base_fetch (struct obstack *pool, Dwarf_Word byte_size, bool signed_p, const char *target, struct location *loc) { bool deref = false; - /* int i; */ - /* Emit size/signed coercion. */ + /* Emit size/signed coercion. */ obstack_printf (pool, "{ "); - obstack_printf (pool, "%sint%u_t value = ", + obstack_printf (pool, "%sint%u_t value = ", (signed_p ? "" : "u"), (unsigned)(byte_size * 8)); switch (loc->type) @@ -1038,7 +1044,9 @@ emit_base_fetch (struct obstack *pool, Dwarf_Word byte_size, break; case loc_register: - obstack_printf (pool, "fetch_register (%u);", loc->regno); + if (loc->reg.offset != 0) + FAIL (loc, N_("cannot handle offset into register in fetch")); + obstack_printf (pool, "fetch_register (%u);", loc->reg.regno); break; case loc_noncontiguous: @@ -1072,7 +1080,9 @@ emit_base_store (struct obstack *pool, Dwarf_Word byte_size, return true; case loc_register: - obstack_printf (pool, "store_register (%u, %s);", loc->regno, rvalue); + if (loc->reg.offset != 0) + FAIL (loc, N_("cannot handle offset into register in store")); + obstack_printf (pool, "store_register (%u, %s);", loc->reg.regno, rvalue); break; case loc_noncontiguous: @@ -1371,7 +1381,7 @@ c_translate_fetch (struct obstack *pool, int indent, if (dwarf_attr_integrate (die, DW_AT_encoding, &encoding_attr) == NULL || dwarf_formudata (&encoding_attr, &encoding) != 0) encoding = base_encoding (typedie, *input); - bool signed_p = (encoding == DW_ATE_signed + bool signed_p = (encoding == DW_ATE_signed || encoding == DW_ATE_signed_char); *input = discontiguify (pool, indent, *input, byte_size, @@ -1490,7 +1500,7 @@ c_translate_store (struct obstack *pool, int indent, if (dwarf_attr_integrate (die, DW_AT_encoding, &encoding_attr) == NULL || dwarf_formudata (&encoding_attr, &encoding) != 0) encoding = base_encoding (typedie, *input); - bool signed_p = (encoding == DW_ATE_signed + bool signed_p = (encoding == DW_ATE_signed || encoding == DW_ATE_signed_char); *input = discontiguify (pool, indent, *input, byte_size, @@ -1677,7 +1687,15 @@ c_translate_array (struct obstack *pool, int indent, break; case loc_register: - FAIL (*input, N_("cannot index array stored in a register")); + if (idx != NULL) + FAIL (*input, N_("cannot index array stored in a register")); + else if (const_idx > max_fetch_size (loc, typedie) / stride) + FAIL (*input, N_("constant index is outside array held in register")); + else + { + loc->reg.offset += const_idx * stride; + return; + } break; default: @@ -1728,8 +1746,11 @@ emit_loc_register (FILE *out, struct location *loc, unsigned int indent, { assert (loc->type == loc_register); + if (loc->reg.offset != 0) + FAIL (loc, N_("cannot handle offset into register in fetch")); + emit ("%*s%s = fetch_register (%u);\n", - indent * 2, "", target, loc->regno); + indent * 2, "", target, loc->reg.regno); } /* Emit a code fragment to assign the target variable to an address. */ diff --git a/man/stapprobes.task.5.in b/man/stapprobes.task.5.in deleted file mode 100644 index 83d887e6..00000000 --- a/man/stapprobes.task.5.in +++ /dev/null @@ -1,207 +0,0 @@ -.\" -*- nroff -*- -.TH STAPPROBES.TASK 5 @DATE@ "IBM" -.SH NAME -stapprobes.task \- systemtap task information - -.\" macros -.de SAMPLE -.br -.RS -.nf -.nh -.. -.de ESAMPLE -.hy -.fi -.RE -.. - -.SH DESCRIPTION - -This family of tapset functions is used to collect information about tasks. -It contains the following functions. - -.P -.TP -.B task_current:long() - -Return the task_struct of the current process. - -.P -.TP -.B task_parent:long(task:long) - -Return the parent task_struct of the given task. - -.B Arguments: - -.I task - task_struct of the task. - -.P -.TP -.B task_state:long(task:long) - -Return the state of the given task. State of the task could be, one among the following. - - TASK_RUNNING 0 - TASK_INTERRUPTIBLE 1 - TASK_UNINTERRUPTIBLE 2 - TASK_STOPPED 4 - TASK_TRACED 8 - EXIT_ZOMBIE 16 - EXIT_DEAD 32 - - -.B Arguments: - -.I task - task_struct of the task. - -.P -.TP -.B task_execname:string(task:long) - -Return the name of the given task. - -.B Arguments: - -.I task - task_struct of the task. - - -.P -.TP -.B task_pid:long(task:long) - -Return the process id of the given task. - -.B Arguments: - -.I task - task_struct of the task. - -.P -.TP -.B task_tid:long(task:long) - -Return the thread id of the given task. - -.B Arguments: - -.I task - task_struct of the task. - -.P -.TP - -.B task_gid:long(task:long) - -Return the group id of the given task. - -.B Arguments: - -.I task - task_struct of the task. - -.P -.TP - -.B task_egid:long(task:long) - -Return the effective group id of the given task. - -.B Arguments: - -.I task - task_struct of the task. - -.P -.TP - -.B task_uid:long(task:long) - -Return the user id of the given task. - -.B Arguments: - -.I task - task_struct of the task. - -.P -.TP - -.B task_euid:long(task:long) - -Return the effective user id of the given task. - -.B Arguments: - -.I task - task_struct of the task. - -.P -.TP - -.B task_prio:long(task:long) - -Return the priority of the given task. - -.B Arguments: - -.I task - task_struct of the task. - -.P -.TP - -.B task_nice:long(task:long) - -Return the nice value of the given task. - -.B Arguments: - -.I task - task_struct of the task. - -.P -.TP - -.B task_cpu:long(task:long) - -Return the scheduled cpu for the given task. - -.B Arguments: - -.I task - task_struct of the task. - -.P -.TP - -.B task_open_file_handles:long(task:long) - -Return the number of open file handles for the given task. - -.B Arguments: - -.I task - task_struct of the task. - -.P -.TP - -.B task_max_file_handles:long(task:long) - -Return the maximum number of file handles for the given task. - -.B Arguments: - -.I task - task_struct of the task. - - -.SH SEE ALSO -.IR stap (1), -.IR stapprobes (5), - diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 65702a00..798d56d3 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,16 @@ +2007-10-17 Masami Hiramatsu <mhiramat@redhat.com> + + * autoconf-tsc-khz.c: Not to be compiled if the kernel version is + younger than 2.6.23 on i386. + +2007-10-17 Martin Hunt <hunt@redhat.com> + PR5000 + * vsprintf.c: Remove _stp_endian. + +2007-10-15 Masami Hiramatsu <mhiramat@redhat.com> + + * autoconf-tsc-khz.c: Fix a bug to be configured correctly. + 2007-10-09 Martin Hunt <hunt@redhat.com> * user/*: Removed obsolete userspace test files. diff --git a/runtime/autoconf-tsc-khz.c b/runtime/autoconf-tsc-khz.c index d6424251..6c3f453e 100644 --- a/runtime/autoconf-tsc-khz.c +++ b/runtime/autoconf-tsc-khz.c @@ -1,3 +1,7 @@ +#include <linux/version.h> #include <asm/tsc.h> -unsigned int tsc = tsc_khz; +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) && defined(__i386__) +#error "tsc_khz is not exported" +#endif +unsigned int *ptsc = &tsc_khz; diff --git a/runtime/uprobes/uprobes.c b/runtime/uprobes/uprobes.c index 01b40670..9f5fddd0 100644 --- a/runtime/uprobes/uprobes.c +++ b/runtime/uprobes/uprobes.c @@ -251,7 +251,7 @@ static void insert_bkpt(struct uprobe_probept *ppt, struct task_struct *tsk) goto out; } - if ((result = arch_validate_probed_insn(ppt)) < 0) { + if ((result = arch_validate_probed_insn(ppt, tsk)) < 0) { bkpt_insertion_failed(ppt, "instruction type cannot be probed"); goto out; } @@ -1754,7 +1754,8 @@ static int utask_quiesce_pending_sigtrap(struct uprobe_task *utask) if (unlikely(regset == NULL)) return -EIO; - if ((*regset->get)(utask->tsk, regset, SLOT_IP * regset->size, + if ((*regset->get)(utask->tsk, regset, + SLOT_IP(utask->tsk) * regset->size, regset->size, &insn_ptr, NULL) != 0) return -EIO; diff --git a/runtime/uprobes/uprobes.h b/runtime/uprobes/uprobes.h index 84dd0b2a..e8a06599 100644 --- a/runtime/uprobes/uprobes.h +++ b/runtime/uprobes/uprobes.h @@ -278,9 +278,15 @@ struct uprobe_probept { /* Saved opcode (which has been replaced with breakpoint) */ uprobe_opcode_t opcode; - /* Saved original instruction */ + /* + * Saved original instruction. This may be modified by + * architecture-specific code if the original instruction + * can't be single-stepped out of line as-is. + */ uprobe_opcode_t insn[MAX_UINSN_BYTES / sizeof(uprobe_opcode_t)]; + struct uprobe_probept_arch_info arch_info; + /* The parent uprobe_process */ struct uprobe_process *uproc; @@ -359,6 +365,8 @@ struct uprobe_task { /* Saved address of copied original instruction */ long singlestep_addr; + struct uprobe_task_arch_info arch_info; + /* * Unexpected error in probepoint handling has left task's * text or stack corrupted. Kill task ASAP. diff --git a/runtime/uprobes/uprobes_i386.c b/runtime/uprobes/uprobes_i386.c index 21420681..5fe7d781 100644 --- a/runtime/uprobes/uprobes_i386.c +++ b/runtime/uprobes/uprobes_i386.c @@ -69,8 +69,8 @@ W(0x80, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)| /* 80 */ W(0x90, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), /* 90 */ W(0xa0, 1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,1)| /* a0 */ - W(0xb0, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), /* b0 */ - W(0xc0, 1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1)| /* c0 */ + W(0xb0, 1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1), /* b0 */ + W(0xc0, 1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1)| /* c0 */ W(0xd0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), /* d0 */ W(0xe0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)| /* e0 */ W(0xf0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) /* f0 */ @@ -80,10 +80,8 @@ /* * TODO: - * - Allow valid 2-byte opcodes (first byte = 0x0f). - * - Where necessary, examine the modrm byte and allow valid instructions + * - Where necessary, examine the modrm byte and allow only valid instructions * in the different Groups and fpu instructions. - * - Allow at least some instruction prefixes. * - Note: If we go past the first byte, do we need to verify that * subsequent bytes were actually there, rather than off the last page? * Probably overkill. We don't verify that they specified the first byte @@ -104,12 +102,11 @@ * fa, fb - cli, sti * * opcodes we may need to refine support for: - * 0f - valid 2-byte opcodes * 66 - data16 prefix * 8f - Group 1 - only reg = 0 is OK * c6-c7 - Group 11 - only reg = 0 is OK * d9-df - fpu insns with some illegal encodings - * fe - Group 4 - only reg = 1 or 2 is OK + * fe - Group 4 - only reg = 0 or 1 is OK * ff - Group 5 - only reg = 0-6 is OK * * others -- Do we need to support these? @@ -123,7 +120,8 @@ */ static -int arch_validate_probed_insn(struct uprobe_probept *ppt) +int arch_validate_probed_insn(struct uprobe_probept *ppt, + struct task_struct *tsk) { uprobe_opcode_t *insn = ppt->insn; @@ -138,9 +136,9 @@ int arch_validate_probed_insn(struct uprobe_probept *ppt) printk(KERN_ERR "uprobes does not currently support probing " "instructions with the 2-byte opcode 0x0f 0x%2.2x\n", insn[1]); - } - printk(KERN_ERR "uprobes does not currently support probing " - "instructions whose first byte is 0x%2.2x\n", insn[0]); + } else + printk(KERN_ERR "uprobes does not currently support probing " + "instructions whose first byte is 0x%2.2x\n", insn[0]); return -EPERM; } diff --git a/runtime/uprobes/uprobes_i386.h b/runtime/uprobes/uprobes_i386.h index 6e2aae70..e4376b95 100644 --- a/runtime/uprobes/uprobes_i386.h +++ b/runtime/uprobes/uprobes_i386.h @@ -32,17 +32,22 @@ typedef u8 uprobe_opcode_t; #define BREAKPOINT_INSTRUCTION 0xcc #define BP_INSN_SIZE 1 #define MAX_UINSN_BYTES 16 -#define SLOT_IP 12 /* instruction pointer slot from include/asm/elf.h */ +#define SLOT_IP(tsk) 12 /* instruction pointer slot from include/asm/elf.h */ #define BREAKPOINT_SIGNAL SIGTRAP #define SSTEP_SIGNAL SIGTRAP +struct uprobe_probept_arch_info {}; +struct uprobe_task_arch_info {}; + /* Architecture specific switch for where the IP points after a bp hit */ #define ARCH_BP_INST_PTR(inst_ptr) (inst_ptr - BP_INSN_SIZE) struct uprobe_probept; struct uprobe_task; -static int arch_validate_probed_insn(struct uprobe_probept *ppt); +struct task_struct; +static int arch_validate_probed_insn(struct uprobe_probept *ppt, + struct task_struct *tsk); /* On i386, the int3 traps leaves eip pointing past the int3 instruction. */ static inline unsigned long arch_get_probept(struct pt_regs *regs) diff --git a/runtime/uprobes/uprobes_ppc64.h b/runtime/uprobes/uprobes_ppc64.h index 619ba324..9f56119a 100644 --- a/runtime/uprobes/uprobes_ppc64.h +++ b/runtime/uprobes/uprobes_ppc64.h @@ -34,15 +34,20 @@ typedef unsigned int uprobe_opcode_t; #define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */ #define BP_INSN_SIZE 4 #define MAX_UINSN_BYTES 4 -#define SLOT_IP 32 /* instruction pointer slot from include/asm/elf.h */ +#define SLOT_IP(tsk) 32 /* instruction pointer slot from include/asm/elf.h */ + +struct uprobe_probept_arch_info {}; +struct uprobe_task_arch_info {}; /* Architecture specific switch for where the IP points after a bp hit */ #define ARCH_BP_INST_PTR(inst_ptr) (inst_ptr) struct uprobe_probept; struct uprobe_task; +struct task_struct; -static inline int arch_validate_probed_insn(struct uprobe_probept *ppt) +static inline int arch_validate_probed_insn(struct uprobe_probept *ppt, + struct task_struct *tsk) { return 0; } diff --git a/runtime/uprobes/uprobes_s390.c b/runtime/uprobes/uprobes_s390.c index f97dd408..b01286e6 100644 --- a/runtime/uprobes/uprobes_s390.c +++ b/runtime/uprobes/uprobes_s390.c @@ -48,7 +48,8 @@ static int prohibited_opcode(uprobe_opcode_t *instruction) } static -int arch_validate_probed_insn(struct uprobe_probept *ppt) +int arch_validate_probed_insn(struct uprobe_probept *ppt, + struct task_struct *tsk) { if (ppt->vaddr & 0x01) { printk("Attempt to register uprobe at an unaligned address\n"); diff --git a/runtime/uprobes/uprobes_s390.h b/runtime/uprobes/uprobes_s390.h index 4f3a8187..5c711275 100644 --- a/runtime/uprobes/uprobes_s390.h +++ b/runtime/uprobes/uprobes_s390.h @@ -40,9 +40,9 @@ typedef u16 uprobe_opcode_t; #define SSTEP_SIGNAL SIGTRAP #ifdef CONFIG_COMPAT -#define SLOT_IP (test_tsk_thread_flag(current, TIF_31BIT) ? 0x04 : 0x08) +#define SLOT_IP(tsk) (test_tsk_thread_flag(tsk, TIF_31BIT) ? 0x04 : 0x08) #else -#define SLOT_IP 0x08 +#define SLOT_IP(tsk) 0x08 #endif #define FIXUP_PSW_NORMAL 0x08 @@ -50,12 +50,16 @@ typedef u16 uprobe_opcode_t; #define FIXUP_RETURN_REGISTER 0x02 #define FIXUP_NOT_REQUIRED 0x01 +struct uprobe_probept_arch_info {}; +struct uprobe_task_arch_info {}; + /* Architecture specific switch for where the IP points after a bp hit */ #define ARCH_BP_INST_PTR(inst_ptr) (inst_ptr - BP_INSN_SIZE) struct uprobe_probept; struct uprobe_task; -static int arch_validate_probed_insn(struct uprobe_probept *ppt); +static int arch_validate_probed_insn(struct uprobe_probept *ppt, + struct task_struct *tsk); /* * On s390, a trap leaves the instruction pointer pointing past the diff --git a/runtime/vsprintf.c b/runtime/vsprintf.c index 0e52f5c3..061aba3f 100644 --- a/runtime/vsprintf.c +++ b/runtime/vsprintf.c @@ -12,9 +12,6 @@ #ifndef _VSPRINTF_C_ #define _VSPRINTF_C_ -enum endian {STP_NATIVE=0, STP_LITTLE, STP_BIG}; -static enum endian _stp_endian = STP_NATIVE; - static int skip_atoi(const char **s) { int i=0; @@ -213,37 +210,17 @@ int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) ++str; break; case 2: - if (_stp_endian != STP_NATIVE) { - if (_stp_endian == STP_BIG) - num = cpu_to_be16(num); - else - num = cpu_to_le16(num); - } if((str + 1) <= end) *(int16_t *)str = (int16_t)num; str+=2; break; case 8: - if (_stp_endian != STP_NATIVE) { - if (_stp_endian == STP_BIG) - num = cpu_to_be64(num); - else - num = cpu_to_le64(num); - } - if((str + 7) <= end) *(int64_t *)str = num; str+=8; break; case 4: default: // "%4b" by default - if (_stp_endian != STP_NATIVE) { - if (_stp_endian == STP_BIG) - num = cpu_to_be32(num); - else - num = cpu_to_le32(num); - } - if((str + 3) <= end) *(int32_t *)str = num; str+=4; diff --git a/stapfuncs.5.in b/stapfuncs.5.in index f771fd5a..496d5760 100644 --- a/stapfuncs.5.in +++ b/stapfuncs.5.in @@ -119,11 +119,12 @@ specified by base. For example, strtol("1000", 16) returns 4096. Returns 0 if string cannot be converted. .TP tokenize:string (str:string, delim:string) -Given a string and a token delimiter, return the next token in the string. -If str is non-NULL, returns the first token. If str is NULL, returns the -next token in the str passed in the previous call to tokenize(). Only the -first character in delim is used as the delimiter. Returns NULL when no -more tokens are left. +Return the next token in the given str string, where the tokens are delimited +by one of the characters in the delim string. If the str string is non-NULL, +it returns the first token. If the str string is NULL, it returns the next +token in the string passed in the previous call to tokenize. If no delimiter +is found, the entire remaining str string is returned. Returns NULL when +no more tokens are left. .SS TIMESTAMP .TP @@ -142,7 +143,7 @@ Return the number of milliseconds since the UNIX epoch. gettimeofday_s:long () Return the number of seconds since the UNIX epoch. -.SS CONTEXTINFO +.SS CONTEXT INFO .TP cpu:long () Return the current cpu number. @@ -225,6 +226,79 @@ errno_str:string (e:long) Return the symbolic string associated with the given error code, like "ENOENT" for the number 2, or "E#3333" for an out-of-range value like 3333. +.SS TASK +.PP +These functions return data about a task. They all require +a task handle as input, such as the value return by task_current() or the variables +prev_task and next_task in the scheduler.ctxswitch probe alias. + +.TP +task_current:long() +Return the task_struct of the current process. + +.TP +task_parent:long(task:long) +Return the parent task_struct of the given task. +.TP +task_state:long(task:long) +Return the state of the given task, which can be one of the following: + + TASK_RUNNING 0 + TASK_INTERRUPTIBLE 1 + TASK_UNINTERRUPTIBLE 2 + TASK_STOPPED 4 + TASK_TRACED 8 + EXIT_ZOMBIE 16 + EXIT_DEAD 32 + +.TP +task_execname:string(task:long) +Return the name of the given task. + +.TP +task_pid:long(task:long) +Return the process id of the given task. + +.TP +task_tid:long(task:long) +Return the thread id of the given task. + +.TP +task_gid:long(task:long) +Return the group id of the given task. + +.TP +task_egid:long(task:long) +Return the effective group id of the given task. + +.TP +task_uid:long(task:long) +Return the user id of the given task. + +.TP +task_euid:long(task:long) +Return the effective user id of the given task. + +.TP +task_prio:long(task:long) +Return the priority of the given task. + +.TP +task_nice:long(task:long) +Return the nice value of the given task. + +.TP +task_cpu:long(task:long) +Return the scheduled cpu for the given task. + +.TP +task_open_file_handles:long(task:long) +Return the number of open file handles for the given task. + +.TP +task_max_file_handles:long(task:long) +Return the maximum number of file handles for the given task. + .SS QUEUE_STATS .PP The queue_stats tapset provides functions that, given notifications of @@ -1,8 +1,9 @@ /* crash shared object for retrieving systemtap buffer - Copyright (c) 2007 Hitachi,Ltd., - Created by Satoru Moriya <satoru.moriya.br@hitachi.com> - + Copyright (c) 2007, Hitachi, Ltd., + Created by Satoru Moriya <satoru.moriya.br@hitachi.com> + Updated by Masami Hiramatsu <mhiramat@redhat.com> + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -77,10 +78,11 @@ struct per_cpu_data { static struct rchan_offsets rchan_offsets; static struct fake_rchan chan; static struct per_cpu_data per_cpu[NR_CPUS]; -static FILE *outfp; -static char *subbuf; -static int is_global; -static int old_format; +static FILE *outfp = NULL; +static char *subbuf = NULL; +static int is_global = 0; +static int old_format = 0; +static int retrieve_all = 0; void cmd_staplog(void); void cmd_staplog_cleanup(void); @@ -122,7 +124,7 @@ ERR: error(FATAL, "cannot get rchan offset\n"); } -static ulong get_rchan(ulong chan_addr) +static ulong get_rchan(ulong chan_addr) { ulong rchan; @@ -137,7 +139,7 @@ static ulong get_rchan(ulong chan_addr) return rchan; } -static void get_rchan_buf(int cpu, ulong rchan) +static void get_rchan_buf(int cpu, ulong rchan) { ulong rchan_buf; struct per_cpu_data *pcd; @@ -199,7 +201,7 @@ static int check_global_buffer(ulong rchan) { int cpu; ulong rchan_buf[2]; - + for (cpu = 0; cpu < 2; cpu++) { readmem(rchan + rchan_offsets.buf + sizeof(void*) * cpu, KVADDR, &rchan_buf[cpu], sizeof(void*), @@ -210,7 +212,7 @@ static int check_global_buffer(ulong rchan) return 0; } -static void setup_global_data(char *module) +static void setup_global_data(char *module) { int i; ulong stp_utt_addr = 0; @@ -242,14 +244,59 @@ static void setup_global_data(char *module) return; } +static void create_output_filename(char *buf, int len, int cpu) +{ + if (is_global) { + snprintf(buf, len, "global"); + } else { + snprintf(buf, len, "cpu%d", cpu); + } +} + +static void create_output_dir(const char *dirname) +{ + DIR *dir; + dir = opendir(dirname); + if (dir) { + closedir(dir); + } else { + if (mkdir(dirname, S_IRWXU) < 0) { + error(FATAL, "cannot create log directory '%s\n'", dirname); + } + } +} + +static FILE *open_output_file(const char *dname, const char *fname) +{ + FILE *filp = NULL; + char *output_file; + + output_file = GETBUF(sizeof(char) * (strlen(dname) + strlen(fname) + 2)); + if (output_file == NULL) { + error(FATAL, "cannot allocate memory for logfile name\n"); + } + + create_output_dir(dname); + sprintf(output_file,"%s/%s", dname, fname); + + filp = fopen(output_file, "w"); + if (!filp) { + error(FATAL, "cannot create log file '%s'\n", output_file); + } + FREEBUF(output_file); + + return filp; +} + +#define MAX_FNAME 128 + static void output_cpu_logs(char *dirname) { - int i, max = 256; + int i; struct per_cpu_data *pcd; - size_t n, idx, start, end, ready, len; + size_t n, idx, start, end, len; size_t padding; - char fname[max + 1], *source; - DIR *dir; + char *source, fname[MAX_FNAME + 1]; /* allocate subbuf memory */ subbuf = GETBUF(chan.subbuf_size); @@ -257,19 +304,10 @@ static void output_cpu_logs(char *dirname) error(FATAL, "cannot allocate memory\n"); } - fname[max] = '\0'; for (i = 0; i < kt->cpus; i++) { - int adjust = 0; pcd = &per_cpu[i]; - if (pcd->buf.offset == 0 || - pcd->buf.offset == chan.subbuf_size + 1) { - adjust = 0; - } else { - adjust = 1; - } - ready = pcd->buf.subbufs_produced + adjust; - if (ready == 0) { + if (pcd->buf.subbufs_produced == 0 && pcd->buf.offset == 0) { if (is_global == 1) { error(WARNING, "There is no data in the relay buffer.\n"); break; @@ -279,42 +317,26 @@ static void output_cpu_logs(char *dirname) } } - if (ready > chan.n_subbufs) { - start = ready; - end = start + chan.n_subbufs; + end = pcd->buf.subbufs_produced + 1; + if (pcd->buf.subbufs_produced >= chan.n_subbufs) { + start = end - chan.n_subbufs; } else { start = 0; - end = ready; - } - /* print information */ - if (is_global == 1) { - fprintf(fp, "--- generating 'global' ---\n"); - } else { - fprintf(fp, "--- generating 'cpu%d' ---\n", i); - } - fprintf(fp, " subbufs ready on relayfs:%ld\n", (long)ready); - fprintf(fp, " n_subbufs:%ld, read from:%ld to:%ld (offset:%ld)\n\n", - (long)chan.n_subbufs, (long)(start ? start - chan.n_subbufs : start), - (long)(start ? end - 1 - chan.n_subbufs : end - 1), (long)pcd->buf.offset); - - /* create log dir and file */ - dir = opendir(dirname); - if (dir) { - closedir(dir); - } else { - if (mkdir(dirname, S_IRWXU) < 0) { - error(FATAL, "cannot create log directory '%s\n'", dirname); - } - } - if (is_global == 1) { - snprintf(fname, max, "%s/global", dirname, i); - } else { - snprintf(fname, max, "%s/cpu%d", dirname, i); - } - outfp = fopen(fname, "w"); - if (!outfp) { - error(FATAL, "cannot create log file '%s'\n", fname); } + + create_output_filename(fname, MAX_FNAME, i); + fprintf(fp, "--- generating '%s/%s' ---\n", dirname, fname); + fprintf(fp, " subbufs ready on relayfs:%ld\n", (long)end); + fprintf(fp, " n_subbufs:%ld, read subbuf from:%ld(%ld) " + "to:%ld(%ld) (offset:0-%ld)\n\n", + (long)chan.n_subbufs, + (long)start, + (long)(start % chan.n_subbufs), + (long)end-1, + (long)((end-1) % chan.n_subbufs), + (long) pcd->buf.offset); + outfp = open_output_file(dirname, fname); + for (n = start; n < end; n++) { /* read relayfs subbufs and write to log file */ idx = n % chan.n_subbufs; @@ -322,19 +344,18 @@ static void output_cpu_logs(char *dirname) readmem((ulong)pcd->buf.padding + sizeof(padding) * idx, KVADDR, &padding, sizeof(padding), "padding", FAULT_ON_ERROR); - if (n == end - 1 && 0 < pcd->buf.offset && - pcd->buf.offset < chan.subbuf_size) { + if (n == end - 1) { len = pcd->buf.offset; } else { len = chan.subbuf_size; - } + } if (old_format == 1) { - source += sizeof(padding); - len -= sizeof(padding) + padding; + source += sizeof(unsigned int); + len -= sizeof(unsigned int) + padding; } else { len -= padding; } - if (len) { + if (len > 0) { readmem((ulong)source, KVADDR, subbuf, len, "subbuf", FAULT_ON_ERROR); if (fwrite(subbuf, len, 1, outfp) != 1) { @@ -344,6 +365,36 @@ static void output_cpu_logs(char *dirname) } fclose(outfp); outfp = NULL; + + /* + * -a option retrieve the old data of subbuffer where the + * probe record is written at that time. + */ + if (retrieve_all == 1 && start != 0) { + strncat(fname, ".may_broken", MAX_FNAME); + fprintf(fp, "--- generating '%s/%s' ---\n", dirname, fname); + fprintf(fp, " read subbuf %ld(%ld) (offset:%ld-%ld)\n", + (long)start-1, + (long)((start-1) % chan.n_subbufs), + (long)pcd->buf.offset, + (long)chan.subbuf_size); + outfp = open_output_file(dirname, fname); + + idx = (start - 1) % chan.n_subbufs; + source = pcd->buf.start + idx * chan.subbuf_size + + pcd->buf.offset; + len = chan.subbuf_size - pcd->buf.offset; + if (len) { + readmem((ulong)source, KVADDR, subbuf, len, + "may_broken_subbuf", FAULT_ON_ERROR); + if(fwrite(subbuf, len, 1, outfp) != 1) { + error(FATAL, + "cannot write log data(may_broken)\n"); + } + } + fclose(outfp); + outfp = NULL; + } if (is_global == 1) break; } @@ -354,13 +405,6 @@ static void output_cpu_logs(char *dirname) return; } -static void do_staplog(char *module, char *dirname) -{ - setup_global_data(module); - output_cpu_logs(dirname); - return; -} - void cmd_staplog(void) { @@ -368,8 +412,11 @@ void cmd_staplog(void) char *module = NULL; char *dirname = NULL; - while ((c = getopt(argcnt, args, "o:")) != EOF) { + while ((c = getopt(argcnt, args, "+ao:")) != EOF) { switch (c) { + case 'a': + retrieve_all = 1; + break; case 'o': dirname = optarg; break; @@ -385,7 +432,9 @@ void cmd_staplog(void) if (dirname == NULL && module != NULL) dirname = module; - do_staplog(module, dirname); + + setup_global_data(module); + output_cpu_logs(dirname); return; } @@ -401,16 +450,24 @@ void cmd_staplog_cleanup(void) char *help_staplog[] = { "systemtaplog", "Retrieve SystemTap log data", - "[-o dir_name] module_name", + "[-a] [-o dir_name] module_name", " Retrieve SystemTap's log data and write them to files.\n", - " module_name All valid SystemTap log data made by the trace", - " module which name is 'module_name' are written", - " into log files. If you don't use -o option, the", - " log files are created in `module_name` directory.", - " The name of each log file is cpu0, cpu1...cpuN. ", - " They have same format data as channel buffer", - " except padding(This command removes padding). ", + " All valid SystemTap's log data made by the trace module which name", + " is 'module_name' are written into log files. This command starts", + " to retrieve log data from the subbuffer which is next to current", + " written subbuffer. Therefore some old data in the current written", + " subbuffer may not be retrieved. But -a option retrieves these data", + " and write them into another log file which have the special ", + " postfix `.may_broken`.", + " If you don't use -o option, the log files are created in", + " `module_name` directory. The name of each log file is cpu0, cpu1..", + " ...cpuN. This command doesn't change the log data format, but remove", + " only padding.", "", + " -a Retrieve the old data which is recorded in", + " current written subbuffer and create another files", + " which have the special postfix `.may_broken`", + " for these data.", " -o file_name Specify the output directory.", NULL, }; @@ -425,7 +482,7 @@ char *help_staplog_cleanup[] = { NULL, }; -static void __attribute__ ((constructor)) _init(void) +static void __attribute__ ((constructor)) _init(void) { get_rchan_offsets(); register_extension(command_table); diff --git a/stapprobes.5.in b/stapprobes.5.in index 536991ec..11657c74 100644 --- a/stapprobes.5.in +++ b/stapprobes.5.in @@ -32,6 +32,7 @@ and that no error should result if it fails to expand. Optionalness passes down through all levels of alias/wildcard expansion. These are all syntactically valid probe points: + .SAMPLE kernel.function("foo").return syscall(22) @@ -71,10 +72,12 @@ target variables available in either context. .PP If the order of execution among "begin" or "end" probes is significant, then an optional sequence number may be provided: + .SAMPLE begin(N) end(N) .ESAMPLE + The number N may be positive or negative. The probe handlers are run in increasing order, and the order between handlers with the same sequence number is unspecified. When "begin" or "end" are given without a @@ -103,10 +106,12 @@ conjunction with optional probes. Intervals defined by the standard kernel "jiffies" timer may be used to trigger probe handlers asynchronously. Two probe point variants are supported by the translator: + .SAMPLE timer.jiffies(N) timer.jiffies(N).randomize(M) .ESAMPLE + The probe handler is run every N jiffies (a kernel-defined unit of time, typically between 1 and 60 ms). If the "randomize" component is given, a linearly distributed random value in the range [\-M..+M] is @@ -118,10 +123,12 @@ a multi-processor computer. .PP Alternatively, intervals may be specified in units of time. There are two probe point variants similar to the jiffies timer: + .SAMPLE timer.ms(N) timer.ms(N).randomize(M) .ESAMPLE + Here, N and M are specified in milliseconds, but the full options for units are seconds (s/sec), milliseconds (ms/msec), microseconds (us/usec), nanoseconds (ns/nsec), and hertz (hz). Randomization is not supported for @@ -137,9 +144,11 @@ before any rounding occurs. .PP Profiling timers are also available to provide probes that execute on all CPUs at the rate of the system tick. This probe takes no parameters. + .SAMPLE timer.profile .ESAMPLE + Full context information of the interrupted process is available, making this probe suitable for a time-based sampling profiler. @@ -155,7 +164,7 @@ source or object code. When a matching statement executes on any processor, the probe handler is run in that context. .PP Points in a kernel, which are identified by -module, source file, line number, function name, C label name, or some +module, source file, line number, function name, or some combination of these. .PP Here is a list of probe point families currently supported. The @@ -181,6 +190,7 @@ probes. The .B .statement variant places a probe at the exact spot, exposing those local variables that are visible there. + .SAMPLE kernel.function(PATTERN) .br @@ -205,20 +215,28 @@ kernel.statement(ADDRESS).absolute .br module(MPATTERN).statement(PATTERN) .ESAMPLE + In the above list, MPATTERN stands for a string literal that aims to identify the loaded kernel module of interest. It may include "*", "[]", and "?" wildcards. PATTERN stands for a string literal that aims to identify a point in the program. It is made up of three -parts. The first part is the name of a function, as would appear in -the +parts: +.IP \(bu 4 +The first part is the name of a function, as would appear in the .I nm program's output. This part may use the "*" and "?" wildcarding -operators to match multiple names. The second part is optional, and -begins with the "@" character. It is followed by a source file name -wildcard pattern, such as -.IR mm/slab* . +operators to match multiple names. +.IP \(bu 4 +The second part is optional and begins with the "@" character. +It is followed by the path to the source file containing the function, +which may include a wildcard pattern, such as mm/slab*. +In most cases, the path should be relative to the top of the +linux source directory, although an absolute path may be necessary for some kernels. +If a relative pathname doesn't work, try absolute. +.IP \(bu 4 Finally, the third part is optional if the file name part was given, and identifies the line number in the source file, preceded by a ":". +.PP As an alternative, PATTERN may be a numeric constant, indicating an (module-relative or kernel-_stext-relative) address. In guru mode only, absolute kernel addresses may be specified with the ".absolute" @@ -255,12 +273,14 @@ is the name of the systemtap module). The filesystem is a pseudo-filesystem which is used an an interface to kernel data structures. There are four probe point variants supported by the translator: + .SAMPLE procfs("PATH").read procfs("PATH").write procfs.read procfs.write .ESAMPLE + .I PATH is the file name (relative to /proc/systemtap/MODNAME) to be created. If no @@ -276,6 +296,7 @@ probe is triggered. The string data to be read should be assigned to a variable named .IR $value , like this: + .SAMPLE procfs("PATH").read { $value = "100\\n" } .ESAMPLE @@ -287,6 +308,7 @@ probe is triggered. The data the user wrote is available in the string variable named .IR $value , like this: + .SAMPLE procfs("PATH").write { printf("user wrote: %s", $value) } .ESAMPLE @@ -335,6 +357,7 @@ events, which are available on all processors. This sets up a counter on the processor to count the number of events occuring on the processor. For more details on the performance monitoring events available on a specific processor use the command perfmon2 command: + .SAMPLE pfmon \-l .ESAMPLE diff --git a/tapset/ChangeLog b/tapset/ChangeLog index 509b09c9..f242c310 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,11 @@ +2007-10-17 Martin Hunt <hunt@redhat.com> + PR5000 + * endian.stp (set_endian): Remove. + +2007-10-15 Dave Wilder <dwilder@us.ibm.com> + + *aux_syscalls.stp:_dfd_str Added test for 32-bit value of AT_FDCWD + 2007-10-15 Zhaolei <zhaolei@cn.fujitsu.com> From Cai Fei <caifei@cn.fujitsu.com> diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp index 05c7dc98..e8823190 100644 --- a/tapset/aux_syscalls.stp +++ b/tapset/aux_syscalls.stp @@ -1479,7 +1479,8 @@ function __int32:long(val:long) %{ /* pure */ # For utimensat and futimesat, the directory fd can have a special value function _dfd_str(d) { - if(d == -100) return "AT_FDCWD" + # 0xffffff9c is a 32-bit -100, for compatability mode. + if((d == -100) || (d == 0xffffff9c)) return "AT_FDCWD" return sprint(d) } diff --git a/tapset/endian.stp b/tapset/endian.stp index c3b2b212..34522cd9 100644 --- a/tapset/endian.stp +++ b/tapset/endian.stp @@ -1,11 +1,3 @@ -# set the default endianess for binary printf -# val: 0 - native (default) -# 1 - little endian -# 2 - big endian -function set_endian:long (val:long) %{ - _stp_endian = THIS->val; -%} - function big_endian2:long (val:long) %{ /* pure */ THIS->__retvalue = cpu_to_be16(THIS->val); %} diff --git a/tapsets.cxx b/tapsets.cxx index a45a9ed9..989fbaa0 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -5059,6 +5059,7 @@ mark_query::handle_query_module() GElf_Addr start_markers_addr = 0; GElf_Addr stop_markers_addr = 0; + size_t markers_scn_ndx = 0; int syments = dwfl_module_getsymtab(dw.module); assert(syments); @@ -5082,6 +5083,7 @@ mark_query::handle_query_module() { start_markers_addr = shdr->sh_addr; stop_markers_addr = shdr->sh_addr + shdr->sh_size; + markers_scn_ndx = elf_ndxscn(scn); break; } } @@ -5107,6 +5109,7 @@ mark_query::handle_query_module() && strcmp(name, "__start___markers") == 0) { start_markers_addr = sym.st_value; + markers_scn_ndx = sym.st_shndx; if (stop_markers_addr != 0) break; } @@ -5154,6 +5157,8 @@ mark_query::handle_query_module() && sym.st_info == GELF_ST_INFO(STB_LOCAL, STT_OBJECT) // and it has default visibility rules, && GELF_ST_VISIBILITY(sym.st_other) == STV_DEFAULT + // and it is in the right section + && markers_scn_ndx == sym.st_shndx // and its value is between start_marker_value and // stop_marker_value && sym.st_value >= start_markers_addr @@ -5638,8 +5643,8 @@ mark_derived_probe_group::emit_module_decls (systemtap_session& s) // Emit the marker callback function s.op->newline(); - s.op->newline() << "static void enter_marker_probe (const struct __mark_marker *mdata, void *private_data, const char *fmt, ...) {"; - s.op->newline(1) << "struct stap_marker_probe *smp = (struct stap_marker_probe *)mdata->pdata;"; + s.op->newline() << "static void enter_marker_probe (const struct marker *mdata, void *private_data, const char *fmt, ...) {"; + s.op->newline(1) << "struct stap_marker_probe *smp = (struct stap_marker_probe *)mdata->private;"; common_probe_entryfn_prologue (s.op, "STAP_SESSION_RUNNING"); s.op->newline() << "c->probe_point = smp->pp;"; diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 5e04e64f..9f54311e 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2007-10-16 Martin Hunt <hunt@redhat.com> + + PR 5000 + * systemtap.printf/bin3.stp. Removed. + * systemtap.printf/bin3a.stp. Renamed bin3.stp. + * systemtap.printf/bin4.stp. Removed. + * systemtap.printf/bin4a.stp. Renamed bin4.stp. + * systemtap.printf/bin5.stp. Removed. + * systemtap.printf/bin5a.stp. Renamed bin5.stp. + * systemtap.printf/bin3.exp: Don't run bin3a.stp. + * systemtap.printf/bin4.exp: Don't run bin4a.stp. + * systemtap.printf/bin5.exp: Don't run bin5a.stp. + + Increase reliability under loads. + * systemtap.samples/pfaults.exp: Increase MAXACTION. + * systemtap.context/backtrace.tcl: Handle just + a single userspace address. + 2007-10-05 Frank Ch. Eigler <fche@elastic.org> PR 1119. diff --git a/testsuite/systemtap.context/backtrace.tcl b/testsuite/systemtap.context/backtrace.tcl index b632870b..e35832ee 100644 --- a/testsuite/systemtap.context/backtrace.tcl +++ b/testsuite/systemtap.context/backtrace.tcl @@ -94,17 +94,17 @@ expect { incr m5 expect { -timeout 5 - -re {^ 0x[a-f0-9]+ : [^\r\n]+\r\n} { + -re {^ 0x[a-f0-9]+[^\r\n]+\r\n} { if {$m5 == 1} {incr m5} } } exp_continue } - -re {.*---\r\nthe profile stack is 0x[a-f0-9]+ [^\r\n]+\r\n} { + -re {.*---\r\nthe profile stack is 0x[a-f0-9]+[^\r\n]+\r\n} { incr m6 expect { -timeout 5 - -re {.*---\r\n 0x[a-f0-9]+ : [^\r\n]+\r\n} { + -re {.*---\r\n 0x[a-f0-9]+[^\r\n]+\r\n} { if {$m6 == 1} {incr m6} } } diff --git a/testsuite/systemtap.printf/bin.stp b/testsuite/systemtap.printf/bin.stp deleted file mode 100644 index ac86059d..00000000 --- a/testsuite/systemtap.printf/bin.stp +++ /dev/null @@ -1,18 +0,0 @@ -# test of 16-bit binary prints -# need to use big_endian2() to get consistent results across -# different-endian architectures. - -probe begin -{ - set_endian(2) - printf("%2b", 0x12) - printf("%2b", 0x34) - printf("%2b%2b", 0xabcd, 0x5678) - a = 0x12345678 - b = 0xabcd - c = 0x8888 - d = 0xcdef - printf("%2b%2b%2b%2b", a, b, c, d) - printf("a=%2b b=%2b c=%2b d=%2b",a,b,c,d) - exit() -} diff --git a/testsuite/systemtap.printf/bin3.exp b/testsuite/systemtap.printf/bin3.exp index 18b0b4e4..b0d54c38 100644 --- a/testsuite/systemtap.printf/bin3.exp +++ b/testsuite/systemtap.printf/bin3.exp @@ -6,5 +6,3 @@ cd 20 63 3d 88 88 20 64 set test "bin3" stap_run_binary $srcdir/$subdir/$test.stp -set test "bin3a" -stap_run_binary $srcdir/$subdir/$test.stp diff --git a/testsuite/systemtap.printf/bin3.stp b/testsuite/systemtap.printf/bin3.stp index ac86059d..c0a30448 100644 --- a/testsuite/systemtap.printf/bin3.stp +++ b/testsuite/systemtap.printf/bin3.stp @@ -4,14 +4,13 @@ probe begin { - set_endian(2) - printf("%2b", 0x12) - printf("%2b", 0x34) - printf("%2b%2b", 0xabcd, 0x5678) - a = 0x12345678 - b = 0xabcd - c = 0x8888 - d = 0xcdef + printf("%2b", big_endian2(0x12)) + printf("%2b", big_endian2(0x34)) + printf("%2b%2b", big_endian2(0xabcd), big_endian2(0x5678)) + a = big_endian2(0x12345678) + b = big_endian2(0xabcd) + c = big_endian2(0x8888) + d = big_endian2(0xcdef) printf("%2b%2b%2b%2b", a, b, c, d) printf("a=%2b b=%2b c=%2b d=%2b",a,b,c,d) exit() diff --git a/testsuite/systemtap.printf/bin3a.stp b/testsuite/systemtap.printf/bin3a.stp deleted file mode 100644 index c0a30448..00000000 --- a/testsuite/systemtap.printf/bin3a.stp +++ /dev/null @@ -1,17 +0,0 @@ -# test of 16-bit binary prints -# need to use big_endian2() to get consistent results across -# different-endian architectures. - -probe begin -{ - printf("%2b", big_endian2(0x12)) - printf("%2b", big_endian2(0x34)) - printf("%2b%2b", big_endian2(0xabcd), big_endian2(0x5678)) - a = big_endian2(0x12345678) - b = big_endian2(0xabcd) - c = big_endian2(0x8888) - d = big_endian2(0xcdef) - printf("%2b%2b%2b%2b", a, b, c, d) - printf("a=%2b b=%2b c=%2b d=%2b",a,b,c,d) - exit() -} diff --git a/testsuite/systemtap.printf/bin4.exp b/testsuite/systemtap.printf/bin4.exp index 35105a8d..335b58c0 100644 --- a/testsuite/systemtap.printf/bin4.exp +++ b/testsuite/systemtap.printf/bin4.exp @@ -9,5 +9,3 @@ ef 00 00 } set test "bin4" stap_run_binary $srcdir/$subdir/$test.stp -set test "bin4a" -stap_run_binary $srcdir/$subdir/$test.stp diff --git a/testsuite/systemtap.printf/bin4.stp b/testsuite/systemtap.printf/bin4.stp index 638a38e6..40bbec7f 100644 --- a/testsuite/systemtap.printf/bin4.stp +++ b/testsuite/systemtap.printf/bin4.stp @@ -3,14 +3,13 @@ probe begin { - set_endian(2) - printf("%4b", 0x12) - printf("%4b", 0x34) - printf("%4b%4b", 0xabcdef00, 0x5678) - a = 0x12345678 - b = 0x11112222 - c = 0x88889999 - d = 0xcdef0000 + printf("%4b", big_endian4(0x12)) + printf("%4b", big_endian4(0x34)) + printf("%4b%4b", big_endian4(0xabcdef00), big_endian4(0x5678)) + a = big_endian4(0x12345678) + b = big_endian4(0x11112222) + c = big_endian4(0x88889999) + d = big_endian4(0xcdef0000) printf("%4b%4b%4b%4b", a, b, c, d) printf("a=%4b b=%4b c=%4b d=%4b",a,b,c,d) exit() diff --git a/testsuite/systemtap.printf/bin4a.stp b/testsuite/systemtap.printf/bin4a.stp deleted file mode 100644 index 40bbec7f..00000000 --- a/testsuite/systemtap.printf/bin4a.stp +++ /dev/null @@ -1,16 +0,0 @@ -# test of 32-bit binary prints -# Also tests big_endian4() - -probe begin -{ - printf("%4b", big_endian4(0x12)) - printf("%4b", big_endian4(0x34)) - printf("%4b%4b", big_endian4(0xabcdef00), big_endian4(0x5678)) - a = big_endian4(0x12345678) - b = big_endian4(0x11112222) - c = big_endian4(0x88889999) - d = big_endian4(0xcdef0000) - printf("%4b%4b%4b%4b", a, b, c, d) - printf("a=%4b b=%4b c=%4b d=%4b",a,b,c,d) - exit() -} diff --git a/testsuite/systemtap.printf/bin5.exp b/testsuite/systemtap.printf/bin5.exp index 05069961..0f797f97 100644 --- a/testsuite/systemtap.printf/bin5.exp +++ b/testsuite/systemtap.printf/bin5.exp @@ -15,5 +15,3 @@ cd ef 20 62 3d 11 11 22 set test "bin5" stap_run_binary $srcdir/$subdir/$test.stp -set test "bin5a" -stap_run_binary $srcdir/$subdir/$test.stp diff --git a/testsuite/systemtap.printf/bin5.stp b/testsuite/systemtap.printf/bin5.stp index 3a88de60..ebee2e01 100644 --- a/testsuite/systemtap.printf/bin5.stp +++ b/testsuite/systemtap.printf/bin5.stp @@ -4,14 +4,13 @@ probe begin { - set_endian(2) - printf("%8b", 0x12) - printf("%8b", 0x34) - printf("%8b%8b", 0xabcd000011112222, 0x5678567856785678) - a = 0x0012345678abcdef - b = 0x1111222233334444 - c = 0x88889999aaaabbbb - d = 0xcdef000011112222 + printf("%8b", big_endian8(0x12)) + printf("%8b", big_endian8(0x34)) + printf("%8b%8b", big_endian8(0xabcd000011112222), big_endian8(0x5678567856785678)) + a = big_endian8(0x0012345678abcdef) + b = big_endian8(0x1111222233334444) + c = big_endian8(0x88889999aaaabbbb) + d = big_endian8(0xcdef000011112222) printf("%8b%8b%8b%8b", a, b, c, d) printf("a=%8b b=%8b c=%8b d=%8b",a,b,c,d) exit() diff --git a/testsuite/systemtap.printf/bin5a.stp b/testsuite/systemtap.printf/bin5a.stp deleted file mode 100644 index ebee2e01..00000000 --- a/testsuite/systemtap.printf/bin5a.stp +++ /dev/null @@ -1,17 +0,0 @@ -# test of 64-bit binary prints -# need to use big_endian8() to get consistent results across -# different-endian architectures. - -probe begin -{ - printf("%8b", big_endian8(0x12)) - printf("%8b", big_endian8(0x34)) - printf("%8b%8b", big_endian8(0xabcd000011112222), big_endian8(0x5678567856785678)) - a = big_endian8(0x0012345678abcdef) - b = big_endian8(0x1111222233334444) - c = big_endian8(0x88889999aaaabbbb) - d = big_endian8(0xcdef000011112222) - printf("%8b%8b%8b%8b", a, b, c, d) - printf("a=%8b b=%8b c=%8b d=%8b",a,b,c,d) - exit() -} diff --git a/testsuite/systemtap.samples/pfaults.exp b/testsuite/systemtap.samples/pfaults.exp index 7675078c..2cab7c14 100644 --- a/testsuite/systemtap.samples/pfaults.exp +++ b/testsuite/systemtap.samples/pfaults.exp @@ -1,7 +1,7 @@ set test "pfaults" if {![installtest_p]} { untested $test; return } -spawn stap -g $srcdir/$subdir/pfaults.stp +spawn stap -DMAXACTION=10000 -g $srcdir/$subdir/pfaults.stp set pid $spawn_id set ok 0 expect { diff --git a/testsuite/systemtap.samples/profile.exp b/testsuite/systemtap.samples/profile.exp index 249a1589..9ca9da15 100644 --- a/testsuite/systemtap.samples/profile.exp +++ b/testsuite/systemtap.samples/profile.exp @@ -1,7 +1,7 @@ set test "profile" if {![installtest_p]} { untested $test; return } -spawn stap $srcdir/$subdir/profile.stp +spawn stap -DMAXMAPENTRIES=10000 $srcdir/$subdir/profile.stp set ok 0 expect { -timeout 360 |