[gnome-builder/wip/chergert/bug1: 81/101] gdb: try to follow mi2 closer
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/bug1: 81/101] gdb: try to follow mi2 closer
- Date: Sat, 2 Sep 2017 01:37:11 +0000 (UTC)
commit 47672a71b42e7b694a6342e5947ea464c282c333
Author: Christian Hergert <chergert redhat com>
Date: Thu Aug 31 00:00:08 2017 -0700
gdb: try to follow mi2 closer
source+line or source+function, otherwise we need to use address for now.
plugins/gdb/gbp-gdb-debugger.c | 33 +++++++++++++++++++++++++++------
1 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/plugins/gdb/gbp-gdb-debugger.c b/plugins/gdb/gbp-gdb-debugger.c
index 1cfe655..60f4c82 100644
--- a/plugins/gdb/gbp-gdb-debugger.c
+++ b/plugins/gdb/gbp-gdb-debugger.c
@@ -1088,6 +1088,7 @@ gbp_gdb_debugger_insert_breakpoint_async (IdeDebugger *debugger,
GbpGdbDebugger *self = (GbpGdbDebugger *)debugger;
g_autoptr(GString) command = NULL;
g_autoptr(GTask) task = NULL;
+ IdeDebuggerAddress addr;
const gchar *func;
const gchar *file;
const gchar *spec;
@@ -1108,14 +1109,34 @@ gbp_gdb_debugger_insert_breakpoint_async (IdeDebugger *debugger,
if (ide_debugger_breakpoint_get_enabled (breakpoint))
g_string_append (command, " -d");
- if (NULL != (func = ide_debugger_breakpoint_get_function (breakpoint)))
- g_string_append_printf (command, " --function %s", func);
- if (NULL != (file = ide_debugger_breakpoint_get_file (breakpoint)))
- g_string_append_printf (command, " --source %s", file);
+ file = ide_debugger_breakpoint_get_file (breakpoint);
+ func = ide_debugger_breakpoint_get_function (breakpoint);
+ line = ide_debugger_breakpoint_get_line (breakpoint);
+ addr = ide_debugger_breakpoint_get_address (breakpoint);
- if (0 != (line = ide_debugger_breakpoint_get_line (breakpoint)))
- g_string_append_printf (command, " --line %u", line);
+ if (file != NULL && line > 0)
+ {
+ g_string_append_printf (command, " --source %s", file);
+ g_string_append_printf (command, " --line %u", line);
+ }
+ else if (file != NULL && func != NULL)
+ {
+ g_string_append_printf (command, " --source %s", file);
+ g_string_append_printf (command, " --function %s", func);
+ }
+ else if (addr != 0)
+ {
+ g_string_append_printf (command, " *0x%"G_GINT64_MODIFIER"x", addr);
+ }
+ else
+ {
+ g_task_return_new_error (task,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "Failed to create breakpoint based on request");
+ return;
+ }
if (0 != (thread = ide_debugger_breakpoint_get_thread (breakpoint)))
g_string_append_printf (command, " -p %s", thread);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]