On Sun, Apr 27, 2003 at 02:09:48AM +0200, [EMAIL PROTECTED] wrote:
> Olivier, how did get Valgrind to produce any usable output?  When
> I run it (after compiling with -O), it swaps me in "uninitialised
> memory" messages all over the place when they are clearly wrong,
> e.g. in the flag structures and the new exec_context_t structures,
> even when both were initialised with memset or safecalloc.  For me
> it is almost impossible to distinguish the real problems from the
> junk reports.
>

Yes, I've noted problems with UM too. It seems that the latest valgrind
version (I get it from valgrind cvs) is better regarding this. Valgrind
is not perfect but it seems to me that it is the best free "mem debugger"
software.

An other pb is using valgrind with modules. Attached a 1min patch that
allows to "valgrind" all the modules you start. With recent version
of valgrind some options can be added so that the out files are named
FvwmButtons.pid, FvwmTaskBar.pid, ...etc.

Also, I think that FVWM has not so many memories bugs (vs the
situation at 2.3 feature freeze time). I think we was very careful
about this during 2.5.x development.

Regards, Olivier
--- fvwm/module_interface.c     2003-04-23 16:34:19.000000000 +0200
+++ fvwm/module_interface.c.valgrind    2003-04-23 16:19:24.000000000 +0200
@@ -313,21 +313,36 @@
 
        pipeName[i] = stripcpy(cptr);
        free(cptr);
+
+       nargs = 0;
+/*#define PRE_COMMAND 1*/
+#ifdef PRE_COMMAND
+       char *pre_cmd = "env LD_LIBRARY_PATH=/usr/X11R6/lib valgrind -v 
--leak-check=yes";
+       int pre_nargs = 0;
+       for (nargs = 0; pre_cmd = GetNextToken(pre_cmd, &token), token; nargs++)
+       {
+               args = (char **)saferealloc(
+                       (void *)args, (7 + nargs + 2) * sizeof(char *));
+               args[nargs] = token;
+       }
+       pre_nargs = nargs;
+#endif
        sprintf(arg2, "%d", app_to_fvwm[1]);
        sprintf(arg3, "%d", fvwm_to_app[0]);
        sprintf(arg5, "%lx", (unsigned long)win);
        sprintf(arg6, "%lx", (unsigned long)exc->w.wcontext);
-       args[0] = arg1;
-       args[1] = arg2;
-       args[2] = arg3;
-       args[3] = (char *)get_current_read_file();
-       if (!args[3])
-       {
-               args[3] = "none";
-       }
-       args[4] = arg5;
-       args[5] = arg6;
-       for (nargs = 6; action = GetNextToken(action, &token), token; nargs++)
+       args[nargs++] = arg1;
+       args[nargs++] = arg2;
+       args[nargs++] = arg3;
+       args[nargs] = (char *)get_current_read_file();
+       if (!args[nargs])
+       {
+               args[nargs] = "none";
+       }
+       nargs++;
+       args[nargs++] = arg5;
+       args[nargs++] = arg6;
+       for (; action = GetNextToken(action, &token), token; nargs++)
        {
                args = (char **)saferealloc(
                        (void *)args, (nargs + 2) * sizeof(char *));
@@ -391,7 +406,11 @@
                                ERR, "executeModule",
                                "module close-on-exec failed");
                }
-               for (i = 6; i < nargs; i++)
+#ifdef PRE_COMMAND
+               for (i = 6+pre_nargs; i < nargs; i++)
+#else
+               for (i = 6; i < nargs; i++)     
+#endif
                {
                        if (args[i] != 0)
                        {
@@ -422,6 +441,9 @@
 
                /* Why is this execvp??  We've already searched the module
                 * path! */
+#ifdef PRE_COMMAND
+               arg1 = args[0];
+#endif
                execvp(arg1,args);
                fvwm_msg(
                        ERR, "executeModule", "Execution of module failed: %s",
@@ -856,6 +878,7 @@
        {
                free(alias);
        }
+
        return;
 }
 

Reply via email to