Subject: Valgrind usability?

From: [email-masked]
Date: Sun, 27 Apr 2003 02:09:48 +0200

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.

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Olivier Chapuis <[email-masked]>
Date: Sun, 27 Apr 2003 08:48:11 +0200

> it is almost impossible to distinguish the real problems from the

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;
 }

---

From: [email-masked]
Date: Sun, 27 Apr 2003 17:53:13 +0200

On Sun, Apr 27, 2003 at 08:48:11AM +0200, Olivier Chapuis wrote:
> version (I get it from valgrind cvs) is better regarding this.

URL?  I can't find the cvs repository.

Bye

Dominik ^_^  ^_^

---

From: Olivier Chapuis <[email-masked]>
Date: Sun, 27 Apr 2003 23:56:01 +0200

> URL?  I can't find the cvs repository.

Valgrind devel site:

https://sourceforge.net/projects/valgrind

for the cvs as usual on sf:

cvs -d:pserver:[email-masked]:/cvsroot/valgrind login 
cvs -z3 -d:pserver:[email-masked]:/cvsroot/valgrind co valgrind

Regards, Olivier