|
From: Filipe C. <fi...@gm...> - 2009-05-04 15:48:53
Attachments:
valgrind-darwin-envp.patch
apple.c
|
Hi, As you may know, in Darwin, the main() function receives a fourth argument: int main(int argc, char **argv, char **envp, char **apple); the fourth argument is a pointer to a string that contains the executable path (which can't be changed using exec(), like argv[0]). Valgrind, while launching a darwin application, would copy it, as it should, but then overwrite it while augmenting the environment (and lose it while deleting environment variables, in vg_preload.c). This patch keeps track of that string until the program starts executing. If you start a program and then unsetenv(something), then you may have two NULL pointers between the last env variable and the "apple" array. Attached is a patch and a test which fails in the current trunk. I can convert it to a *.vgtest, but I hesitated as I didn't know where to put it (there's no none/tests/darwin... should I create it?) Regards, Filipe |
|
From: Nicholas N. <n.n...@gm...> - 2009-05-04 23:45:55
|
On Tue, May 5, 2009 at 1:48 AM, Filipe Cabecinhas <fi...@gm...> wrote: > Hi, > > As you may know, in Darwin, the main() function receives a fourth argument: > int main(int argc, char **argv, char **envp, char **apple); I didn't! Weird. Thanks for the patch, I've committed it. I created a none/tests/darwin/ directory as you suggested to hold the test program. Nick |