changeset 42:7b0f34fbc35a

Fix inappropriate activation of profiling support, and add environment variable DEBUG_WRAPPER to show before and after arguments, rather than commenting out the code when it's not needed.
author Rob Landley <rob@landley.net>
date Sun, 17 Dec 2006 14:19:51 -0500
parents 3baa8ab7ee6d
children 6d16887ec084
files sources/toys/gcc-uClibc.c
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/sources/toys/gcc-uClibc.c	Sat Dec 16 20:20:00 2006 -0500
+++ b/sources/toys/gcc-uClibc.c	Sun Dec 17 14:19:51 2006 -0500
@@ -88,6 +88,7 @@
 	char *dlstr, *incstr, *devprefix, *libstr, *build_dlstr = 0;
 	char *cc, *ep, *rpath_link[2], *rpath[2], *uClibc_inc[2], *our_lib_path[2];
 	char *crt0_path[2], *crtbegin_path[2], *crtend_path[2];
+	char *debug_wrapper=getenv("DEBUG_WRAPPER");
 
 	// For C++
 
@@ -98,9 +99,11 @@
 	int profile = 0;
 	char *gcrt1_path[2];
 
-//dprintf(2,"incoming: ");
-//for(gcc_argv=argv;*gcc_argv;gcc_argv++) dprintf(2,"%s ",*gcc_argv);
-//dprintf(2,"\n\n");
+	if(debug_wrapper) {
+		dprintf(2,"incoming: ");
+		for(gcc_argv=argv;*gcc_argv;gcc_argv++) dprintf(2,"%s ",*gcc_argv);
+		dprintf(2,"\n\n");
+	}
 
 	// Allocate space for new command line
 	gcc_argv = __builtin_alloca(sizeof(char*) * (argc + 128));
@@ -322,7 +325,7 @@
 						exit(0);
 
 					// Profiling.
-					} else if (!strcmp("-pg",argv[i]) == 0) profile = 1;
+					} else if (!strcmp("-pg",argv[i])) profile = 1;
 					break;
 
 				case 'f':
@@ -502,11 +505,13 @@
 		fflush(stdout);
 	}
 
+	if (debug_wrapper) {
+		dprintf(2, "outgoing: ");
+		for(i=0; gcc_argv[i]; i++) dprintf(2, "%s ",gcc_argv[i]);
+		dprintf(2, "\n\n");
+	}
+
 	//no need to free memory from xstrcat because we never return... 
-//dprintf(2, "outgoing: ");
-//for(i=0; gcc_argv[i]; i++) dprintf(2, "%s ",gcc_argv[i]);
-//dprintf(2, "\n\n");
-
 	execvp(gcc_argv[0], gcc_argv);
 	fprintf(stderr, "%s: %s\n", cpp ? cpp : cc, strerror(errno));
 	exit(EXIT_FAILURE);