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: Systemtap Probe C++ new and delete Operator


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


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