Pass the whole commandline.
[gdbmicli.git] / libmigdb / src / connect.c
index 9d61e57..e9f26b7 100644 (file)
@@ -31,6 +31,7 @@ in a row.
 #include <signal.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+#include <assert.h>
 #include "mi_gdb.h"
 
 #ifndef TEMP_FAILURE_RETRY
@@ -362,6 +363,9 @@ similar to a "FILE *" for stdio.
   
 ***************************************************************************/
 
+char **mi_gdb_argv;
+void (*mi_gdb_start_hook) (mi_h *h);
+
 mi_h *mi_connect_local()
 {
  mi_h *h;
@@ -412,7 +416,7 @@ mi_h *mi_connect_local()
     argv[2]="--quiet";
     argv[3]=disable_psym_search_workaround ? 0 : "--readnow";
     argv[4]=0;
-    execvp(argv[0],argv);
+    execvp(argv[0],mi_gdb_argv ? mi_gdb_argv : argv);
     /* We get here only if exec failed. */
     _exit(127);
    }
@@ -429,10 +433,18 @@ mi_h *mi_connect_local()
     mi_free_h(&h);
     return NULL;
    }
- /* Wait for the prompt. */
- mi_get_response_blk(h);
- /* Send the start-up commands */
- mi_send_commands(h,gdb_start);
+ if (mi_gdb_start_hook)
+  {
+   mi_gdb_start_hook (h);
+   assert (gdb_start == NULL);
+  }
+ else
+  {
+   /* Wait for the prompt. */
+   mi_get_response_blk(h);
+   /* Send the start-up commands */
+   mi_send_commands(h,gdb_start);
+  }
 
  return h;
 }