|
From: Paul M. <pmi...@he...> - 2004-08-07 21:15:21
Attachments:
mega.c
|
hi. i notice that valgrind does not interact well with swapcontext; this is hinted at in the "limitation" section of the documentation wrt programs that switch stacks. in particular, i see alot of invalid read complaints when returning to a swapcontext, which propagate furiously. the invalid reads correspond to addresses inside the second argument to swapcontext, before the second context is activated. i tried using VALGRIND_MAKE_READABLE to manually mark the context as readable right before swapcontext, to no avail. it takes swapcontext()-ing between two malloc'd stacks to cause the problem, and -v output confirms that valgrind does not detect the stack switch in this case (i.e., the %esp heuristic fails). is there a workaround? for instance, i was wondering if an ldpreload trick similar to that used for libpthread could be applied to ucontext.h facilities in order to instruct the virtual machine about whats happening in such a way as to prevent these errors. if so, does any guru have some pointers about where i would look in the valgrind documentation or source to get started? thanks, -- p p.z. attached is a small program which elicits the problem. |