This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: SystemTap release 0.9.8
- From: Diego Calleja <diegocg at gmail dot com>
- To: Josh Stone <jistone at redhat dot com>
- Cc: SystemTap <systemtap at sourceware dot org>
- Date: Sat, 13 Jun 2009 16:04:17 +0200
- Subject: Re: SystemTap release 0.9.8
- References: <4A31A945.7010705@redhat.com> <200906122228.43238.diegocg@gmail.com> <4A3305D1.2070705@redhat.com>
On SÃbado 13 Junio 2009 03:50:09 Josh Stone escribiÃ:
> I suspect that we may have an issue with escaping the non-ASCII
> characters in your path. I tried to recreate your path though, and it
> still worked for me. It may still be some other locale issue though.
>
> The '-k' option will cause stap to leave the tmp directory in place
> after it's done. Can you collect that .c file and attach it for us to see?
It seems that you are right - all the error messages came from lines
like this:
c->last_stmt = "identifier '__ip_sock_saddr' at /home/diego/c\703\663digo/systemtap/binarios/share/systemtap/tapset/ip.stp:27:10";
Gcc only warns about that, but the -Werror makes the whole compilation fail.
By the way, I suggest to change this message:
Pass 4: compilation failed. Try again with another '--vp 0001' option
"-vp 0001" is not going to fix the problem, so it's not a very useful msg
for users. I suggest something like:
"Pass 4: Systemtap found an error. Try again with another '--vp 0001' option
to get more details. See http://sourceware.org/systemtap/wiki/HowToReportBugs
if you want to send a bug report"
#ifndef MAXNESTING
#define MAXNESTING 10
#endif
#ifndef MAXSTRINGLEN
#define MAXSTRINGLEN 128
#endif
#ifndef MAXACTION
#define MAXACTION 1000
#endif
#ifndef MAXACTION_INTERRUPTIBLE
#define MAXACTION_INTERRUPTIBLE (MAXACTION * 10)
#endif
#ifndef MAXTRYLOCK
#define MAXTRYLOCK MAXACTION
#endif
#ifndef TRYLOCKDELAY
#define TRYLOCKDELAY 100
#endif
#ifndef MAXMAPENTRIES
#define MAXMAPENTRIES 2048
#endif
#ifndef MAXERRORS
#define MAXERRORS 0
#endif
#ifndef MAXSKIPPED
#define MAXSKIPPED 100
#endif
#ifndef MINSTACKSPACE
#define MINSTACKSPACE 1024
#endif
#ifndef INTERRUPTIBLE
#define INTERRUPTIBLE 1
#endif
#ifndef STP_OVERLOAD_INTERVAL
#define STP_OVERLOAD_INTERVAL 1000000000LL
#endif
#ifndef STP_OVERLOAD_THRESHOLD
#define STP_OVERLOAD_THRESHOLD 500000000LL
#endif
#ifndef STP_NO_OVERLOAD
#define STP_OVERLOAD
#endif
#define STP_SKIP_BADVARS 0
#include "runtime.h"
#include "stack.c"
#include "stat.c"
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/profile.h>
#include <linux/random.h>
#include <linux/vermagic.h>
#include <linux/utsname.h>
#include <linux/version.h>
#include "loc2c-runtime.h"
#ifndef read_trylock
#define read_trylock(x) ({ read_lock(x); 1; })
#endif
typedef char string_t[MAXSTRINGLEN];
#define STAP_SESSION_STARTING 0
#define STAP_SESSION_RUNNING 1
#define STAP_SESSION_ERROR 2
#define STAP_SESSION_STOPPING 3
#define STAP_SESSION_STOPPED 4
static atomic_t session_state = ATOMIC_INIT (STAP_SESSION_STARTING);
static atomic_t error_count = ATOMIC_INIT (0);
static atomic_t skipped_count = ATOMIC_INIT (0);
static atomic_t skipped_count_lowstack = ATOMIC_INIT (0);
static atomic_t skipped_count_reentrant = ATOMIC_INIT (0);
static atomic_t skipped_count_uprobe_reg = ATOMIC_INIT (0);
static atomic_t skipped_count_uprobe_unreg = ATOMIC_INIT (0);
struct context {
atomic_t busy;
const char *probe_point;
int actionremaining;
unsigned nesting;
string_t error_buffer;
const char *last_error;
const char *last_stmt;
struct pt_regs *regs;
unsigned long *unwaddr;
struct kretprobe_instance *pi;
int regparm;
va_list *mark_va_list;
const char * marker_name;
const char * marker_format;
void *data;
#ifdef STP_TIMING
Stat *statp;
#endif
#ifdef STP_OVERLOAD
cycles_t cycles_base;
cycles_t cycles_sum;
#endif
union {
struct probe_1746_locals {
union {
struct {
string_t __tmp0;
};
struct {
string_t __tmp3;
};
struct {
string_t __tmp6;
};
};
} probe_1746;
struct probe_1748_locals {
string_t saddr;
int64_t sport;
int64_t dport;
union {
struct {
string_t __tmp0;
int64_t __tmp2;
int64_t __tmp3;
};
struct {
int64_t __tmp4;
int64_t __tmp5;
};
struct {
int64_t __tmp6;
int64_t __tmp8;
};
struct {
int64_t __tmp9;
int64_t __tmp11;
};
struct {
string_t __tmp12;
int64_t __tmp13;
int64_t __tmp14;
};
};
} probe_1748;
struct function___ip_sock_daddr_locals {
int64_t sock;
int64_t __tmp0;
int64_t __retvalue;
} function___ip_sock_daddr;
struct function___ip_sock_saddr_locals {
int64_t sock;
int64_t __tmp0;
int64_t __retvalue;
} function___ip_sock_saddr;
struct function___tcp_sock_dport_locals {
int64_t sock;
int64_t __tmp0;
int64_t __retvalue;
} function___tcp_sock_dport;
struct function___tcp_sock_sport_locals {
int64_t sock;
int64_t __tmp0;
int64_t __retvalue;
} function___tcp_sock_sport;
struct function__dwarf_tvar_get_cast_11_locals {
int64_t pointer;
int64_t __retvalue;
} function__dwarf_tvar_get_cast_11;
struct function__dwarf_tvar_get_cast_20_locals {
int64_t pointer;
int64_t __retvalue;
} function__dwarf_tvar_get_cast_20;
struct function__dwarf_tvar_get_cast_6_locals {
int64_t pointer;
int64_t __retvalue;
} function__dwarf_tvar_get_cast_6;
struct function__dwarf_tvar_get_cast_7_locals {
int64_t pointer;
int64_t __retvalue;
} function__dwarf_tvar_get_cast_7;
struct function__dwarf_tvar_get_sk_2_locals {
int64_t __retvalue;
} function__dwarf_tvar_get_sk_2;
struct function_ip_ntop_locals {
int64_t addr;
string_t __retvalue;
} function_ip_ntop;
} locals [MAXNESTING];
};
static void *contexts = NULL; /* alloc_percpu */
#include <linux/skbuff.h>
#include <linux/version.h>
#include <net/sock.h>
#include <net/tcp.h>
#include <net/ip.h>
#include <linux/skbuff.h>
static void function___ip_sock_daddr (struct context * __restrict__ c);
static void function___ip_sock_saddr (struct context * __restrict__ c);
static void function___tcp_sock_dport (struct context * __restrict__ c);
static void function___tcp_sock_sport (struct context * __restrict__ c);
static void function__dwarf_tvar_get_cast_11 (struct context * __restrict__ c);
static void function__dwarf_tvar_get_cast_20 (struct context * __restrict__ c);
static void function__dwarf_tvar_get_cast_6 (struct context * __restrict__ c);
static void function__dwarf_tvar_get_cast_7 (struct context * __restrict__ c);
static void function__dwarf_tvar_get_sk_2 (struct context * __restrict__ c);
static void function_ip_ntop (struct context * __restrict__ c);
static void function___ip_sock_daddr (struct context* __restrict__ c) {
struct function___ip_sock_daddr_locals * __restrict__ l =
& c->locals[c->nesting+1].function___ip_sock_daddr;
(void) l;
#define CONTEXT c
#define THIS l
if (0) goto out;
c->last_stmt = "identifier '__ip_sock_daddr' at /home/diego/c\703\663digo/systemtap/binarios/share/systemtap/tapset/ip.stp:33:10";
if (unlikely (c->nesting+2 >= MAXNESTING)) {
c->last_error = "MAXNESTING exceeded";
return;
} else {
c->nesting ++;
}
l->__retvalue = 0;
#define return goto out
l->__retvalue =
({
l->__tmp0 = l->sock;
c->locals[c->nesting+1].function__dwarf_tvar_get_cast_7.pointer = l->__tmp0;
function__dwarf_tvar_get_cast_7 (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function__dwarf_tvar_get_cast_7.__retvalue;
});
c->actionremaining -= 1;
if (unlikely (c->actionremaining <= 0)) {
c->last_error = "MAXACTION exceeded";
goto out;
}
goto out;
#undef return
out:
;
c->nesting --;
#undef CONTEXT
#undef THIS
}
static void function___ip_sock_saddr (struct context* __restrict__ c) {
struct function___ip_sock_saddr_locals * __restrict__ l =
& c->locals[c->nesting+1].function___ip_sock_saddr;
(void) l;
#define CONTEXT c
#define THIS l
if (0) goto out;
c->last_stmt = "identifier '__ip_sock_saddr' at /home/diego/c\703\663digo/systemtap/binarios/share/systemtap/tapset/ip.stp:27:10";
if (unlikely (c->nesting+2 >= MAXNESTING)) {
c->last_error = "MAXNESTING exceeded";
return;
} else {
c->nesting ++;
}
l->__retvalue = 0;
#define return goto out
l->__retvalue =
({
l->__tmp0 = l->sock;
c->locals[c->nesting+1].function__dwarf_tvar_get_cast_6.pointer = l->__tmp0;
function__dwarf_tvar_get_cast_6 (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function__dwarf_tvar_get_cast_6.__retvalue;
});
c->actionremaining -= 1;
if (unlikely (c->actionremaining <= 0)) {
c->last_error = "MAXACTION exceeded";
goto out;
}
goto out;
#undef return
out:
;
c->nesting --;
#undef CONTEXT
#undef THIS
}
static void function___tcp_sock_dport (struct context* __restrict__ c) {
struct function___tcp_sock_dport_locals * __restrict__ l =
& c->locals[c->nesting+1].function___tcp_sock_dport;
(void) l;
#define CONTEXT c
#define THIS l
if (0) goto out;
c->last_stmt = "identifier '__tcp_sock_dport' at /home/diego/c\703\663digo/systemtap/binarios/share/systemtap/tapset/tcp.stp:78:10";
if (unlikely (c->nesting+2 >= MAXNESTING)) {
c->last_error = "MAXNESTING exceeded";
return;
} else {
c->nesting ++;
}
l->__retvalue = 0;
#define return goto out
l->__retvalue =
({
l->__tmp0 = l->sock;
c->locals[c->nesting+1].function__dwarf_tvar_get_cast_11.pointer = l->__tmp0;
function__dwarf_tvar_get_cast_11 (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function__dwarf_tvar_get_cast_11.__retvalue;
});
c->actionremaining -= 1;
if (unlikely (c->actionremaining <= 0)) {
c->last_error = "MAXACTION exceeded";
goto out;
}
goto out;
#undef return
out:
;
c->nesting --;
#undef CONTEXT
#undef THIS
}
static void function___tcp_sock_sport (struct context* __restrict__ c) {
struct function___tcp_sock_sport_locals * __restrict__ l =
& c->locals[c->nesting+1].function___tcp_sock_sport;
(void) l;
#define CONTEXT c
#define THIS l
if (0) goto out;
c->last_stmt = "identifier '__tcp_sock_sport' at /home/diego/c\703\663digo/systemtap/binarios/share/systemtap/tapset/tcp.stp:147:10";
if (unlikely (c->nesting+2 >= MAXNESTING)) {
c->last_error = "MAXNESTING exceeded";
return;
} else {
c->nesting ++;
}
l->__retvalue = 0;
#define return goto out
l->__retvalue =
({
l->__tmp0 = l->sock;
c->locals[c->nesting+1].function__dwarf_tvar_get_cast_20.pointer = l->__tmp0;
function__dwarf_tvar_get_cast_20 (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function__dwarf_tvar_get_cast_20.__retvalue;
});
c->actionremaining -= 1;
if (unlikely (c->actionremaining <= 0)) {
c->last_error = "MAXACTION exceeded";
goto out;
}
goto out;
#undef return
out:
;
c->nesting --;
#undef CONTEXT
#undef THIS
}
static void function__dwarf_tvar_get_cast_11 (struct context* __restrict__ c) {
struct function__dwarf_tvar_get_cast_11_locals * __restrict__ l =
& c->locals[c->nesting+1].function__dwarf_tvar_get_cast_11;
(void) l;
#define CONTEXT c
#define THIS l
if (0) goto out;
c->last_stmt = "identifier '@cast' at /home/diego/c\703\663digo/systemtap/binarios/share/systemtap/tapset/tcp.stp:79:9";
if (unlikely (c->nesting+2 >= MAXNESTING)) {
c->last_error = "MAXNESTING exceeded";
return;
} else {
c->nesting ++;
}
l->__retvalue = 0;
#define return goto out
{
{
{
intptr_t addr;
{ // synthesized
addr = THIS->pointer;
}
{ // DWARF expression: 0x23(544)
{
intptr_t s0;
s0 = addr;
s0 = s0 + 544UL;
addr = s0;
}
}
{ uint16_t value = deref (2, addr);THIS->__retvalue = value; }
}
goto out;
if (0) goto deref_fault;
deref_fault:
goto out;
}
/* pure */
}
#undef return
out:
;
c->nesting --;
#undef CONTEXT
#undef THIS
}
static void function__dwarf_tvar_get_cast_20 (struct context* __restrict__ c) {
struct function__dwarf_tvar_get_cast_20_locals * __restrict__ l =
& c->locals[c->nesting+1].function__dwarf_tvar_get_cast_20;
(void) l;
#define CONTEXT c
#define THIS l
if (0) goto out;
c->last_stmt = "identifier '@cast' at /home/diego/c\703\663digo/systemtap/binarios/share/systemtap/tapset/tcp.stp:148:9";
if (unlikely (c->nesting+2 >= MAXNESTING)) {
c->last_error = "MAXNESTING exceeded";
return;
} else {
c->nesting ++;
}
l->__retvalue = 0;
#define return goto out
{
{
{
intptr_t addr;
{ // synthesized
addr = THIS->pointer;
}
{ // DWARF expression: 0x23(568)
{
intptr_t s0;
s0 = addr;
s0 = s0 + 568UL;
addr = s0;
}
}
{ uint16_t value = deref (2, addr);THIS->__retvalue = value; }
}
goto out;
if (0) goto deref_fault;
deref_fault:
goto out;
}
/* pure */
}
#undef return
out:
;
c->nesting --;
#undef CONTEXT
#undef THIS
}
static void function__dwarf_tvar_get_cast_6 (struct context* __restrict__ c) {
struct function__dwarf_tvar_get_cast_6_locals * __restrict__ l =
& c->locals[c->nesting+1].function__dwarf_tvar_get_cast_6;
(void) l;
#define CONTEXT c
#define THIS l
if (0) goto out;
c->last_stmt = "identifier '@cast' at /home/diego/c\703\663digo/systemtap/binarios/share/systemtap/tapset/ip.stp:29:9";
if (unlikely (c->nesting+2 >= MAXNESTING)) {
c->last_error = "MAXNESTING exceeded";
return;
} else {
c->nesting ++;
}
l->__retvalue = 0;
#define return goto out
{
{
{
intptr_t addr;
{ // synthesized
addr = THIS->pointer;
}
{ // DWARF expression: 0x23(548)
{
intptr_t s0;
s0 = addr;
s0 = s0 + 548UL;
addr = s0;
}
}
{ uint32_t value = deref (4, addr);THIS->__retvalue = value; }
}
goto out;
if (0) goto deref_fault;
deref_fault:
goto out;
}
/* pure */
}
#undef return
out:
;
c->nesting --;
#undef CONTEXT
#undef THIS
}
static void function__dwarf_tvar_get_cast_7 (struct context* __restrict__ c) {
struct function__dwarf_tvar_get_cast_7_locals * __restrict__ l =
& c->locals[c->nesting+1].function__dwarf_tvar_get_cast_7;
(void) l;
#define CONTEXT c
#define THIS l
if (0) goto out;
c->last_stmt = "identifier '@cast' at /home/diego/c\703\663digo/systemtap/binarios/share/systemtap/tapset/ip.stp:35:9";
if (unlikely (c->nesting+2 >= MAXNESTING)) {
c->last_error = "MAXNESTING exceeded";
return;
} else {
c->nesting ++;
}
l->__retvalue = 0;
#define return goto out
{
{
{
intptr_t addr;
{ // synthesized
addr = THIS->pointer;
}
{ // DWARF expression: 0x23(536)
{
intptr_t s0;
s0 = addr;
s0 = s0 + 536UL;
addr = s0;
}
}
{ uint32_t value = deref (4, addr);THIS->__retvalue = value; }
}
goto out;
if (0) goto deref_fault;
deref_fault:
goto out;
}
/* pure */
}
#undef return
out:
;
c->nesting --;
#undef CONTEXT
#undef THIS
}
static void function__dwarf_tvar_get_sk_2 (struct context* __restrict__ c) {
struct function__dwarf_tvar_get_sk_2_locals * __restrict__ l =
& c->locals[c->nesting+1].function__dwarf_tvar_get_sk_2;
(void) l;
#define CONTEXT c
#define THIS l
if (0) goto out;
c->last_stmt = "identifier '$sk' at /home/diego/c\703\663digo/systemtap/binarios/share/systemtap/tapset/tcp.stp:271:36";
if (unlikely (c->nesting+2 >= MAXNESTING)) {
c->last_error = "MAXNESTING exceeded";
return;
} else {
c->nesting ++;
}
l->__retvalue = 0;
#define return goto out
{
{
{
uint64_t addr;
{ // DWARF expression: 0x54
{ uint64_t value = fetch_register (4);addr = value; }
}
THIS->__retvalue = addr;
}
goto out;
if (0) goto deref_fault;
deref_fault:
goto out;
}
/* pure */
}
#undef return
out:
;
c->nesting --;
#undef CONTEXT
#undef THIS
}
static void function_ip_ntop (struct context* __restrict__ c) {
struct function_ip_ntop_locals * __restrict__ l =
& c->locals[c->nesting+1].function_ip_ntop;
(void) l;
#define CONTEXT c
#define THIS l
if (0) goto out;
c->last_stmt = "identifier 'ip_ntop' at /home/diego/c\703\663digo/systemtap/binarios/share/systemtap/tapset/ip.stp:18:10";
if (unlikely (c->nesting+2 >= MAXNESTING)) {
c->last_error = "MAXNESTING exceeded";
return;
} else {
c->nesting ++;
}
l->__retvalue[0] = '\0';
#define return goto out
{
__be32 ip;
ip = THIS->addr;
snprintf(THIS->__retvalue, MAXSTRINGLEN, NIPQUAD_FMT, NIPQUAD(ip));
}
#undef return
out:
;
c->nesting --;
#undef CONTEXT
#undef THIS
}
#ifdef STP_TIMING
static __cacheline_aligned Stat time_probe_0;
#endif
static void probe_1746 (struct context * __restrict__ c) {
struct probe_1746_locals * __restrict__ l =
& c->locals[0].probe_1746;
(void) l;
#ifdef STP_TIMING
c->statp = & time_probe_0;
#endif
{
(void)
({
strlcpy (l->__tmp0,
({
c->locals[c->nesting+1].function_ip_ntop.addr = ((int64_t)123456789LL);
function_ip_ntop (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function_ip_ntop.__retvalue;
}), MAXSTRINGLEN);
_stp_printf ("Expected IP 7.91.205.21 .... %s\n", l->__tmp0);
((int64_t)0LL);
});
(void)
({
strlcpy (l->__tmp3,
({
c->locals[c->nesting+1].function_ip_ntop.addr = ((int64_t)987654321LL);
function_ip_ntop (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function_ip_ntop.__retvalue;
}), MAXSTRINGLEN);
_stp_printf ("Expected IP 58.222.104.177 .... %s\n", l->__tmp3);
((int64_t)0LL);
});
(void)
({
strlcpy (l->__tmp6,
({
c->locals[c->nesting+1].function_ip_ntop.addr = ((int64_t)151240559LL);
function_ip_ntop (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function_ip_ntop.__retvalue;
}), MAXSTRINGLEN);
_stp_printf ("Expected IP 9.3.191.111 ... %s\n", l->__tmp6);
((int64_t)0LL);
});
}
c->actionremaining -= 3;
if (unlikely (c->actionremaining <= 0)) {
c->last_error = "MAXACTION exceeded";
goto out;
}
out:
_stp_print_flush();
}
#ifdef STP_TIMING
static __cacheline_aligned Stat time_probe_1;
#endif
static void probe_1748 (struct context * __restrict__ c) {
struct probe_1748_locals * __restrict__ l =
& c->locals[0].probe_1748;
(void) l;
#ifdef STP_TIMING
c->statp = & time_probe_1;
#endif
bspcache(c->unwaddr, c->regs);
{
unsigned numtrylock = 0;
(void) numtrylock;
if (0) goto unlock_;
}
l->saddr[0] = '\0';
l->sport = 0;
l->dport = 0;
{
(void)
({
strlcpy (l->__tmp0,
({
l->__tmp2 =
({
l->__tmp3 =
({
function__dwarf_tvar_get_sk_2 (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function__dwarf_tvar_get_sk_2.__retvalue;
});
c->locals[c->nesting+1].function___ip_sock_saddr.sock = l->__tmp3;
function___ip_sock_saddr (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function___ip_sock_saddr.__retvalue;
});
c->locals[c->nesting+1].function_ip_ntop.addr = l->__tmp2;
function_ip_ntop (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function_ip_ntop.__retvalue;
}), MAXSTRINGLEN);
strlcpy (l->saddr, l->__tmp0, MAXSTRINGLEN);
l->__tmp0;
});
(void)
({
l->__tmp4 =
({
l->__tmp5 =
({
function__dwarf_tvar_get_sk_2 (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function__dwarf_tvar_get_sk_2.__retvalue;
});
c->locals[c->nesting+1].function___ip_sock_daddr.sock = l->__tmp5;
function___ip_sock_daddr (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function___ip_sock_daddr.__retvalue;
});
c->locals[c->nesting+1].function_ip_ntop.addr = l->__tmp4;
function_ip_ntop (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function_ip_ntop.__retvalue;
});
(void)
({
l->__tmp6 =
({
l->__tmp8 =
({
function__dwarf_tvar_get_sk_2 (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function__dwarf_tvar_get_sk_2.__retvalue;
});
c->locals[c->nesting+1].function___tcp_sock_sport.sock = l->__tmp8;
function___tcp_sock_sport (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function___tcp_sock_sport.__retvalue;
});
l->sport = l->__tmp6;
l->__tmp6;
});
(void)
({
l->__tmp9 =
({
l->__tmp11 =
({
function__dwarf_tvar_get_sk_2 (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function__dwarf_tvar_get_sk_2.__retvalue;
});
c->locals[c->nesting+1].function___tcp_sock_dport.sock = l->__tmp11;
function___tcp_sock_dport (c);
if (unlikely(c->last_error)) goto out;
c->locals[c->nesting+1].function___tcp_sock_dport.__retvalue;
});
l->dport = l->__tmp9;
l->__tmp9;
});
(void)
({
strlcpy (l->__tmp12, l->saddr, MAXSTRINGLEN);
l->__tmp13 = l->dport;
l->__tmp14 = l->sport;
_stp_printf ("received a message from %s on port %lld from port %lld\n", l->__tmp12, l->__tmp13, l->__tmp14);
((int64_t)0LL);
});
}
c->actionremaining -= 5;
if (unlikely (c->actionremaining <= 0)) {
c->last_error = "MAXACTION exceeded";
goto out;
}
out:
_stp_print_flush();
unlock_: ;
}
/* ---- begin/end/error probes ---- */
static struct stap_be_probe {
void (*ph)(struct context*);
const char* pp;
int state, type;
} stap_be_probes[] = {
{ .pp="begin", .ph=&probe_1746, .state=STAP_SESSION_STARTING, .type=0 },
};
static void enter_be_probe (struct stap_be_probe *stp) {
struct context* __restrict__ c;
#if !INTERRUPTIBLE
unsigned long flags;
#endif
#ifdef STP_TIMING
cycles_t cycles_atstart = get_cycles ();
#endif
#if INTERRUPTIBLE
preempt_disable ();
#else
local_irq_save (flags);
#endif
if (unlikely ((((unsigned long) (& c)) & (THREAD_SIZE-1))
< (MINSTACKSPACE + sizeof (struct thread_info)))) {
atomic_inc (& skipped_count);
#ifdef STP_TIMING
atomic_inc (& skipped_count_lowstack);
#endif
goto probe_epilogue;
}
if (atomic_read (&session_state) != stp->state)
goto probe_epilogue;
c = per_cpu_ptr (contexts, smp_processor_id());
if (atomic_inc_return (& c->busy) != 1) {
#if !INTERRUPTIBLE
atomic_inc (& skipped_count);
#endif
#ifdef STP_TIMING
atomic_inc (& skipped_count_reentrant);
#ifdef DEBUG_REENTRANCY
_stp_warn ("Skipped %s due to %s residency on cpu %u\n", stp->pp, c->probe_point ?: "?", smp_processor_id());
#endif
#endif
atomic_dec (& c->busy);
goto probe_epilogue;
}
c->last_stmt = 0;
c->last_error = 0;
c->nesting = 0;
c->regs = 0;
c->unwaddr = 0;
c->probe_point = stp->pp;
c->pi = 0;
c->regparm = 0;
c->marker_name = NULL;
c->marker_format = NULL;
#if INTERRUPTIBLE
c->actionremaining = MAXACTION_INTERRUPTIBLE;
#else
c->actionremaining = MAXACTION;
#endif
#ifdef STP_TIMING
c->statp = 0;
#endif
(*stp->ph) (c);
#ifdef STP_TIMING
{
cycles_t cycles_atend = get_cycles ();
int32_t cycles_elapsed = ((int32_t)cycles_atend > (int32_t)cycles_atstart)
? ((int32_t)cycles_atend - (int32_t)cycles_atstart)
: (~(int32_t)0) - (int32_t)cycles_atstart + (int32_t)cycles_atend + 1;
#ifdef STP_TIMING
if (likely (c->statp)) _stp_stat_add(*c->statp, cycles_elapsed);
#endif
}
#endif
c->probe_point = 0;
if (unlikely (c->last_error && c->last_error[0])) {
if (c->last_stmt != NULL)
_stp_softerror ("%s near %s", c->last_error, c->last_stmt);
else
_stp_softerror ("%s", c->last_error);
atomic_inc (& error_count);
if (atomic_read (& error_count) > MAXERRORS) {
atomic_set (& session_state, STAP_SESSION_ERROR);
_stp_exit ();
}
}
atomic_dec (&c->busy);
probe_epilogue:
if (unlikely (atomic_read (& skipped_count) > MAXSKIPPED)) {
atomic_set (& session_state, STAP_SESSION_ERROR);
_stp_exit ();
}
#if INTERRUPTIBLE
preempt_enable_no_resched ();
#else
local_irq_restore (flags);
#endif
}
/* ---- dwarf probes ---- */
#if ! defined(CONFIG_KPROBES)
#error "Need CONFIG_KPROBES!"
#endif
static int enter_kprobe_probe (struct kprobe *inst, struct pt_regs *regs);
static int enter_kretprobe_probe (struct kretprobe_instance *inst, struct pt_regs *regs);
#if defined(STAPCONF_UNREGISTER_KPROBES)
static void * stap_unreg_kprobes[1];
#endif
static struct stap_dwarf_kprobe {
union { struct kprobe kp; struct kretprobe krp; } u;
#ifdef __ia64__
struct kprobe dummy;
#endif
} stap_dwarf_kprobes[1];
static struct stap_dwarf_probe {
const unsigned return_p:1;
const unsigned maxactive_p:1;
const unsigned optional_p:1;
unsigned registered_p:1;
const unsigned short maxactive_val;
const char module[7];
const char section[7];
const char pp[55];
const unsigned long address;
void (* const ph) (struct context*);
} stap_dwarf_probes[] = {
{ .address=(unsigned long)0x31f5b0ULL, .module="kernel", .section="_stext", .pp="kernel.function(\"tcp_recvmsg@net/ipv4/tcp.c:1312\")", .ph=&probe_1748 },
};
static int enter_kprobe_probe (struct kprobe *inst, struct pt_regs *regs) {
int kprobe_idx = ((uintptr_t)inst-(uintptr_t)stap_dwarf_kprobes)/sizeof(struct stap_dwarf_kprobe);
struct stap_dwarf_probe *sdp = &stap_dwarf_probes[((kprobe_idx >= 0 && kprobe_idx < 1)?kprobe_idx:0)];
struct context* __restrict__ c;
#if !INTERRUPTIBLE
unsigned long flags;
#endif
#if defined(STP_TIMING) || defined(STP_OVERLOAD)
cycles_t cycles_atstart = get_cycles ();
#endif
#if INTERRUPTIBLE
preempt_disable ();
#else
local_irq_save (flags);
#endif
if (unlikely ((((unsigned long) (& c)) & (THREAD_SIZE-1))
< (MINSTACKSPACE + sizeof (struct thread_info)))) {
atomic_inc (& skipped_count);
#ifdef STP_TIMING
atomic_inc (& skipped_count_lowstack);
#endif
goto probe_epilogue;
}
if (atomic_read (&session_state) != STAP_SESSION_RUNNING)
goto probe_epilogue;
c = per_cpu_ptr (contexts, smp_processor_id());
if (atomic_inc_return (& c->busy) != 1) {
#if !INTERRUPTIBLE
atomic_inc (& skipped_count);
#endif
#ifdef STP_TIMING
atomic_inc (& skipped_count_reentrant);
#ifdef DEBUG_REENTRANCY
_stp_warn ("Skipped %s due to %s residency on cpu %u\n", sdp->pp, c->probe_point ?: "?", smp_processor_id());
#endif
#endif
atomic_dec (& c->busy);
goto probe_epilogue;
}
c->last_stmt = 0;
c->last_error = 0;
c->nesting = 0;
c->regs = 0;
c->unwaddr = 0;
c->probe_point = sdp->pp;
c->pi = 0;
c->regparm = 0;
c->marker_name = NULL;
c->marker_format = NULL;
#if INTERRUPTIBLE
c->actionremaining = MAXACTION_INTERRUPTIBLE;
#else
c->actionremaining = MAXACTION;
#endif
#ifdef STP_TIMING
c->statp = 0;
#endif
c->regs = regs;
(*sdp->ph) (c);
#if defined(STP_TIMING) || defined(STP_OVERLOAD)
{
cycles_t cycles_atend = get_cycles ();
int32_t cycles_elapsed = ((int32_t)cycles_atend > (int32_t)cycles_atstart)
? ((int32_t)cycles_atend - (int32_t)cycles_atstart)
: (~(int32_t)0) - (int32_t)cycles_atstart + (int32_t)cycles_atend + 1;
#ifdef STP_TIMING
if (likely (c->statp)) _stp_stat_add(*c->statp, cycles_elapsed);
#endif
#ifdef STP_OVERLOAD
{
cycles_t interval = (cycles_atend > c->cycles_base)
? (cycles_atend - c->cycles_base)
: (STP_OVERLOAD_INTERVAL + 1);
c->cycles_sum += cycles_elapsed;
if (interval > STP_OVERLOAD_INTERVAL) {
if (c->cycles_sum > STP_OVERLOAD_THRESHOLD) {
_stp_error ("probe overhead exceeded threshold");
atomic_set (&session_state, STAP_SESSION_ERROR);
atomic_inc (&error_count);
}
c->cycles_base = cycles_atend;
c->cycles_sum = 0;
}
}
#endif
}
#endif
c->probe_point = 0;
if (unlikely (c->last_error && c->last_error[0])) {
if (c->last_stmt != NULL)
_stp_softerror ("%s near %s", c->last_error, c->last_stmt);
else
_stp_softerror ("%s", c->last_error);
atomic_inc (& error_count);
if (atomic_read (& error_count) > MAXERRORS) {
atomic_set (& session_state, STAP_SESSION_ERROR);
_stp_exit ();
}
}
atomic_dec (&c->busy);
probe_epilogue:
if (unlikely (atomic_read (& skipped_count) > MAXSKIPPED)) {
atomic_set (& session_state, STAP_SESSION_ERROR);
_stp_exit ();
}
#if INTERRUPTIBLE
preempt_enable_no_resched ();
#else
local_irq_restore (flags);
#endif
return 0;
}
static int enter_kretprobe_probe (struct kretprobe_instance *inst, struct pt_regs *regs) {
struct kretprobe *krp = inst->rp;
int kprobe_idx = ((uintptr_t)krp-(uintptr_t)stap_dwarf_kprobes)/sizeof(struct stap_dwarf_kprobe);
struct stap_dwarf_probe *sdp = &stap_dwarf_probes[((kprobe_idx >= 0 && kprobe_idx < 1)?kprobe_idx:0)];
struct context* __restrict__ c;
#if !INTERRUPTIBLE
unsigned long flags;
#endif
#if defined(STP_TIMING) || defined(STP_OVERLOAD)
cycles_t cycles_atstart = get_cycles ();
#endif
#if INTERRUPTIBLE
preempt_disable ();
#else
local_irq_save (flags);
#endif
if (unlikely ((((unsigned long) (& c)) & (THREAD_SIZE-1))
< (MINSTACKSPACE + sizeof (struct thread_info)))) {
atomic_inc (& skipped_count);
#ifdef STP_TIMING
atomic_inc (& skipped_count_lowstack);
#endif
goto probe_epilogue;
}
if (atomic_read (&session_state) != STAP_SESSION_RUNNING)
goto probe_epilogue;
c = per_cpu_ptr (contexts, smp_processor_id());
if (atomic_inc_return (& c->busy) != 1) {
#if !INTERRUPTIBLE
atomic_inc (& skipped_count);
#endif
#ifdef STP_TIMING
atomic_inc (& skipped_count_reentrant);
#ifdef DEBUG_REENTRANCY
_stp_warn ("Skipped %s due to %s residency on cpu %u\n", sdp->pp, c->probe_point ?: "?", smp_processor_id());
#endif
#endif
atomic_dec (& c->busy);
goto probe_epilogue;
}
c->last_stmt = 0;
c->last_error = 0;
c->nesting = 0;
c->regs = 0;
c->unwaddr = 0;
c->probe_point = sdp->pp;
c->pi = 0;
c->regparm = 0;
c->marker_name = NULL;
c->marker_format = NULL;
#if INTERRUPTIBLE
c->actionremaining = MAXACTION_INTERRUPTIBLE;
#else
c->actionremaining = MAXACTION;
#endif
#ifdef STP_TIMING
c->statp = 0;
#endif
c->regs = regs;
c->pi = inst;
(*sdp->ph) (c);
#if defined(STP_TIMING) || defined(STP_OVERLOAD)
{
cycles_t cycles_atend = get_cycles ();
int32_t cycles_elapsed = ((int32_t)cycles_atend > (int32_t)cycles_atstart)
? ((int32_t)cycles_atend - (int32_t)cycles_atstart)
: (~(int32_t)0) - (int32_t)cycles_atstart + (int32_t)cycles_atend + 1;
#ifdef STP_TIMING
if (likely (c->statp)) _stp_stat_add(*c->statp, cycles_elapsed);
#endif
#ifdef STP_OVERLOAD
{
cycles_t interval = (cycles_atend > c->cycles_base)
? (cycles_atend - c->cycles_base)
: (STP_OVERLOAD_INTERVAL + 1);
c->cycles_sum += cycles_elapsed;
if (interval > STP_OVERLOAD_INTERVAL) {
if (c->cycles_sum > STP_OVERLOAD_THRESHOLD) {
_stp_error ("probe overhead exceeded threshold");
atomic_set (&session_state, STAP_SESSION_ERROR);
atomic_inc (&error_count);
}
c->cycles_base = cycles_atend;
c->cycles_sum = 0;
}
}
#endif
}
#endif
c->probe_point = 0;
if (unlikely (c->last_error && c->last_error[0])) {
if (c->last_stmt != NULL)
_stp_softerror ("%s near %s", c->last_error, c->last_stmt);
else
_stp_softerror ("%s", c->last_error);
atomic_inc (& error_count);
if (atomic_read (& error_count) > MAXERRORS) {
atomic_set (& session_state, STAP_SESSION_ERROR);
_stp_exit ();
}
}
atomic_dec (&c->busy);
probe_epilogue:
if (unlikely (atomic_read (& skipped_count) > MAXSKIPPED)) {
atomic_set (& session_state, STAP_SESSION_ERROR);
_stp_exit ();
}
#if INTERRUPTIBLE
preempt_enable_no_resched ();
#else
local_irq_restore (flags);
#endif
return 0;
}
static int systemtap_module_init (void) {
int rc = 0;
int i=0, j=0;
const char *probe_point = "";
{
const char* release = UTS_RELEASE;
if (strcmp (release, "2.6.30")) {
_stp_error ("module release mismatch (%s vs %s)", release, "2.6.30");
rc = -EINVAL;
}
if (_stp_module_check()) rc = -EINVAL;
}
if (rc) goto out;
#ifdef STAP_NEED_GETTIMEOFDAY
rc = _stp_init_time();
if (rc) {
_stp_error ("couldn't initialize gettimeofday");
goto out;
}
#endif
(void) probe_point;
(void) i;
(void) j;
atomic_set (&session_state, STAP_SESSION_STARTING);
if (sizeof (struct context) <= 131072)
contexts = alloc_percpu (struct context);
if (contexts == NULL) {
_stp_error ("percpu context (size %lu) allocation failed", sizeof (struct context));
rc = -ENOMEM;
goto out;
}
#ifdef STP_TIMING
time_probe_0 = _stp_stat_init (HIST_NONE);
time_probe_1 = _stp_stat_init (HIST_NONE);
#endif
_stp_print_kernel_info("0.9.8/0.131", (num_online_cpus() * sizeof(struct context)), 2);
for (i=0; i<1; i++) {
struct stap_be_probe* stp = & stap_be_probes [i];
if (stp->type == 0)
enter_be_probe (stp); /* rc = 0 */
}
if (rc) {
_stp_error ("probe %s registration error (rc %d)", probe_point, rc);
atomic_set (&session_state, STAP_SESSION_ERROR);
goto out;
}
for (i=0; i<1; i++) {
struct stap_dwarf_probe *sdp = & stap_dwarf_probes[i];
struct stap_dwarf_kprobe *kp = & stap_dwarf_kprobes[i];
unsigned long relocated_addr = _stp_module_relocate (sdp->module, sdp->section, sdp->address);
if (relocated_addr == 0) continue;
probe_point = sdp->pp;
if (sdp->return_p) {
kp->u.krp.kp.addr = (void *) relocated_addr;
if (sdp->maxactive_p) {
kp->u.krp.maxactive = sdp->maxactive_val;
} else {
kp->u.krp.maxactive = max(10, 4*NR_CPUS);
}
kp->u.krp.handler = &enter_kretprobe_probe;
#ifdef __ia64__
kp->dummy.addr = kp->u.krp.kp.addr;
kp->dummy.pre_handler = NULL;
rc = register_kprobe (& kp->dummy);
if (rc == 0) {
rc = register_kretprobe (& kp->u.krp);
if (rc != 0)
unregister_kprobe (& kp->dummy);
}
#else
rc = register_kretprobe (& kp->u.krp);
#endif
} else {
kp->u.kp.addr = (void *) relocated_addr;
kp->u.kp.pre_handler = &enter_kprobe_probe;
#ifdef __ia64__
kp->dummy.addr = kp->u.kp.addr;
kp->dummy.pre_handler = NULL;
rc = register_kprobe (& kp->dummy);
if (rc == 0) {
rc = register_kprobe (& kp->u.kp);
if (rc != 0)
unregister_kprobe (& kp->dummy);
}
#else
rc = register_kprobe (& kp->u.kp);
#endif
}
if (rc) {
sdp->registered_p = 0;
if (!sdp->optional_p)
_stp_warn ("probe %s registration error (rc %d)", probe_point, rc);
rc = 0;
}
else sdp->registered_p = 1;
}
if (rc) {
_stp_error ("probe %s registration error (rc %d)", probe_point, rc);
atomic_set (&session_state, STAP_SESSION_ERROR);
for (i=0; i<1; i++) {
struct stap_be_probe* stp = & stap_be_probes [i];
if (stp->type == 1)
enter_be_probe (stp);
}
for (i=0; i<1; i++) {
struct stap_be_probe* stp = & stap_be_probes [i];
if (stp->type == 2)
enter_be_probe (stp);
}
goto out;
}
if (atomic_read (&session_state) == STAP_SESSION_STARTING)
atomic_set (&session_state, STAP_SESSION_RUNNING);
return 0;
out:
#ifdef STAPCONF_SYNCHRONIZE_SCHED
synchronize_sched();
#endif
#ifdef STAP_NEED_GETTIMEOFDAY
_stp_kill_time();
#endif
free_percpu (contexts);
return rc;
}
static void systemtap_module_exit (void) {
int holdon;
int i=0, j=0;
(void) i;
(void) j;
if (atomic_read (&session_state) == STAP_SESSION_STARTING)
return;
if (atomic_read (&session_state) == STAP_SESSION_RUNNING)
atomic_set (&session_state, STAP_SESSION_STOPPING);
#if defined(STAPCONF_UNREGISTER_KPROBES)
j = 0;
for (i=0; i<1; i++) {
struct stap_dwarf_probe *sdp = & stap_dwarf_probes[i];
struct stap_dwarf_kprobe *kp = & stap_dwarf_kprobes[i];
if (! sdp->registered_p) continue;
if (!sdp->return_p)
stap_unreg_kprobes[j++] = &kp->u.kp;
}
unregister_kprobes((struct kprobe **)stap_unreg_kprobes, j);
j = 0;
for (i=0; i<1; i++) {
struct stap_dwarf_probe *sdp = & stap_dwarf_probes[i];
struct stap_dwarf_kprobe *kp = & stap_dwarf_kprobes[i];
if (! sdp->registered_p) continue;
if (sdp->return_p)
stap_unreg_kprobes[j++] = &kp->u.krp;
}
unregister_kretprobes((struct kretprobe **)stap_unreg_kprobes, j);
#ifdef __ia64__
j = 0;
for (i=0; i<1; i++) {
struct stap_dwarf_probe *sdp = & stap_dwarf_probes[i];
struct stap_dwarf_kprobe *kp = & stap_dwarf_kprobes[i];
if (! sdp->registered_p) continue;
stap_unreg_kprobes[j++] = &kp->dummy;
}
unregister_kprobes((struct kprobe **)stap_unreg_kprobes, j);
#endif
#endif
for (i=0; i<1; i++) {
struct stap_dwarf_probe *sdp = & stap_dwarf_probes[i];
struct stap_dwarf_kprobe *kp = & stap_dwarf_kprobes[i];
if (! sdp->registered_p) continue;
if (sdp->return_p) {
#if !defined(STAPCONF_UNREGISTER_KPROBES)
unregister_kretprobe (&kp->u.krp);
#endif
atomic_add (kp->u.krp.nmissed, & skipped_count);
#ifdef STP_TIMING
if (kp->u.krp.nmissed)
_stp_warn ("Skipped due to missed kretprobe/1 on '%s': %d\n", sdp->pp, kp->u.krp.nmissed);
#endif
atomic_add (kp->u.krp.kp.nmissed, & skipped_count);
#ifdef STP_TIMING
if (kp->u.krp.kp.nmissed)
_stp_warn ("Skipped due to missed kretprobe/2 on '%s': %d\n", sdp->pp, kp->u.krp.kp.nmissed);
#endif
} else {
#if !defined(STAPCONF_UNREGISTER_KPROBES)
unregister_kprobe (&kp->u.kp);
#endif
atomic_add (kp->u.kp.nmissed, & skipped_count);
#ifdef STP_TIMING
if (kp->u.kp.nmissed)
_stp_warn ("Skipped due to missed kprobe on '%s': %d\n", sdp->pp, kp->u.kp.nmissed);
#endif
}
#if !defined(STAPCONF_UNREGISTER_KPROBES) && defined(__ia64__)
unregister_kprobe (&kp->dummy);
#endif
sdp->registered_p = 0;
}
for (i=0; i<1; i++) {
struct stap_be_probe* stp = & stap_be_probes [i];
if (stp->type == 1)
enter_be_probe (stp);
}
for (i=0; i<1; i++) {
struct stap_be_probe* stp = & stap_be_probes [i];
if (stp->type == 2)
enter_be_probe (stp);
}
#ifdef STAPCONF_SYNCHRONIZE_SCHED
synchronize_sched();
#endif
do {
int i;
holdon = 0;
for (i=0; i < NR_CPUS; i++)
if (cpu_possible (i) && atomic_read (& ((struct context *)per_cpu_ptr(contexts, i))->busy)) holdon = 1;
yield ();
} while (holdon);
#ifdef STAPCONF_SYNCHRONIZE_SCHED
synchronize_sched();
#endif
free_percpu (contexts);
#ifdef STP_TIMING
{
if (likely (time_probe_0)) {
const char *probe_point = "begin";
const char *decl_location = "share/doc/systemtap/examples/network/tcp.stp:5:1";
struct stat_data *stats = _stp_stat_get (time_probe_0, 0);
if (stats->count) {
int64_t avg = _stp_div64 (NULL, stats->sum, stats->count);
_stp_printf ("probe %s (%s), hits: %lld, cycles: %lldmin/%lldavg/%lldmax\n",
probe_point, decl_location, (long long) stats->count, (long long) stats->min, (long long) avg, (long long) stats->max);
}
_stp_stat_del (time_probe_0);
}
if (likely (time_probe_1)) {
const char *probe_point = "tcp.recvmsg";
const char *decl_location = "share/doc/systemtap/examples/network/tcp.stp:11:1";
struct stat_data *stats = _stp_stat_get (time_probe_1, 0);
if (stats->count) {
int64_t avg = _stp_div64 (NULL, stats->sum, stats->count);
_stp_printf ("probe %s (%s), hits: %lld, cycles: %lldmin/%lldavg/%lldmax\n",
probe_point, decl_location, (long long) stats->count, (long long) stats->min, (long long) avg, (long long) stats->max);
}
_stp_stat_del (time_probe_1);
}
_stp_print_flush();
}
#endif
#ifdef STAP_NEED_GETTIMEOFDAY
_stp_kill_time();
#endif
if (atomic_read (& skipped_count) || atomic_read (& error_count) || atomic_read (& skipped_count_reentrant)) {
_stp_warn ("Number of errors: %d, skipped probes: %d\n", (int) atomic_read (& error_count), (int) atomic_read (& skipped_count));
#ifdef STP_TIMING
{
int ctr;
ctr = atomic_read (& skipped_count_lowstack);
if (ctr) _stp_warn ("Skipped due to low stack: %d\n", ctr);
ctr = atomic_read (& skipped_count_reentrant);
if (ctr) _stp_warn ("Skipped due to reentrancy: %d\n", ctr);
ctr = atomic_read (& skipped_count_uprobe_reg);
if (ctr) _stp_warn ("Skipped due to uprobe register failure: %d\n", ctr);
ctr = atomic_read (& skipped_count_uprobe_unreg);
if (ctr) _stp_warn ("Skipped due to uprobe unregister failure: %d\n", ctr);
}
#endif
_stp_print_flush();
}
}
static int probe_start (void) {
return systemtap_module_init () ? -1 : 0;
}
static void probe_exit (void) {
systemtap_module_exit ();
}
#include "stap-symbols.h"
MODULE_DESCRIPTION("systemtap-generated probe");
MODULE_LICENSE("GPL");