From 3d373d8b5c101e0798ea8a5e8015aa03537d02d8 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Sun, 22 Jul 2018 23:12:49 +0100 Subject: POSIX: Add invocation of klee_init_env into wrapper before calling main To enable the POSIX support, the former implementation instrumented the main function and inserted a call to `klee_init_env` at the beginning. This has multiple disadvantages: * debugging information was not correctly propagated leaving the call to `klee_init_env` without debug information * the main function always required `int arg, char**` as part of the function definition of `main` Based on the new linking infrastructure, we can now add an additional wrapper `__klee_posix_wraper(int, char**)` that gets always called when POSIX support is enabled. It executes `klee_init_env` and after that calls the `main` function. Enabling POSIX support only requires the renaming of the user provided `main` into `__klee_posix_wrapped_main` in addition to linking. --- tools/klee-replay/klee_init_env.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/klee-replay') diff --git a/tools/klee-replay/klee_init_env.c b/tools/klee-replay/klee_init_env.c index 229fe43d..5e9dd06c 100644 --- a/tools/klee-replay/klee_init_env.c +++ b/tools/klee-replay/klee_init_env.c @@ -1 +1,3 @@ #include "../../runtime/POSIX/klee_init_env.c" + +int __klee_posix_wrapped_main(int argc, char **argv) { return 0; } -- cgit 1.4.1