Hello,

I am looking at the DynInst API to instrument applications to detect memory
errors.

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:

   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 object, and then using findFunction on the object, which
   walks over all modules in the libc.so.6. Clearly, I am missing a
   findObject() function on the BPatch_image to do this.
   2. More severe, on Unbuntu 16.04 gcc 5.3.1, libc.so.6 does not define
   malloc(). The only definition is (weakly defined) in ld-2.23.so, which
   is a dependency of libc.so.6, but not of the test binary. Even if I
   explicitly link the test binary against ld-2.23.so, this library is not
   available in the list of objects on the image. So the maxargs example
   cannot find malloc() to instrument. Note that when opening the test binary
   statically (i.e., not via createProcess()), the ld-2.23.so dependency is
   included in the list of objects on the image. Could you enlighten me on
   what I am missing here? E.g., am I missing an event handler for a dynamic
   loading of ld-2.23.so?

I hope you can help me further, as I am impressed with the platform
independence that DynInst offers. Thanks,

  Martijn


---------

Martijn Rutten

[email protected]

+31638237286
_______________________________________________
Dyninst-api mailing list
[email protected]
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api

Reply via email to