Date: | Mon, 18 Jul 2016 15:50:44 +0200 |
---|---|
From: | Martijn <martijn@xxxxxxxxxxxxxxxxx> |
Subject: | [DynInst_API:] Problems in instrumenting malloc |
Hello, I am looking at the DynInst API to instrument applications to detect memory errors. Very impressed with the platform independence of the API thus far.Studying the maxarg.C tutorial code on http://www.paradyn.org/tutorial/ with DynInst 9.2.0 on Ubuntu 16.04 Desktop and gcc 5.3.1, I encounter two issues, the second blocking me: 1) The maxarg tutorial tries to add a snippet to malloc() in libc.so. It tries to find the malloc function in the module with substring "libc" using findModule(). As I understand the API, this will find the module of libc.so.6, but malloc() may well be implemented in a separate source file, and hence another module name. I corrected the example by first obtaining the libc.so.6 BPatch_object, and then using findFunction on the object, which walks over all modules in the libc.so.6. A findObject() convenience function on the BPatch_image would be nice here. 2) Still, the example cannot find the function malloc() in the libc object. obj->findFunction("malloc") works on all modules in the libc object, but fails to find malloc. It does work for free(), returning "__GI___libc_free" as the function name in /lib/x86_64-linux-gnu/libc-2.23.so. malloc seems to be present in libc: ÂÂ 443: 0000000000083550ÂÂ 414 FUNCÂÂÂ GLOBAL DEFAULTÂÂ 13 __libc_malloc@@GLIBC_2.2.5 And my test program explicitly calls malloc: $ nm -g test1/test |grep malloc Any ideas what I do wrong here to try to find and instrument malloc()? I hope you can help me further. Thanks, Martijn martijn@xxxxxxxxxxxxxxxxx |
[← Prev in Thread] | Current Thread | [Next in Thread→] |
---|---|---|
|
Previous by Date: | [DynInst_API:] [dyninst/dyninst] 16fce8: Adding support for aes instruction set extension, John Detter |
---|---|
Next by Date: | Re: [DynInst_API:] Problems in instrumenting malloc, John Detter |
Previous by Thread: | Re: [DynInst_API:] PIE segfault, Mohamed Elsabagh |
Next by Thread: | Re: [DynInst_API:] Problems in instrumenting malloc, John Detter |
Indexes: | [Date] [Thread] |