summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-09-14 02:27:36 +0000
committermidipix <writeonce@midipix.org>2019-09-14 20:16:51 +0000
commitaef6781dbba2f1ce4cd9eac1328c498e2b4f84a8 (patch)
treeea71f33aa1f5bb1d3ddaad72377c82f646ea174e
parent5d1280ade1bdab8f4f0754ce1ae9c27a89ee6358 (diff)
downloadchainport-aef6781dbba2f1ce4cd9eac1328c498e2b4f84a8.tar.bz2
chainport-aef6781dbba2f1ce4cd9eac1328c498e2b4f84a8.tar.xz
mgdb: enable the perk library interface.
-rw-r--r--overlay/mgdb/gdb/config/i386/midipix64.mh2
-rw-r--r--overlay/mgdb/gdb/winnt-nat.c20
2 files changed, 22 insertions, 0 deletions
diff --git a/overlay/mgdb/gdb/config/i386/midipix64.mh b/overlay/mgdb/gdb/config/i386/midipix64.mh
index 9160611..0d2753f 100644
--- a/overlay/mgdb/gdb/config/i386/midipix64.mh
+++ b/overlay/mgdb/gdb/config/i386/midipix64.mh
@@ -2,3 +2,5 @@ NATDEPFILES = x86-nat.o x86-dregs.o \
i386-winnt-regcache.o \
amd64-winnt-regcache.o \
winnt-nat.o
+
+LOADLIBES = -lperk
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;
}