ORBit2 r2057 - in trunk: . src/orb/GIOP src/orb/orb-core



Author: michael
Date: Wed May  7 11:07:37 2008
New Revision: 2057
URL: http://svn.gnome.org/viewvc/ORBit2?rev=2057&view=rev

Log:
2008-05-07  Michael Meeks  <michael meeks novell com>

        * src/orb/orb-core/orbit-trace.c (ORBit_trace_value):
        slow down, but substantially improve string printing in
        debugging, and add ORBIT2_DEBUG_STRMAX for long strings.

        * src/orb/GIOP/giop.c (giop_thread_free): armour against
        double thingits; and NULL the giop_main_thread as we free
        it: from nasty problems having shut-down the 'main' thread
        in yast, and started doing calls from another non-main thread.



Modified:
   trunk/ChangeLog
   trunk/src/orb/GIOP/giop.c
   trunk/src/orb/orb-core/corba-orb.c
   trunk/src/orb/orb-core/orbit-trace.c

Modified: trunk/src/orb/GIOP/giop.c
==============================================================================
--- trunk/src/orb/GIOP/giop.c	(original)
+++ trunk/src/orb/GIOP/giop.c	Wed May  7 11:07:37 2008
@@ -325,6 +325,9 @@
 giop_thread_free (GIOPThread *tdata)
 {
 	GList *l;
+
+    if (tdata == giop_main_thread)
+        giop_main_thread = NULL;
 	
 	if (giop_thread_safe ()) {
 		g_mutex_lock (giop_pool_hash_lock);
@@ -335,17 +338,23 @@
 	}
 	
 	g_list_free (tdata->keys);
+    tdata->keys = NULL;
 	
 	g_mutex_free (tdata->lock);
+    tdata->lock = NULL;
 	g_cond_free (tdata->incoming);
+    tdata->incoming = NULL;
+
 #ifdef G_ENABLE_DEBUG
 	if (tdata->async_ents)
 		g_warning ("Leaked async ents");
 	if (tdata->request_queue)
 		g_warning ("Leaked request queue");
 #endif
-	if (tdata->invoke_policies)
+	if (tdata->invoke_policies) {
 		g_queue_free (tdata->invoke_policies);
+        tdata->invoke_policies = NULL;
+    }
 	
 	g_free (tdata);
 }

Modified: trunk/src/orb/orb-core/corba-orb.c
==============================================================================
--- trunk/src/orb/orb-core/corba-orb.c	(original)
+++ trunk/src/orb/orb-core/corba-orb.c	Wed May  7 11:07:37 2008
@@ -62,6 +62,7 @@
 static GSList      *orbit_initref_list       = NULL; 
 static gboolean     orbit_use_corbaloc       = FALSE;
 static guint        orbit_timeout_msec       = 60000; /* 60 seconds - 0 will disable timeouts altogether */
+
 void
 ORBit_ORB_start_servers (CORBA_ORB orb)
 {

Modified: trunk/src/orb/orb-core/orbit-trace.c
==============================================================================
--- trunk/src/orb/orb-core/orbit-trace.c	(original)
+++ trunk/src/orb/orb-core/orbit-trace.c	Wed May  7 11:07:37 2008
@@ -6,6 +6,7 @@
 #include <sys/time.h>
 #include <ctype.h>
 #include <orbit/orbit.h>
+#include <stdlib.h>
 
 #include "orb-core-private.h"
 #include "orbit-debug.h"
@@ -150,27 +151,32 @@
 		if (v == NULL)
 			tprintf("(null)");
 		else {
-			const int max = 64;
+            static int max = -1;
 			const char * v = (*(const char **)*val);
-			char *p, *str = g_strndup (v, max);
+            GString *str;
 			int len = strlen (v);
 
-			if (len > max) {
-				const char ins[5] = " ... ";
-				int i;
-
-				for (i = 0; i < max / 2; ++i)
-					str[i + max / 2] = v[len - max / 2 + i];
-				strncpy(str + (max - sizeof(ins)) / 2, ins, sizeof(ins));
-			}
-
-			for (p = str; p && *p; p++)
-				if (!isascii ((int)*p))
-					*p = '#';
-			
-			tprintf ("'%s'", str);
+            if (max < 0) {
+                max = 64;
+                if (g_getenv ("ORBIT2_DEBUG_STRMAX"))
+                    max = atoi (g_getenv ("ORBIT2_DEBUG_STRMAX"));
+            }
+            str = g_string_sized_new (max + 8);
+            for (i = 0; i < MIN (max, len); i++) {
+                if (g_ascii_isprint (v[i]) && v[i] != '#')
+                    g_string_append_c (str, v[i]);
+                else {
+                    g_string_append_c (str, '#');
+                    g_string_append_printf (str, "0x%2x", v[i]);
+                    g_string_append_c (str, '#');
+                }
+            }
+			if (len > max)
+                g_string_append (str, " ...");
+
+			tprintf ("'%s'", str->str);
 			
-			g_free (str);
+			g_string_free (str, TRUE);
 		}
 		break;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]