Re: Regarding use of Lackey to trace midway execution of a program

Eliot Moss <[email protected]> Wed, 8 Feb 2023 17:47:14 +1100
Newsgroups gmane.comp.debugging.valgrind
Message-ID <[email protected]>
On 2/8/2023 4:10 PM, SAI GOVARDHAN M C PES1UG19EC255PESU ECE Student wrote:
> Hi,
> 
> We are students working on memory access analysis, using the Lackey tool in Valgrind.
> Our memory trace results in a large log file, and we need the trace from discrete points of 
> execution (between 40-60%).
> Instead of logging completely, and splitting manually, is there a way we can modify the Lackey 
> command to pick from a desired point in the execution?
> 
> For reference, the command we use is
> $ valgrind --tool=lackey --trace-mem=yes --log-file=/path_to_log ./program
> 
> We need to modify this to command to trace from 40-60% of the program

If you know the approximate number of memory accesses, you could do something
as simple as:

valgrind ... | tail +n XXX | head -n YYY

to start after XXX lines of output and stop after producing YYY lines.  You
could do something more sophisticated using, say, gawk, to trigger on a
particular address being accessed, e.g., as an instruction fetch.

This will all slow things down a bit, but might accomplish your goals.

I'm not claiming there isn't some sophisticated way to tell valgrind when
to start tracing, either.  Also, nobody is stopping you from customizing
the tool yourself :-) ... a mere exercise in programming, no?

Best wishes - EM