* What's new in version 2.9
+- New tapset functions arch_bytes() and uarch_bytes() to obtain address size
+ for kernel and user space respectively.
+
- New tapset function switch_file() allows control over rotation
of output files.
return !user_mode();
}
+function arch_bytes:long() %{ /* pure */
+ STAP_RETVALUE = sizeof(long);
+%}
+
+function uarch_bytes:long() {
+ if (!user_mode()) {
+ error("requires user mode")
+ return 0
+ } else
+ return 4
+}
+
/* Return the named register value as a signed value. */
function register:long (name:string) {
if (!registers_valid()) {
STAP_RETVALUE = (CONTEXT->user_mode_p && _stp_is_compat_task());
%}
+function arch_bytes:long() %{ /* pure */
+ STAP_RETVALUE = sizeof(long);
+%}
+
+function uarch_bytes:long() {
+ if (!user_mode()) {
+ error("requires user mode")
+ return 0
+ } else
+ return probing_32bit_app() ? 4 : 8
+}
+
function _stp_get_register_by_offset:long (offset:long) %{ /* pure */
long value;
struct pt_regs *regs;
return !user_mode();
}
+function arch_bytes:long() %{ /* pure */
+ STAP_RETVALUE = sizeof(long);
+%}
+
+function uarch_bytes:long() {
+ if (!user_mode()) {
+ error("requires user mode")
+ return 0
+ } else
+ return 4
+}
+
/*
* esp and ss aren't saved on a breakpoint in kernel mode, so
* the pre-trap stack pointer is ®s->sp.
return value
}
+function probing_32bit_app:long() %{ /* pure */
+ STAP_RETVALUE = (CONTEXT->user_mode_p && _stp_is_compat_task());
+%}
+
+function arch_bytes:long() %{ /* pure */
+ STAP_RETVALUE = sizeof(long);
+%}
+
+function uarch_bytes:long() {
+ if (!user_mode()) {
+ error("requires user mode")
+ return 0
+ } else
+ return probing_32bit_app() ? 4 : 8
+}
+
/*
* Return the value of function arg #argnum (1=first arg). If
* truncate=1, mask off the top 32 bits. If sign_extend=1 and
STAP_RETVALUE = (CONTEXT->user_mode_p && _stp_is_compat_task());
%}
+function arch_bytes:long() %{ /* pure */
+ STAP_RETVALUE = sizeof(long);
+%}
+
+function uarch_bytes:long() {
+ if (!user_mode()) {
+ error("requires user mode")
+ return 0
+ } else
+ return probing_32bit_app() ? 4 : 8
+}
+
function _stp_get_register_by_offset:long (offset:long) %{ /* pure */
long value;
struct pt_regs *regs;
return !user_mode();
}
+function arch_bytes:long() %{ /* pure */
+ STAP_RETVALUE = sizeof(long);
+%}
+
+function uarch_bytes:long() {
+ if (!user_mode()) {
+ error("requires user mode")
+ return 0
+ } else
+ return probing_32bit_app() ? 4 : 8
+}
+
function _stp_get_register_by_offset:long (offset:long) %{ /* pure */
long value;
struct pt_regs *regs;
STAP_RETVALUE = (CONTEXT->user_mode_p && _stp_is_compat_task());
%}
+function arch_bytes:long() %{ /* pure */
+ STAP_RETVALUE = sizeof(long);
+%}
+
+function uarch_bytes:long() {
+ if (!user_mode()) {
+ error("requires user mode")
+ return 0
+ } else
+ return probing_32bit_app() ? 4 : 8
+}
+
/* Return the value of function arg #argnum (1=first arg) as a signed int. */
function int_arg:long (argnum:long) {
return _stp_arg2(argnum, 1, 1, 0)
--- /dev/null
+#! stap -p4
+
+probe begin {
+ println(arch_bytes())
+ println(uarch_bytes())
+}
else if (seq_type == "list")
ob_items = @cast (tuple, "PyListObject", @PYTHON2_LIBRARY)->ob_item;
- ob_item = user_long (ob_items + (i * %{ sizeof (intptr_t) %}))
+ ob_item = user_long (ob_items + (i * uarch_bytes()))
return ob_item
}
for (i = 0; i < co_argcount; i++) {
if (i == 0) print ("(");
arg_name_str = user_string (@cast (get_sequence_item (co_varnames, i, "tuple"), "PyStringObject", @PYTHON2_LIBRARY)->ob_sval)
- arg_value = user_long (f_localsplus + (i * %{ sizeof (intptr_t) %}))
+ arg_value = user_long (f_localsplus + (i * uarch_bytes()))
arg_type_name_str = get_type (arg_value)
printf ("%s:%s ", arg_name_str, arg_type_name_str)
}
arg_name_str = user_string (@cast (get_sequence_item (co_varnames, i, "tuple"), "PyStringObject", @PYTHON2_LIBRARY)->ob_sval)
if (! wildcard_match (arg_name_str, variable))
continue
- arg_value = user_long (f_localsplus + (i * %{ sizeof (intptr_t) %}))
+ arg_value = user_long (f_localsplus + (i * uarch_bytes()))
arg_type_name_str = get_type (arg_value)
next_var = 0
foreach ([var, file] in python2_vars_seen)
else if (seq_type == "list")
ob_items = @cast (tuple, "PyListObject", @PYTHON3_LIBRARY)->ob_item;
- ob_item = user_long (ob_items + (i * %{ sizeof (intptr_t) %}))
+ ob_item = user_long (ob_items + (i * uarch_bytes()))
return ob_item
}
for (i = 0; i < co_argcount; i++) {
if (i == 0) print ("(");
arg_name_str = get_unicode (p3_get_sequence_item (co_varnames, i, "tuple"))
- arg_value = user_long (f_localsplus + (i * %{ sizeof (intptr_t) %}))
+ arg_value = user_long (f_localsplus + (i * uarch_bytes()))
arg_type_name_str = p3_get_type (arg_value)
printf ("%s:%s ", arg_name_str, arg_type_name_str)
}
arg_name_str = get_unicode (p3_get_sequence_item (co_varnames, i, "tuple"))
if (! wildcard_match (arg_name_str, variable))
continue
- arg_value = user_long (f_localsplus + (i * %{ sizeof (intptr_t) %}))
+ arg_value = user_long (f_localsplus + (i * uarch_bytes()))
arg_type_name_str = p3_get_type (arg_value)
next_var = 0
foreach ([var, file] in python3_vars_seen)