Michael Hope wrote:
I'd like to record the running of a typical program such as Firefox, GCC, or ffmpeg and capture the calls and arguments to functions like strcpy() and memcpy(). The idea is to generate a usage profile so we can tell what standard library functions and what variants (i.e. aligned/unaligned, small copy/large copy) to attack first.
Micheal, There is a 2006 GCC Summit paper "Low-Level Performance Analysis", written by Steven Munroe and Peter Steinmetz. They introduced how do they improve the performance of some methods, like memcmp() on POWER processor. This paper is similar to what we are doing, and hope it is useful.
Does anyone know of existing research with this information, or existing tools that could capture it?
Looks like you need a Binary Instrumentation tool for method tracing. Pin[1]/Valgrind[2] are good DBI platforms, and not hard to write a plugin/extension to them for our needs. However, I am not sure Pin is well-supported on ARM, and I also concern about overhead of valgrind for performance profiling.
My fallback is to use a LD_PRELOAD trick to replace the interesting functions with tracing versions.
Yeah, LD_PRELOAD is not bad if we can't find any other tools to do method tracing.
[1] Pin Tool. http://www.pintool.org/ [2] Valgrind. valgrind.org