Added switch for printing only succeeding syscalls.

This commit is contained in:
Michal Ludvig 2002-11-06 13:17:21 +00:00
parent eb818f0af6
commit 17f8fb3484
4 changed files with 23 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2002-11-06 Michal Ludvig <mludvig@suse.cz>
From Marty Leisner <leisner@rochester.rr.com>,
rewritten my mludvig:
* strace.c (not_failing_only): New.
(usage): Added -z switch description.
(main): Added -z switch parsing to not_failing_only variable.
* syscall.c (trace_syscall): Added not_failing_only handling.
2002-10-08 Heiko Carstens <heiko.carstens@de.ibm.com>
Missing complete changelog for 2002-10-07 commit:

2
defs.h
View File

@ -553,3 +553,5 @@ do { \
#ifdef IA64
extern long ia32;
#endif
extern int not_failing_only;

View File

@ -67,6 +67,9 @@ int rflag = 0, tflag = 0, dtime = 0, cflag = 0;
int iflag = 0, xflag = 0, qflag = 0;
int pflag_seen = 0;
/* Sometimes we want to print only succeeding syscalls. */
int not_failing_only = 0;
char *username = NULL;
uid_t run_uid;
gid_t run_gid;
@ -154,6 +157,7 @@ usage: strace [-dffhiqrtttTvVxx] [-a column] [-e expr] ... [-o file]\n\
-s strsize -- limit length of print strings to STRSIZE chars (default %d)\n\
-S sortby -- sort syscall counts by: time, calls, name, nothing (default %s)\n\
-u username -- run command as username handling setuid and/or setgid\n\
-z -- print only succeeding syscalls\n\
", DEFAULT_ACOLUMN, DEFAULT_STRLEN, DEFAULT_SORTBY);
exit(exitval);
}
@ -190,7 +194,7 @@ char *argv[];
set_sortby(DEFAULT_SORTBY);
set_personality(DEFAULT_PERSONALITY);
while ((c = getopt(argc, argv,
"+cdfFhiqrtTvVxa:e:o:O:p:s:S:u:")) != EOF) {
"+cdfFhiqrtTvVxza:e:o:O:p:s:S:u:")) != EOF) {
switch (c) {
case 'c':
cflag++;
@ -234,6 +238,9 @@ char *argv[];
printf("%s\n", version);
exit(0);
break;
case 'z':
not_failing_only = 1;
break;
case 'a':
acolumn = atoi(optarg);
break;

View File

@ -1742,8 +1742,11 @@ struct tcb *tcp;
if (tcp->scno >= nsyscalls || tcp->scno < 0
|| (qual_flags[tcp->scno] & QUAL_RAW))
sys_res = printargs(tcp);
else
else {
if (not_failing_only && tcp->u_error)
return; /* ignore failed syscalls */
sys_res = (*sysent[tcp->scno].sys_func)(tcp);
}
u_error = tcp->u_error;
tprintf(") ");
tabto(acolumn);