[LLVMdev] Unit testing with random input using JIT

Reid Kleckner reid.kleckner at gmail.com
Thu Feb 10 18:56:41 PST 2011


Not sure what you mean here.  If you have a copy of that pointer in
the caller of the wrapper function, you should be able to follow it to
recover the modified value as normal.

Reid

On Thu, Feb 10, 2011 at 9:20 PM, Vu Le <vmle at ucdavis.edu> wrote:
> Hi Reid,
> If an argument is a pointer and the function changes the value it pointed
> to,
> do you know how to get that updated value after executing the wrapper
> function?
>
> Thanks.
> Vu
>
> On Tue, Jan 11, 2011 at 2:40 PM, Reid Kleckner <reid.kleckner at gmail.com>
> wrote:
>>
>> On Tue, Jan 11, 2011 at 1:41 PM, Vu Le <vmle at ucdavis.edu> wrote:
>> > Hi,
>> > I want to implement a tool that probes a function with several input and
>> > records all the return output.
>> > The function might have more than 1 return value (by reference
>> > parameters).
>> >
>> > Does ExecutionEngine::runFunction() support function call with complex
>> > argument type?
>> > If not, I guess that I have to create a wrapper function, prepare all
>> > the
>> > data, and call the original function.
>> > Am I on the right track?
>>
>> For functions with complicated parameters and return values,
>> runFunction will generate a wrapper function that calls the function
>> with the right arguments.  This is fairly expensive and leaks memory
>> if called more than once for the same function.  If the type of the
>> function is known, you can just use getPointerToFunction, cast that,
>> and call it from C.
>>
>> If it's not known but you want to call it many times with different
>> arguments, you could generate a wrapper function responsible for
>> unpacking your own datastructure describing the arguments and calling
>> the function you are testing with those arguments.  Seems like you are
>> on the right track there.
>>
>> Reid
>
>




More information about the llvm-dev mailing list