Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Mon, 08 Feb 2016 21:38:07 UTC Commit: 44c8d36ca97ef76b9a991c3775fc431297b20542 https://github.com/geany/geany-plugins/commit/44c8d36ca97ef76b9a991c3775fc43...
Log Message: ----------- debugger: Add debugger module-level support for switching threads
Modified Paths: -------------- debugger/src/dbm_gdb.c debugger/src/debug_module.h
Modified: debugger/src/dbm_gdb.c 28 lines changed, 28 insertions(+), 0 deletions(-) =================================================================== @@ -1073,6 +1073,34 @@ static void set_active_frame(int frame_number) g_free(command); }
+static int get_active_thread(void) +{ + struct gdb_mi_record *record = NULL; + int current_thread = 0; + + if (RC_DONE == exec_sync_command("-thread-info", TRUE, &record)) + { + const gchar *id = gdb_mi_result_var(record->first, "current-thread-id", GDB_MI_VAL_STRING); + current_thread = id ? atoi(id) : 0; + } + gdb_mi_record_free(record); + + return current_thread; +} + +static gboolean set_active_thread(int thread_id) +{ + gchar *command = g_strdup_printf("-thread-select %i", thread_id); + gboolean success = (RC_DONE == exec_sync_command(command, TRUE, NULL)); + + if (success) + set_active_frame(0); + + g_free(command); + + return success; +} + /* * gets stack */
Modified: debugger/src/debug_module.h 7 lines changed, 6 insertions(+), 1 deletions(-) =================================================================== @@ -121,7 +121,10 @@ typedef struct _dbg_module {
void (*set_active_frame)(int frame_number); int (*get_active_frame)(void); - + + gboolean (*set_active_thread)(int thread_id); + int (*get_active_thread)(void); + GList* (*get_autos) (void); GList* (*get_watches) (void); @@ -155,6 +158,8 @@ typedef struct _dbg_module { get_stack, \ set_active_frame, \ get_active_frame, \ + set_active_thread, \ + get_active_thread, \ get_autos, \ get_watches, \ get_files, \
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).