Hi Dan,

We are always looking for contributors and contributions ;)

A good starting point for KLEE development is: 
https://klee.github.io/docs/developers-guide/

>From a technical perspective, it is not trivial but not too hard either.
The main function you are interested in is `Executor::executeCall`: 
https://github.com/klee/klee/blob/b926b3d49d7650ba76c81f4dfe0fd9aad44150d2/lib/Core/Executor.cpp#L1679
Familiarise yourself with it to get an idea how it works.

In a nutshell for your project:
* Handle the `Setjmp` function call
        - resolve the buffer argument to a valid memory object
        - save the current ExectionState::prevPc into that buffer
        - save the current stack depth into this buffer
        - set the target value to `0`
* Handle the `Longjmp` function call:
        - resolve the buffer argument to a valid memory object
        - preserve the longmp value
        - load `prevPC`
        - load the targeted stack depth
        - unroll the stack by using the stack depth
        - set the PC to the loaded prevPC
        - set the result of the `Setjmp` argument to the longjmp argument value 
        

Those are all quite some steps but all this functionality should happen inside 
of this single function mentioned above.

I hope those will get you started.
Let us know, if anything is unclear.

All the best,
Martin



> On 3. Jun 2023, at 18:26, Dan Hoffman <[email protected]> wrote:
> 
> I'm looking to apply KLEE to a program that heavily uses co-routines.
> These syscalls aren't implemented, so I'm investigating whether a
> patch can be written/upstreamed. This is my first patch for KLEE (but
> I have written patches for other large open-source projects). A few
> questions:
>  1. Are there any hard/technical reasons why this is
> impossible/impractical? Threading is impractical because the
> scheduling is another set of variables, but co-routines have
> deterministic scheduling by definition, so that shouldn't be an issue.
>  2. What are some good small/beginner issues to familiarize myself
> with the code and patch submission process? I'm somewhat familiar with
> LLVM internals from previous projects/my job.
> 
> Thanks!
> 
> _______________________________________________
> klee-dev mailing list
> [email protected]
> https://mailman.ic.ac.uk/mailman/listinfo/klee-dev


_______________________________________________
klee-dev mailing list
[email protected]
https://mailman.ic.ac.uk/mailman/listinfo/klee-dev

Reply via email to