RFC strace via gdbserver

Stan Cox scox at redhat.com
Wed Jan 11 19:54:24 UTC 2017


This is an example that shows the back and forth interaction that is possible between an strace aware gdbclient and the gdb remote protocol aware strace.

STRACE client
Process 10442 attached in non-stop mode

GDB client
(gdb) continue
Thread 2 "tstthreads1.x" hit Breakpoint 3, thread_worker_2 () at tstthreads1.c:88
88      int unknown_syscall = 123456789;
(gdb)
Thread 3 "tstthreads1.x" hit Breakpoint 2, thread_worker_1 () at tstthreads1.c:53
53      int unknown_syscall = 123456789;

STRACE client
rt_sigprocmask(SIG_UNBLOCK, [USR1], NULL, 8) = 0
mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7ffff6ffa000
brk(NULL)                               = 0x603000
brk(0x624000)                           = 0x624000
brk(NULL)                               = 0x624000
mprotect(0x7ffff6ffa000, 4096, PROT_NONE) = 0
clone( <unfinished ...>
[pid 10455] set_robust_list(0x3d0f00, 140737345724400) = 10455
[pid 10455] mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0 <unfinished ...>
[pid 10442] <... clone resumed> child_stack=0x7ffff77f9ff0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7ffff77fa9d0, tls=0x7ffff77fa700, child_tidptr=0x7ffff77fa9d0) = 140737328943104
[pid 10442] mprotect(0x7ffff67f9000, 4096, PROT_NONE) = 0
[pid 10442] clone(child_stack=0x7ffff6ff8ff0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7ffff6ff99d0, tls=0x7ffff6ff9700, child_tidptr=0x7ffff6ff99d0) = 10456

GDB client
(gdb) thread 2
93      FILE *f = fopen("/tmp/,tstthreads1-2.txt", "w");

STRACE client
[pid 10442] set_robust_list(0x3d0f00, 140737337331696 <unfinished ...>
[pid 10456] mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x7fffee7f9000
[pid 10456] munmap(0x7fffee7f9000, 25194496) = 0
[pid 10456] munmap(0x7ffff4000000, 41914368) = 0
[pid 10456] mprotect(0x7ffff0000000, 135168, PROT_READ|PROT_WRITE) = 0
[pid 10456] open(0x400da5, O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3

GDB client
(gdb) next
94      fprintf(f, "line one");
(gdb) next
95      fclose(f);
(gdb) next

STRACE client
[pid 10456] fstat(3, {st_mode=S_IFREG|0664, st_size=0, ...}) = 0
[pid 10456] write(3, "line one", 8)     = 8
[pid 10456] close(3)                    = 0

GDB client
(gdb) thr 3
66      chroot (".");

STRACE client
[pid 10455] chroot(0x400da3)            = -1 EPERM (Operation not permitted)

GDB client
(gdb) next
68      pipe (fd);
(gdb) next

STRACE client
[pid 10455] pipe([3, 4])                = 0





More information about the Strace-devel mailing list