<p></p>
<p>Hi,</p>
<p>a couple of years back I got scope gdb working for remote debugging ( ARM from PC host ).</p>
<p>I was going to do a PR but at that time scope was "depricated" because it had not been updated for python3 and there was no maintainer, so there was not much point.</p>
<p>Gladly scope seems to be still going strong which is great, it's an excellent plugin to have.</p>
<p>I can't remember exactly what version this applied to and probably won't get round to applying this to current scope, so I thought I'd throw the code up here in case it is any help.</p>
<pre><code> --- geany-plugins-0.21.1/debugger/src/dbm_gdb.c.original
+++ geany-plugins-0.21.1/debugger/src/dbm_gdb.c
@@ -96,6 +96,9 @@
/* flag, showing that on debugger stop we have to call a callback */
gboolean requested_interrupt = FALSE;
+
+/* flag: remote debugging session*/
+gboolean remote_session = FALSE;
/* autos list */
static GList *autos = NULL;
@@ -598,6 +601,9 @@
*/
gboolean load(char* file, char* commandline, GList* env, GList *witer)
{
+char *ip;
+char *port;
+
/* loading file */
GString *command = g_string_new("");
g_string_printf(command, "-file-exec-and-symbols %s", file);
@@ -610,11 +616,38 @@
return FALSE;
}
- /* set arguments */
- command = g_string_new("");
- g_string_printf(command, "-exec-arguments %s", commandline);
- exec_sync_command(command->str, TRUE, NULL);
- g_string_free(command, TRUE);
+ /* is it a remote target? */
+ /* (remote sessions handle commandline on debugserver side) */
+ if (commandline[0] == '@') {
+ ip = commandline + 1;
+ port = strchr(ip, ':');
+ if (port != NULL) {
+ *port = '\0';
+ port++;
+ }
+ else {
+ port = (char *)"3278";
+ }
+ if (ip == '\0') {
+ ip = (char *)"127.0.0.1";
+ }
+ if (port == '\0') {
+ port = (char *)"3278";
+ }
+ command = g_string_new("");
+ g_string_printf(command, "target remote %s:%s", ip, port);
+ exec_sync_command(command->str, TRUE, NULL);
+ g_string_free(command, TRUE);
+ remote_session = TRUE;
+ }
+ /* set arguments in non-remote sessions */
+ else {
+ remote_session = FALSE;
+ command = g_string_new("");
+ g_string_printf(command, "-exec-arguments %s", commandline);
+ exec_sync_command(command->str, TRUE, NULL);
+ g_string_free(command, TRUE);
+ }
/* set locale */
command = g_string_new("");
@@ -678,7 +711,14 @@
}
free_start_messages();
- exec_async_command("-exec-run &");
+ if (remote_session) {
+ exec_async_command("break main");
+ sleep(2);
+ exec_async_command("continue");
+ }
+ else {
+ exec_async_command("-exec-run &");
+ }
}
/*
@@ -686,6 +726,9 @@
*/
void restart(char* terminal_device)
{
+ if (remote_session) {
+ dbg_cbs->report_error(_("Restart command not available in remote sessions"));
+ }
dbg_cbs->clear_messages();
exec_async_command("-exec-run &");
}
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany-plugins/issues/1085">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ24PGR3QG2RNIDYBDTTUBTRBANCNFSM47DNWPWQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAIOWJ4PPNEKAUJWXPQKAZ3TUBTRBA5CNFSM47DNWPW2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4N2CNRJA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany-plugins/issues/1085",
"url": "https://github.com/geany/geany-plugins/issues/1085",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>