Skip to content

Loading…

Debugger #66

Merged
merged 3 commits into from

3 participants

@cesspit
Geany member
  1. removed odd main loop attach call
  2. added new thread group creation message format, that was unhandled previously and caused crash on newer versions of gdb
@frlan frlan was assigned
@b4n
Geany member

33521c8 should be squashed in 24175c1. Otherwise looks good.

@cesspit
Geany member

33521c8 fixes a bug brought in 24175c1, so it's all fine there

@b4n
Geany member

Yes it's ok, I just wanted to suggest that there might be no need for a commit fixing something as trivial just after introducing the issue. But it's fine with 2 commits if you like of course, that's definitely not a blocker.

@frlan ACK & GTG for me then.

@frlan frlan merged commit 13a6056 into geany:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 8 additions and 4 deletions.
  1. +8 −4 debugger/src/dbm_gdb.c
View
12 debugger/src/dbm_gdb.c
@@ -88,7 +88,7 @@ static GPid gdb_pid = 0;
static GPid target_pid = 0;
/* GSource to watch GDB exit */
-static GSource *gdb_src;
+static guint gdb_src_id;
/* channels for GDB input/output */
static gint gdb_in;
@@ -192,7 +192,7 @@ static void on_gdb_exit(GPid pid, gint status, gpointer data)
g_list_free(files);
files = NULL;
- g_source_destroy(gdb_src);
+ g_source_remove(gdb_src_id);
dbg_cbs->set_exited(0);
}
@@ -443,6 +443,11 @@ static gboolean on_read_from_gdb(GIOChannel * src, GIOCondition cond, gpointer d
*(strrchr(line, '\"')) = '\0';
target_pid = atoi(line + strlen("=thread-group-created,id=\""));
}
+ else if (!target_pid && g_str_has_prefix(line, "=thread-group-started"))
+ {
+ *(strrchr(line, '\"')) = '\0';
+ target_pid = atoi(strrchr(line, '\"') + 1);
+ }
else if (g_str_has_prefix(line, "=thread-created"))
{
int thread_id;
@@ -739,8 +744,7 @@ static gboolean run(const gchar* file, const gchar* commandline, GList* env, GLi
setpgid(gdb_pid, 0);
/* set handler for gdb process exit event */
- g_child_watch_add(gdb_pid, on_gdb_exit, NULL);
- gdb_src = g_child_watch_source_new(gdb_pid);
+ gdb_src_id = g_child_watch_add(gdb_pid, on_gdb_exit, NULL);
/* create GDB GIO chanels */
gdb_ch_in = g_io_channel_unix_new(gdb_in);
Something went wrong with that request. Please try again.