summaryrefslogtreecommitdiff
path: root/overlay/mgdb/gdb/winnt-nat.c
diff options
context:
space:
mode:
Diffstat (limited to 'overlay/mgdb/gdb/winnt-nat.c')
-rw-r--r--overlay/mgdb/gdb/winnt-nat.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/overlay/mgdb/gdb/winnt-nat.c b/overlay/mgdb/gdb/winnt-nat.c
index 2d9999d..0f615e5 100644
--- a/overlay/mgdb/gdb/winnt-nat.c
+++ b/overlay/mgdb/gdb/winnt-nat.c
@@ -8,6 +8,7 @@
#include "osabi.h"
#include "config.h"
#include "target.h"
+#include "main.h"
#include "utils.h"
#include "inferior.h"
#include "gdbthread.h"
@@ -22,6 +23,8 @@
#include <sys/cmd.h>
#include <sys/debug.h>
+#include <perk/perk.h>
+
#define WINNT_OUTBUF_SIZE 65536
#define winnt_error(msg) \
@@ -46,6 +49,7 @@ struct winnt_process {
static size_t pcnt;
static winnt_process * plist;
static char * outbuf;
+static struct pe_driver_ctx * pe_dctx;
extern void amd64_winnt_fetch_registers(
int pfd, struct regcache * rcache,
@@ -731,6 +735,19 @@ static char * winnt_pid_to_str (struct target_ops * t, ptid_t ptid)
return outbuf;
}
+static int winnt_perk_init(void)
+{
+ char * argv[2];
+
+ if (pe_dctx)
+ return 0;
+
+ argv[0] = (char *)get_gdb_program_name();
+ argv[1] = 0;
+
+ return pe_get_driver_ctx(argv,0,0,0,&pe_dctx);
+}
+
static target_ops * winnt_target_alloc (void)
{
target_ops * t = inf_child_target();
@@ -766,6 +783,9 @@ static target_ops * winnt_target_alloc (void)
x86_use_watchpoints(t);
+ if (winnt_perk_init() < 0)
+ return 0;
+
return ((outbuf = (char *)calloc(1,WINNT_OUTBUF_SIZE)))
? t : 0;
}