[cfe-dev] 'recording' program execution w/clang

Edward Peschko horos11 at gmail.com
Tue Nov 4 12:59:00 PST 2008


Eli,

I've looked at gdb (in fact that's what made me write the wrapper in
the first place, dbx's support for this) - the problem with it is that
it is exceedingly slow - tracing, for example, a perl executable
running a small perl script in the way i'm talking about takes a
couple of days using the scripting support inside of gdb.

Anyways, chronomancer looks very interesting; I'd love to have the
ability to do reverse tracepoints in C - namely giving a string to the
program to watch for, and seeing which variables are set to a value
with that substring in it, and when they are set to this value.. this
is another great way to debug - one that I already have in perl, would
be even better in C.

Ed


On Tue, Nov 4, 2008 at 12:44 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Tue, Nov 4, 2008 at 9:38 AM, Edward Peschko <horos11 at gmail.com> wrote:
>> Chris,
>>
>> I want to be able to record two versions of the same program and then
>> do a diff to see in the code where the execution path changes..
>>
>> For example, say you want to see in mutt what the 'd' key does in the
>> gui, ie: what parts of the source does it execute.. To do so, record
>> two sessions, one where you press the d key, and one where you don't.
>> Do a 'vimdiff' between the two, and you have your answer - without
>> needing to know the structure of the code at all.
>>
>> Hence, I'd need actual code, because ultimately I want to use this
>> with an IDE to trace it back to the original source (and set further
>> debug points, etc.)
>
> I'm not completely sure about everything you're trying to do, but it
> seems like you have a lot of options depending on the result you're
> looking for.
>
> The source-to-source rewriter should be able to safely duplicate what
> you've been doing in Perl; it's designed precisely for making global
> transformations like this on source code.
>
> At the LLVM IL level, you should also be able to create a similar kind
> of trace by doing transformations based on debug info; it might be a
> bit tricky to write, though.
>
> There might be a much simpler, approach, though: I'm pretty sure you
> can script GDB to create a similar trace for a program with debug
> info.
>
> Also, http://code.google.com/p/chronomancer/ might be of interest.
>
> -Eli
>



More information about the cfe-dev mailing list