anjuta r3556 - in trunk: . plugins/debug-manager



Author: sgranjoux
Date: Thu Jan 31 20:49:05 2008
New Revision: 3556
URL: http://svn.gnome.org/viewvc/anjuta?rev=3556&view=rev

Log:
	* plugins/debug-manager/threads.c,
	plugins/debug-manager/stack_trace.c:
	Avoid crash when getting relative path from debugger (same fix
	than for #510028)

	* plugins/debug-manager/queue.c:
	Emit all state changes notification

	* plugins/debug-manager/start.c:
	Fix #511586: Project path with "+" not working in debugger


Modified:
   trunk/ChangeLog
   trunk/plugins/debug-manager/queue.c
   trunk/plugins/debug-manager/stack_trace.c
   trunk/plugins/debug-manager/start.c
   trunk/plugins/debug-manager/threads.c

Modified: trunk/plugins/debug-manager/queue.c
==============================================================================
--- trunk/plugins/debug-manager/queue.c	(original)
+++ trunk/plugins/debug-manager/queue.c	Thu Jan 31 20:49:05 2008
@@ -158,7 +158,7 @@
 }
 		
 static void
-dma_queue_emit_debugger_state (DmaDebuggerQueue *self, IAnjutaDebuggerState state, GError* err)
+dma_queue_emit_debugger_state_change (DmaDebuggerQueue *self, IAnjutaDebuggerState state, GError* err)
 {
 	enum
 	{
@@ -172,102 +172,46 @@
 		PROGRAM_RUNNING_SIGNAL,
 		PROGRAM_STOPPED_SIGNAL
 	} signal = NO_SIGNAL;
-	gboolean emit_program_started = FALSE;
 	
-	DEBUG_PRINT("update debugger state new %d old %d", state, self->debugger_state);
+	DEBUG_PRINT("change debugger state new %d old %d", state, self->debugger_state);
 
-	/* Add missing state if useful */
 	switch (state)
 	{
+	case IANJUTA_DEBUGGER_BUSY:
+		/* Debugger is busy, nothing to do */
+		g_return_if_reached();
+		return;
 	case IANJUTA_DEBUGGER_STOPPED:
-		if ((self->debugger_state == IANJUTA_DEBUGGER_PROGRAM_RUNNING) ||
-			(self->debugger_state == IANJUTA_DEBUGGER_PROGRAM_STOPPED))
-		{
-			dma_queue_emit_debugger_state (self, IANJUTA_DEBUGGER_PROGRAM_LOADED, NULL);
-		}
-		else if	(self->debugger_state == IANJUTA_DEBUGGER_PROGRAM_LOADED)
-		{
-			dma_queue_emit_debugger_state (self, IANJUTA_DEBUGGER_STARTED, NULL);
-		}
+		self->stop_on_sharedlib = FALSE;
+		signal = DEBUGGER_STOPPED_SIGNAL;
+		self->debugger_state = state;
 		break;
 	case IANJUTA_DEBUGGER_STARTED:
-		if ((self->debugger_state == IANJUTA_DEBUGGER_PROGRAM_RUNNING) ||
-			(self->debugger_state == IANJUTA_DEBUGGER_PROGRAM_STOPPED))
-		{
-			dma_queue_emit_debugger_state (self, IANJUTA_DEBUGGER_PROGRAM_LOADED, NULL);
-		}
+		self->stop_on_sharedlib = FALSE;
+		signal = self->debugger_state < IANJUTA_DEBUGGER_STARTED ? DEBUGGER_STARTED_SIGNAL : PROGRAM_UNLOADED_SIGNAL;			
+		self->debugger_state = state;
 		break;
 	case IANJUTA_DEBUGGER_PROGRAM_LOADED:
-		if (self->debugger_state == IANJUTA_DEBUGGER_STOPPED)
-		{
-			dma_queue_emit_debugger_state (self, IANJUTA_DEBUGGER_STARTED, NULL);
-		}
+		self->stop_on_sharedlib = FALSE;
+		signal = self->debugger_state < IANJUTA_DEBUGGER_PROGRAM_LOADED ? PROGRAM_LOADED_SIGNAL : PROGRAM_EXITED_SIGNAL;			
+		self->debugger_state = state;
 		break;
 	case IANJUTA_DEBUGGER_PROGRAM_STOPPED:
-		if (self->debugger_state == IANJUTA_DEBUGGER_STOPPED)
+		if (!self->stop_on_sharedlib)
 		{
-			dma_queue_emit_debugger_state (self, IANJUTA_DEBUGGER_STARTED, NULL);
+			signal = PROGRAM_STOPPED_SIGNAL;			
 		}
-		else if (self->debugger_state == IANJUTA_DEBUGGER_STARTED)
+		else if (self->debugger_state < IANJUTA_DEBUGGER_PROGRAM_STOPPED)
 		{
-			dma_queue_emit_debugger_state (self, IANJUTA_DEBUGGER_PROGRAM_LOADED, NULL);
+			signal = PROGRAM_STARTED_SIGNAL;
 		}
+		self->debugger_state = state;
 		break;
 	case IANJUTA_DEBUGGER_PROGRAM_RUNNING:
-		if (self->debugger_state == IANJUTA_DEBUGGER_STOPPED)
-		{
-			dma_queue_emit_debugger_state (self, IANJUTA_DEBUGGER_STARTED, NULL);
-		}
-		else if (self->debugger_state == IANJUTA_DEBUGGER_STARTED)
-		{
-			dma_queue_emit_debugger_state (self, IANJUTA_DEBUGGER_PROGRAM_LOADED, NULL);
-		}
-		break;
-	case IANJUTA_DEBUGGER_BUSY:
+		self->stop_on_sharedlib = FALSE;
+		signal = PROGRAM_RUNNING_SIGNAL;			
+		self->debugger_state = state;
 		break;
-	}	
-
-	if (self->debugger_state != state)
-	{
-		switch (state)
-		{
-		case IANJUTA_DEBUGGER_BUSY:
-			/* Debugger is busy, nothing to do */
-			return;
-		case IANJUTA_DEBUGGER_STOPPED:
-			self->stop_on_sharedlib = FALSE;
-			signal = DEBUGGER_STOPPED_SIGNAL;
-			self->debugger_state = state;
-			break;
-		case IANJUTA_DEBUGGER_STARTED:
-			self->stop_on_sharedlib = FALSE;
-			signal = self->debugger_state < IANJUTA_DEBUGGER_STARTED ? DEBUGGER_STARTED_SIGNAL : PROGRAM_UNLOADED_SIGNAL;			
-			self->debugger_state = state;
-			break;
-		case IANJUTA_DEBUGGER_PROGRAM_LOADED:
-			self->stop_on_sharedlib = FALSE;
-			signal = self->debugger_state < IANJUTA_DEBUGGER_PROGRAM_LOADED ? PROGRAM_LOADED_SIGNAL : PROGRAM_EXITED_SIGNAL;			
-			self->debugger_state = state;
-			break;
-		case IANJUTA_DEBUGGER_PROGRAM_STOPPED:
-			if (!self->stop_on_sharedlib)
-			{
-				emit_program_started = self->debugger_state < IANJUTA_DEBUGGER_PROGRAM_STOPPED;
-				signal = PROGRAM_STOPPED_SIGNAL;			
-			}
-			else if (self->debugger_state < IANJUTA_DEBUGGER_PROGRAM_STOPPED)
-			{
-				signal = PROGRAM_STARTED_SIGNAL;
-			}
-			self->debugger_state = state;
-			break;
-		case IANJUTA_DEBUGGER_PROGRAM_RUNNING:
-			emit_program_started = self->debugger_state < IANJUTA_DEBUGGER_PROGRAM_STOPPED;
-			self->stop_on_sharedlib = FALSE;
-			signal = PROGRAM_RUNNING_SIGNAL;			
-			self->debugger_state = state;
-			break;
-		}
 	}
 
 	self->prepend_command++;
@@ -302,21 +246,10 @@
 		g_signal_emit_by_name (self->plugin, "program-exited");
 		break;
 	case PROGRAM_STOPPED_SIGNAL:
-		DEBUG_PRINT("** emit program-exited **");
-		if (emit_program_started)
-		{	
-			DEBUG_PRINT("** emit program-started **");
-			g_signal_emit_by_name (self->plugin, "program-started");
-		}
 		DEBUG_PRINT("** emit program-stopped **");
 		g_signal_emit_by_name (self->plugin, "program-stopped");
 		break;
 	case PROGRAM_RUNNING_SIGNAL:
-		if (emit_program_started)
-		{	
-			DEBUG_PRINT("** emit program-started **");
-			g_signal_emit_by_name (self->plugin, "program-started");
-		}
 		DEBUG_PRINT("** emit program-running **");
 		g_signal_emit_by_name (self->plugin, "program-running");
 		break;
@@ -325,6 +258,69 @@
 }
 
 static void
+dma_queue_emit_debugger_state (DmaDebuggerQueue *self, IAnjutaDebuggerState state, GError* err)
+{
+	DEBUG_PRINT("update debugger state new %d old %d", state, self->debugger_state);
+
+	/* Add missing states if useful */
+	for(;self->debugger_state != state;)
+	{
+		IAnjutaDebuggerState next_state = state;
+		
+		switch (state)
+		{
+		case IANJUTA_DEBUGGER_STOPPED:
+			if ((self->debugger_state == IANJUTA_DEBUGGER_PROGRAM_RUNNING) ||
+				(self->debugger_state == IANJUTA_DEBUGGER_PROGRAM_STOPPED))
+			{
+				next_state = IANJUTA_DEBUGGER_PROGRAM_LOADED;
+			}
+			else if	(self->debugger_state == IANJUTA_DEBUGGER_PROGRAM_LOADED)
+			{
+				next_state = IANJUTA_DEBUGGER_STARTED;
+			}
+			break;
+		case IANJUTA_DEBUGGER_STARTED:
+			if ((self->debugger_state == IANJUTA_DEBUGGER_PROGRAM_RUNNING) ||
+				(self->debugger_state == IANJUTA_DEBUGGER_PROGRAM_STOPPED))
+			{
+				next_state = IANJUTA_DEBUGGER_PROGRAM_LOADED;
+			}
+			break;
+		case IANJUTA_DEBUGGER_PROGRAM_LOADED:
+			if (self->debugger_state == IANJUTA_DEBUGGER_STOPPED)
+			{
+				next_state = IANJUTA_DEBUGGER_STARTED;
+			}
+			break;
+		case IANJUTA_DEBUGGER_PROGRAM_STOPPED:
+			if (self->debugger_state == IANJUTA_DEBUGGER_STOPPED)
+			{
+				next_state = IANJUTA_DEBUGGER_STARTED;
+			}
+			else if (self->debugger_state == IANJUTA_DEBUGGER_STARTED)
+			{
+				next_state = IANJUTA_DEBUGGER_PROGRAM_LOADED;
+			}
+			break;
+		case IANJUTA_DEBUGGER_PROGRAM_RUNNING:
+			if (self->debugger_state == IANJUTA_DEBUGGER_STOPPED)
+			{
+				next_state = IANJUTA_DEBUGGER_STARTED;
+			}
+			else if (self->debugger_state == IANJUTA_DEBUGGER_STARTED)
+			{
+				next_state = IANJUTA_DEBUGGER_PROGRAM_LOADED;
+			}
+			break;
+		case IANJUTA_DEBUGGER_BUSY:
+			return;
+		}
+		dma_queue_emit_debugger_state_change (self, next_state, NULL);
+	}
+}
+
+static void
 dma_queue_emit_debugger_ready (DmaDebuggerQueue *self)
 {
 	gboolean busy;

Modified: trunk/plugins/debug-manager/stack_trace.c
==============================================================================
--- trunk/plugins/debug-manager/stack_trace.c	(original)
+++ trunk/plugins/debug-manager/stack_trace.c	Thu Jan 31 20:49:05 2008
@@ -293,7 +293,7 @@
 			if (g_path_is_absolute (frame->file))
 			{					
 				uri = gnome_vfs_get_uri_from_local_path(frame->file);
-				file = strrchr(uri, '/') + 1;
+				file = strrchr(frame->file, G_DIR_SEPARATOR) + 1;
 			}
 			else
 			{

Modified: trunk/plugins/debug-manager/start.c
==============================================================================
--- trunk/plugins/debug-manager/start.c	(original)
+++ trunk/plugins/debug-manager/start.c	Thu Jan 31 20:49:05 2008
@@ -853,8 +853,7 @@
 	GList *search_dirs;
 	GnomeVFSURI *vfs_uri;
 	gchar *mime_type;
-	const gchar *filename;
-	// GList *node;
+	gchar *filename;
 
 	if (!dma_quit_debugger (this)) return;
 	
@@ -869,10 +868,11 @@
 		search_dirs = get_source_directories (this->plugin);
 		
 		mime_type = gnome_vfs_get_mime_type (this->target_uri);
-	        filename = gnome_vfs_uri_get_path (vfs_uri);
+	    filename = gnome_vfs_get_local_path_from_uri (this->target_uri);
 
 		dma_queue_load (this->debugger, filename, mime_type, this->source_dirs);
 		
+		g_free (filename);
 		g_free (mime_type);
 		gnome_vfs_uri_unref (vfs_uri);
 		free_source_directories (search_dirs);

Modified: trunk/plugins/debug-manager/threads.c
==============================================================================
--- trunk/plugins/debug-manager/threads.c	(original)
+++ trunk/plugins/debug-manager/threads.c	Thu Jan 31 20:49:05 2008
@@ -221,8 +221,16 @@
 	
 	if (frame->file)
 	{
-		uri = gnome_vfs_get_uri_from_local_path(frame->file);
-		file = strrchr(uri, '/') + 1;
+		if (g_path_is_absolute (frame->file))
+		{					
+			uri = gnome_vfs_get_uri_from_local_path(frame->file);
+			file = strrchr(frame->file, G_DIR_SEPARATOR) + 1;
+		}
+		else
+		{
+			uri = NULL;
+			file = frame->file;
+		}
 	}
 	else	
 	{
@@ -315,8 +323,16 @@
 			adr = g_strdup_printf ("0x%lx", frame->address);
 			if (frame->file)
 			{
-				uri = gnome_vfs_get_uri_from_local_path(frame->file);
-				file = strrchr(uri, '/') + 1;
+				if (g_path_is_absolute (frame->file))
+				{					
+					uri = gnome_vfs_get_uri_from_local_path(frame->file);
+					file = strrchr(frame->file, G_DIR_SEPARATOR) + 1;
+				}
+				else
+				{
+					uri = NULL;
+					file = frame->file;
+				}
 			}
 			else	
 			{



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