anjuta r3784 - in trunk: . libanjuta/interfaces plugins/debug-manager plugins/gdb
- From: sgranjoux svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r3784 - in trunk: . libanjuta/interfaces plugins/debug-manager plugins/gdb
- Date: Mon, 17 Mar 2008 21:49:09 +0000 (GMT)
Author: sgranjoux
Date: Mon Mar 17 21:49:09 2008
New Revision: 3784
URL: http://svn.gnome.org/viewvc/anjuta?rev=3784&view=rev
Log:
* plugins/debug-manager/registers.c:
Avoid a crash when debugger stop on an error
* plugins/debug-manager/start.c,
plugins/gdb/debugger.c,
libanjuta/interfaces/libanjuta.idl:
Display an error message when debugger target is not found
Modified:
trunk/ChangeLog
trunk/libanjuta/interfaces/libanjuta.idl
trunk/plugins/debug-manager/registers.c
trunk/plugins/debug-manager/start.c
trunk/plugins/gdb/debugger.c
Modified: trunk/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- trunk/libanjuta/interfaces/libanjuta.idl (original)
+++ trunk/libanjuta/interfaces/libanjuta.idl Mon Mar 17 21:49:09 2008
@@ -2912,6 +2912,7 @@
UNSUPPORTED_VERSION,
UNABLE_TO_FIND_DEBUGGER,
ALREADY_DONE,
+ PROGRAM_NOT_FOUND,
UNKNOWN_ERROR,
OTHER_ERROR
}
Modified: trunk/plugins/debug-manager/registers.c
==============================================================================
--- trunk/plugins/debug-manager/registers.c (original)
+++ trunk/plugins/debug-manager/registers.c Mon Mar 17 21:49:09 2008
@@ -128,7 +128,13 @@
return;
}
-
+
+ if (self->current == NULL)
+ {
+ /* Program has exited */
+ return;
+ }
+
/* Get first item in list view */
valid = gtk_tree_model_get_iter_first (self->current->model, &iter);
list = GTK_LIST_STORE (self->current->model);
@@ -246,7 +252,7 @@
GError *err = NULL;
self->current = regs;
-
+
/* List is empty, ask debugger to get all register name */
dma_queue_list_register (
self->debugger,
@@ -291,11 +297,12 @@
static void
dma_thread_clear_all_register_list (CpuRegisters *self)
{
+ self->current = NULL;
+
/* Clear all GtkListStore */
g_list_foreach (self->list, (GFunc)on_clear_register_list, NULL);
g_list_free (self->list);
- self->current = NULL;
self->list = NULL;
}
Modified: trunk/plugins/debug-manager/start.c
==============================================================================
--- trunk/plugins/debug-manager/start.c (original)
+++ trunk/plugins/debug-manager/start.c Mon Mar 17 21:49:09 2008
@@ -847,7 +847,7 @@
gtk_dialog_response (GTK_DIALOG (user_data), ANJUTA_RESPONSE_SELECT_TARGET);
}
-static void
+static gboolean
dma_start_load_uri (DmaStart *this)
{
GList *search_dirs;
@@ -855,29 +855,38 @@
gchar *mime_type;
gchar *filename;
- if (!dma_quit_debugger (this)) return;
+ if (!dma_quit_debugger (this)) return FALSE;
- if ((this->target_uri != NULL) && (*(this->target_uri) != '\0'))
+ if ((this->target_uri == NULL) || (*(this->target_uri) == '\0'))
{
- vfs_uri = gnome_vfs_uri_new (this->target_uri);
-
- g_return_if_fail (vfs_uri != NULL);
+ /* Missing URI */
+ return FALSE;
+ }
+ vfs_uri = gnome_vfs_uri_new (this->target_uri);
- if (!gnome_vfs_uri_is_local (vfs_uri)) return;
+ g_return_if_fail (vfs_uri != NULL);
+
+ if (!gnome_vfs_uri_is_local (vfs_uri)) return FALSE;
- search_dirs = get_source_directories (this->plugin);
+ search_dirs = get_source_directories (this->plugin);
- mime_type = gnome_vfs_get_mime_type (this->target_uri);
- filename = gnome_vfs_get_local_path_from_uri (this->target_uri);
+ mime_type = gnome_vfs_get_mime_type (this->target_uri);
+ if (mime_type == NULL)
+ {
+ anjuta_util_dialog_error(GTK_WINDOW (this->plugin->shell),
+ _("Unable to open %s. Debugger cannot start."), this->target_uri);
+ return FALSE;
+ }
+ filename = gnome_vfs_get_local_path_from_uri (this->target_uri);
- dma_queue_load (this->debugger, filename, mime_type, this->source_dirs);
+ 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);
+ g_free (filename);
+ g_free (mime_type);
+ gnome_vfs_uri_unref (vfs_uri);
+ free_source_directories (search_dirs);
- }
+ return TRUE;
}
static gboolean
@@ -1304,13 +1313,13 @@
gboolean
dma_run_target (DmaStart *this)
{
- if (dma_set_parameters (this) == TRUE)
- {
- dma_start_load_uri (this);
- dma_queue_start (this->debugger, this->program_args == NULL ? "" : this->program_args, this->run_in_terminal, this->stop_at_beginning);
- }
+ if (!dma_set_parameters (this)) return FALSE;
+
+ if (!dma_start_load_uri (this)) return FALSE;
+
+ dma_queue_start (this->debugger, this->program_args == NULL ? "" : this->program_args, this->run_in_terminal, this->stop_at_beginning);
- return this->target_uri != NULL;
+ return TRUE;
}
gboolean
@@ -1318,7 +1327,8 @@
{
if (this->target_uri == NULL) return FALSE;
- dma_start_load_uri (this);
+ if (!dma_start_load_uri (this)) return FALSE;
+
dma_queue_start (this->debugger, this->program_args == NULL ? "" : this->program_args, this->run_in_terminal, this->stop_at_beginning);
return TRUE;
Modified: trunk/plugins/gdb/debugger.c
==============================================================================
--- trunk/plugins/gdb/debugger.c (original)
+++ trunk/plugins/gdb/debugger.c Mon Mar 17 21:49:09 2008
@@ -202,6 +202,8 @@
IANJUTA_DEBUGGER_UNABLE_TO_ACCESS_MEMORY},
{"No source file named ",
IANJUTA_DEBUGGER_UNABLE_TO_OPEN_FILE},
+ {"No executable file specified.",
+ IANJUTA_DEBUGGER_PROGRAM_NOT_FOUND},
{NULL, 0}};
static guint
@@ -213,12 +215,6 @@
{
gsize len = strlen (msg->msg);
- if (!isspace (msg->msg[len - 1]))
- {
- /* Match the whole string */
- len++;
- }
-
if (memcmp (msg->msg, message, len) == 0)
{
return msg->code;
@@ -1459,6 +1455,14 @@
error = gdb_parse_error (debugger, val);
+ /* Trap state error */
+ if ((error != NULL) && (error->code == IANJUTA_DEBUGGER_PROGRAM_NOT_FOUND))
+ {
+ debugger->priv->prog_is_running = FALSE;
+ debugger->priv->prog_is_attached = FALSE;
+ debugger->priv->prog_is_loaded = FALSE;
+ }
+
if (debugger->priv->current_cmd.parser != NULL)
{
debugger->priv->current_cmd.parser (debugger, val, debugger->priv->cli_lines, error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]