Search code examples
linuxdebuggingreverse-engineeringstrace

How to make strace print addresses of string arguments instead of just their values?


I'm trying to use strace to understand how a binary program uses memory.

However, the default output of strace, in an attempt to be more user friendly, prints any char * buffers as the respective strings.

read(3, "Tell me, Muse, of that man of ma"..., 4096) = 270

Is there any way to tell strace to print the actual address of the string next to its contents?

If it's not possible to have both, printing only the address of the string instead of its truncated contents would also be ok.


Solution

  • You could download the source of strace and modify all these tprintf("%s", ...) to tprintf("%p", ...), and build a local copy of strace.