[PATCH] Add -e trace=memory option

Namhyung Kim namhyung.kim at lge.com
Tue Oct 23 09:01:16 UTC 2012


2012-10-22 오전 4:25, Dmitry V. Levin 쓴 글:
> On Fri, Oct 19, 2012 at 10:01:09AM +0900, Namhyung Kim wrote:
>> Add a new 'memory' category for tracing memory related syscalls.
>
> Most of syscalls are memory related because they take an address argument,
> so I would rather call this subset as memory mapping related.
>
>> Affected syscalls are: brk, mmap, munmap, mprotect, msync, mlock,
>> munlock, mlockall, munlockall, mremap, mincore, madvise, mbind,
>> {get,set}_mempolicy, migrate_pages, move_pages, vmsplice and
>> remap_file_pages.
>
> vmsplice is not a memory mapping related.  I see it was not actually
> changed by the patch.

It was my mistake of missing a comma.  So do you want to get rid of it?

>
> I was able to reproduce the syscallent part of the patch with the
> following command:
>
> $ sed -ri '/brk|get_mempolicy|madvise|mbind|migrate_pages|mincore|mlock|mlockall|mmap|move_pages|mprotect|mremap|msync|munlock|munlockall|munmap|remap_file_pages|set_mempolicy/ {s/^([^,]+,[[:space:]]*[NT][^,]+),/\1|TM,/; s/^([^,]+,[[:space:]]*)0,/\1TM,/}' linux/*/syscallent.h

Looks better. :)

>
> The short flag name (TM) defined in syscall.c has to be undefined the same way
> as other short flag names.

Okay, will fix it.

>
> Besides this, the patch looks OK.
>
>> * defs.h: Define TRACE_MEMORY macro.
>> * syscall.c (lookup_class): Handle "memory" option.
>> * linux/alpha/syscallent.h: Add TM marker.
>
> This is not a marker, it's a flag like TD or TF.
> Something like "Add TM flag to memory mapping related syscalls" would do.
>
>> * strace.1: Add description to man page.
>
> Please make it less vague, e.g.
> * syscall.c (lookup_class): Handle trace=memory option.
> * strace.1: Document it.

I will send v2 with fixes that you commented.

Thanks,
Namhyung




More information about the Strace-devel mailing list