This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: baby memory map notification


David Smith wrote:
> Frank,
> 
> Here's a stab at baby memory map notification.  It works, with several
> limitations:

I've checked in a new-and-improved version.  This one:

- works on existing threads and new threads (tracking new vms as they
get created and deleted)

- you can use .begin probes (you couldn't do that with the last version)

- even works on 32-bit x86 apps running on 64-bit x86_64 kernel

Limitations:

- because of a utrace bug, it won't work on fedora x86 2.6.25 kernels
(it works fine on fedora x86_64 2.6.25 kernels)

- paths for deleted vma's are currently passed to the callback as NULL

- I haven't tested this against a multi-threaded app yet

- almost all testing has been done on x86_64/f9, so that is where it
will work best

Everything you need should be checked in, but disabled by default.  To
enable, define 'DEBUG_TASK_FINDER_VMA'.  With the attached script, you
can run:

# stap -v -DDEBUG_TASK_FINDER_VMA cat.stp

Then run 'cat /dev/null' in another terminal session.  You'll see output
like this (focus on the lines starting with __stp_tf_vm_cb):

running...
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /bin/cat, start 0x00400000,
end 0x00408000, offset 0x0
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /bin/cat, start 0x00607000,
end 0x00608000, offset 0x7
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /lib64/ld-2.8.so, start
0x3064800000, end 0x306481d000, offset 0x0
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /lib64/ld-2.8.so, start
0x3064a1c000, end 0x3064a1e000, offset 0x1c
*** /bin/cat begin ***
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
mmap(0x0), returned 0x7f707e101000
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
mmap(0x0), returned 0x7f707e100000
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
mmap(0x0), returned 0x7f707e0ef000
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /etc/ld.so.cache, start
0x7f707e0ef000, end 0x7f707e100000, offset 0x0
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
mmap(0x3064c00000), returned 0x3064c00000
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /lib64/libc-2.8.so, start
0x3064c00000, end 0x3064f6c000, offset 0x0
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
mprotect(0x3064d62000), returned 0x0
__stp_utrace_task_finder_target_syscall_exit:807: ** found stored vma
0x3064c00000/0x3064f6c000/0x0!
__stp_tf_vm_cb:47: vm_cb: tsk 15365:0 path <NULL>, start 0x3064c00000,
end 0x3064f6c000, offset 0x0
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /lib64/libc-2.8.so, start
0x3064c00000, end 0x3064d62000, offset 0x0
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /lib64/libc-2.8.so, start
0x3064d62000, end 0x3064f62000, offset 0x162
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /lib64/libc-2.8.so, start
0x3064f62000, end 0x3064f6c000, offset 0x362
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
mmap(0x3064f62000), returned 0x3064f62000
__stp_utrace_task_finder_target_syscall_exit:807: ** found stored vma
0x3064f62000/0x3064f6c000/0x362!
__stp_tf_vm_cb:47: vm_cb: tsk 15365:0 path <NULL>, start 0x3064f62000,
end 0x3064f6c000, offset 0x362
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /lib64/libc-2.8.so, start
0x3064f62000, end 0x3064f67000, offset 0x162
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /lib64/libc-2.8.so, start
0x3064f67000, end 0x3064f6c000, offset 0x367
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
mmap(0x3064f67000), returned 0x3064f67000
__stp_utrace_task_finder_target_syscall_exit:807: ** found stored vma
0x3064f67000/0x3064f6c000/0x367!
__stp_tf_vm_cb:47: vm_cb: tsk 15365:0 path <NULL>, start 0x3064f67000,
end 0x3064f6c000, offset 0x367
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
mmap(0x0), returned 0x7f707e0ee000
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
mmap(0x0), returned 0x7f707e0ed000
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
mprotect(0x3064f62000), returned 0x0
__stp_utrace_task_finder_target_syscall_exit:807: ** found stored vma
0x3064f62000/0x3064f67000/0x162!
__stp_tf_vm_cb:47: vm_cb: tsk 15365:0 path <NULL>, start 0x3064f62000,
end 0x3064f67000, offset 0x162
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /lib64/libc-2.8.so, start
0x3064f62000, end 0x3064f66000, offset 0x162
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /lib64/libc-2.8.so, start
0x3064f66000, end 0x3064f67000, offset 0x166
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
mprotect(0x3064a1c000), returned 0x0
__stp_utrace_task_finder_target_syscall_exit:807: ** found stored vma
0x3064a1c000/0x3064a1e000/0x1c!
__stp_tf_vm_cb:47: vm_cb: tsk 15365:0 path <NULL>, start 0x3064a1c000,
end 0x3064a1e000, offset 0x1c
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /lib64/ld-2.8.so, start
0x3064a1c000, end 0x3064a1d000, offset 0x1c
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path /lib64/ld-2.8.so, start
0x3064a1d000, end 0x3064a1e000, offset 0x1d
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
munmap(0x7f707e0ef000), returned 0x0
__stp_utrace_task_finder_target_syscall_exit:807: ** found stored vma
0x7f707e0ef000/0x7f707e100000/0x0!
__stp_tf_vm_cb:47: vm_cb: tsk 15365:0 path <NULL>, start 0x7f707e0ef000,
end 0x7f707e100000, offset 0x0
__stp_utrace_task_finder_target_syscall_exit:773: tsk 15365 found
mmap(0x0), returned 0x7f707953c000
__stp_tf_vm_cb:47: vm_cb: tsk 15365:1 path
/usr/lib/locale/locale-archive, start 0x7f707953c000, end
0x7f707e0ed000, offset 0x0
*** /bin/cat end ***

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)
probe begin { printf("running...\n") }
probe process("/bin/cat").begin { printf("*** /bin/cat begin ***\n") }
probe process("/bin/cat").end { printf("*** /bin/cat end ***\n") }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]