This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Systemtap Probe C++ new and delete Operator
- From: Andy Librian <andy dot librian at kmklabs dot com>
- To: Felix Lu <flu at redhat dot com>
- Cc: systemtap at sourceware dot org
- Date: Fri, 5 Aug 2016 09:49:14 +0700
- Subject: Re: Systemtap Probe C++ new and delete Operator
- Authentication-results: sourceware.org; auth=none
- References: <CANBzSrFBABpL=4=mdVXCNkCP+VS5KVcP3P=jpLVszoC0i_aaWQ@mail.gmail.com> <695587317.51124887.1470325368087.JavaMail.zimbra@redhat.com>
Awesome,
It works great. Thank you.
Andy Librian.
KMK Online.
On Thu, Aug 4, 2016 at 10:42 PM, Felix Lu <flu@redhat.com> wrote:
>
> ----- Original Message -----
>> From: "Andy Librian" <andy.librian@kmklabs.com>
>> To: systemtap@sourceware.org
>> Sent: Wednesday, 3 August, 2016 11:05:33 PM
>> Subject: Systemtap Probe C++ new and delete Operator
>>
>> Hi,
>>
>> I'm curious if Systemtap can probe C++ new and delete operator. Maybe like:
>
> This can be done like this if you have dwarf debugging info installed:
>
> test.cpp:
> int main(int argc, char** argv) {
> int* x = new int[256];
> int* y = new int;
> delete[] x;
> int* z = new int;
> delete y;
> return 0;
> }
>
> $ g++ test.cpp
> $ stap -e 'probe process("a.out").library("libstdc++.so.6").{function("operator new"), function("operator delete")} {println(ppfunc())}'
> operator new
> operator new
> operator delete
> operator new
> operator delete
>
> You can take a look at man stapprobes for more information.
>
>>
>> probe process(PATH).function("__1c2n6FI_pv_") {
>> }
>>
>> I'm trying to find the source of memory leak using this approach:
>>
>> https://blogs.oracle.com/openomics/entry/investigating_memory_leaks_with_dtrace
>>
>>
>> Regards,
>>
>> Andy Librian.
>> KMK Online.
>>
>
> - Felix