[PATCH] Add -e trace=memory option

Dmitry V. Levin ldv at altlinux.org
Sun Oct 21 19:25:58 UTC 2012


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.

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

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

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.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20121021/e44e50c1/attachment.bin>


More information about the Strace-devel mailing list