I'm writing a program to trace every system call called by child process and determine the exact memory use of it(excluding sharing memory).
here's my plan.
let child process ptraced by father process,
if child process make system calls, father process will recieve SIGTRAP,
then get syscall id with ptrace(PTRACE_PEEKUSER, child_pid, 4*ORIG_EAX, NULL).
when the id equals to SYS_brk, SYS_sbrk, SYS_mmap2, SYS_mmap, SYS_mremap, SYS_munmap ,
i am able to get parameters of the call and calculate the amount of memory use.
but it troubles me that
I'm not sure how to calculate.
SYS_mmap2 has over 6 parameters, how should I get it?