|
From: Philippe W. <phi...@sk...> - 2008-02-13 18:31:11
|
(cfr my previous mails about gdbserver protocol). Currently, I am working on doing this because it is fun. I understood from the doc that it is not ok to call libc or any system call directly in valgrind core, because this causes various subtile problems. Are these problems reasonable enough that a "quick and dirty" prototype could use libc ? (so, typically; directly call strlen or directly call a "read" or "write" system call) (if afterwards, the idea of gdbserver in valgrind is seen as interesting enough to integrate it properly in valgrind, then of course all these calls will have to be replaced by the VG_(...) Thanks |
|
From: Bart V. A. <bar...@gm...> - 2008-02-13 18:46:12
|
On Feb 13, 2008 7:31 PM, Philippe Waroquiers <phi...@sk...> wrote: > Currently, I am working on doing this because it is fun. > I understood from the doc that it is not ok to call libc or any system call > directly in valgrind core, because this > causes various subtile problems. > > Are these problems reasonable enough that a "quick and dirty" prototype > could use libc ? > (so, typically; directly call strlen or directly call a "read" or "write" > system call) As far as I understand the Valgrind core, you risk introducing all kinds of subtle issues when you try to link the Valgrind core with libc. In case you need a simple function from glibc, you can copy its implementation and link it with the Valgrind core. I'm afraid that this won't work for setjmp() and longjmp() however. But did you already have a look at the macro SCHEDSETJMP() in coregrind/m_scheduler/scheduler.c ? Bart. |
|
From: Julian S. <js...@ac...> - 2008-02-13 20:51:12
|
> As far as I understand the Valgrind core, you risk introducing all > kinds of subtle issues when you try to link the Valgrind core with > libc. Yes. Don't use libc. > In case you need a simple function from glibc, you can copy its > implementation and link it with the Valgrind core. Check first that the function does not already exist in include/pub_tool_libc*.h and coregrind/pub_core_libc*.h. > I'm afraid that > this won't work for setjmp() and longjmp() however. But did you > already have a look at the macro SCHEDSETJMP() in > coregrind/m_scheduler/scheduler.c ? Yes - just use the gcc builtins, __builtin_setmp and __builtin_lonpjmp. That works fine. J |