Tidy up order of includes; make bool variables explicit.
Bool variables are more compact in data and (on x86) on code too:
text data bss dec hex filename
237950 676 19044 257670 3ee86 strace.before
237838 676 19012 257526 3edf6 strace
* defs.h: Group library includes at the top of the file.
Rename dtime to Tflag, debug to debug_flag.
Change debug_flag,Tflag,qflag,not_failing_only,show_fd_path,tracing_paths
variable declarations from int to bool.
* strace.c: Change corresponding definitions. Do the same for static
variables iflag,rflag,print_pid_pfx.
Rename dtime to Tflag, debug to debug_flag.
* syscall.c: Rename dtime to Tflag, debug to debug_flag.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/syscall.c b/syscall.c
index d1c8992..2b6d677 100644
--- a/syscall.c
+++ b/syscall.c
@@ -970,7 +970,7 @@
scno = r2;
if (!SCNO_IN_RANGE(scno)) {
if (a3 == 0 || a3 == -1) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, "stray syscall exit: v0 = %ld\n", scno);
return 0;
}
@@ -983,7 +983,7 @@
if (!SCNO_IN_RANGE(scno)) {
if (a3 == 0 || a3 == -1) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, "stray syscall exit: v0 = %ld\n", scno);
return 0;
}
@@ -1000,7 +1000,7 @@
*/
if (!SCNO_IN_RANGE(scno)) {
if (a3 == 0 || a3 == -1) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, "stray syscall exit: r0 = %ld\n", scno);
return 0;
}
@@ -1081,7 +1081,7 @@
glibc to issue bogus negative syscall numbers. So for
our purposes, make strace print what it *should* have been */
long correct_scno = (scno & 0xff);
- if (debug)
+ if (debug_flag)
fprintf(stderr,
"Detected glibc bug: bogus system call"
" number = %ld, correcting to %ld\n",
@@ -1131,7 +1131,7 @@
/* A common case of "not a syscall entry" is post-execve SIGTRAP */
#if defined(I386)
if (i386_regs.eax != -ENOSYS) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, "not a syscall entry (eax = %ld)\n", i386_regs.eax);
return 0;
}
@@ -1141,7 +1141,7 @@
if (current_personality == 1)
rax = (int)rax; /* sign extend from 32 bits */
if (rax != -ENOSYS) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, "not a syscall entry (rax = %ld)\n", rax);
return 0;
}
@@ -1156,7 +1156,7 @@
if (syscall_mode != -ENOSYS)
syscall_mode = tcp->scno;
if (gpr2 != syscall_mode) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, "not a syscall entry (gpr2 = %ld)\n", gpr2);
return 0;
}
@@ -1165,7 +1165,7 @@
if (upeek(tcp, 4*PT_D0, &d0) < 0)
return -1;
if (d0 != -ENOSYS) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, "not a syscall entry (d0 = %ld)\n", d0);
return 0;
}
@@ -1175,7 +1175,7 @@
if (upeek(tcp, PT_R8, &r8) < 0)
return -1;
if (ia32 && r8 != -ENOSYS) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, "not a syscall entry (r8 = %ld)\n", r8);
return 0;
}
@@ -1183,7 +1183,7 @@
if (upeek(tcp, 4*PT_R10, &r10) < 0)
return -1;
if (r10 != -ENOSYS) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, "not a syscall entry (r10 = %ld)\n", r10);
return 0;
}
@@ -1191,7 +1191,7 @@
if (upeek(tcp, 3 * 4, &r3) < 0)
return -1;
if (r3 != -ENOSYS) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, "not a syscall entry (r3 = %ld)\n", r3);
return 0;
}
@@ -1522,7 +1522,7 @@
ret:
tcp->flags |= TCB_INSYSCALL;
/* Measure the entrance time as late as possible to avoid errors. */
- if (dtime || cflag)
+ if (Tflag || cflag)
gettimeofday(&tcp->etime, NULL);
return res;
}
@@ -1890,7 +1890,7 @@
long u_error;
/* Measure the exit time as early as possible to avoid errors. */
- if (dtime || cflag)
+ if (Tflag || cflag)
gettimeofday(&tv, NULL);
#if SUPPORTED_PERSONALITIES > 1
@@ -2088,7 +2088,7 @@
if ((sys_res & RVAL_STR) && tcp->auxstr)
tprintf(" (%s)", tcp->auxstr);
}
- if (dtime) {
+ if (Tflag) {
tv_sub(&tv, &tv, &tcp->etime);
tprintf(" <%ld.%06ld>",
(long) tv.tv_sec, (long) tv.tv_usec);