summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/nt32/crt_glue.c2
-rw-r--r--src/arch/nt32/debug.c79
-rw-r--r--src/arch/nt32/vtbl.c1
-rw-r--r--src/arch/nt64/crt_glue.c2
-rw-r--r--src/arch/nt64/debug.c79
-rw-r--r--src/arch/nt64/vtbl.c1
6 files changed, 164 insertions, 0 deletions
diff --git a/src/arch/nt32/crt_glue.c b/src/arch/nt32/crt_glue.c
index cd35d52..a710c39 100644
--- a/src/arch/nt32/crt_glue.c
+++ b/src/arch/nt32/crt_glue.c
@@ -9,6 +9,7 @@
extern const struct __ldso_vtbl * __ldso_vtbl;
extern const struct __psx_vtbl * __psx_vtbl;
extern const struct __seh_vtbl * __eh_vtbl;
+extern const struct __dbg_vtbl * __db_vtbl;
static int __pthread_surrogate_init(struct pthread * self);
@@ -86,6 +87,7 @@ void __libc_entry_routine(
__ldso_vtbl = ctx.ldso_vtbl;
__psx_vtbl = ctx.psx_vtbl;
__eh_vtbl = ctx.seh_vtbl;
+ __db_vtbl = ctx.dbg_vtbl;
__teb_sys_idx = ctx.teb_sys_idx;
__teb_libc_idx = ctx.teb_libc_idx;
diff --git a/src/arch/nt32/debug.c b/src/arch/nt32/debug.c
new file mode 100644
index 0000000..cfa6aee
--- /dev/null
+++ b/src/arch/nt32/debug.c
@@ -0,0 +1,79 @@
+#include <stdint.h>
+#include <stddef.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/debug.h>
+#include "psxdbg.h"
+
+extern const struct __dbg_vtbl * __db_vtbl;
+
+
+int __dbg_attach(pid_t pid)
+{
+ return __db_vtbl->dbg_attach(pid);
+}
+
+int __dbg_detach(int pfd)
+{
+ return __db_vtbl->dbg_detach(pfd);
+}
+
+int __dbg_spawn(const char * path, char ** argv, char ** envp)
+{
+ return __db_vtbl->dbg_spawn(path,argv,envp);
+}
+
+int __dbg_fork()
+{
+ return __db_vtbl->dbg_fork();
+}
+
+int __dbg_suspend(int pfd)
+{
+ return __db_vtbl->dbg_suspend(pfd);
+}
+
+int __dbg_kill(int pfd)
+{
+ return __db_vtbl->dbg_kill(pfd);
+}
+
+int __dbg_event_query_one(int pfd, struct __dbg_event * evt)
+{
+ return __db_vtbl->dbg_event_query_one(pfd,evt);
+}
+
+int __dbg_event_query_all(int pfd, struct __dbg_event evt[], int nelem)
+{
+ return __db_vtbl->dbg_event_query_all(pfd,evt,nelem);
+}
+
+int __dbg_event_acquire(int pfd, struct __dbg_event * evt)
+{
+ return __db_vtbl->dbg_event_acquire(pfd,evt);
+}
+
+int __dbg_event_respond(int pfd, struct __dbg_event * evt)
+{
+ return __db_vtbl->dbg_event_respond(pfd,evt);
+}
+
+int __dbg_query_cpid(int pfd)
+{
+ return __db_vtbl->dbg_query_cpid(pfd);
+}
+
+int __dbg_query_syspid(int pfd)
+{
+ return __db_vtbl->dbg_query_syspid(pfd);
+}
+
+int __dbg_common_error(void)
+{
+ return __db_vtbl->dbg_common_error();
+}
+
+int __dbg_native_error(void)
+{
+ return __db_vtbl->dbg_native_error();
+}
diff --git a/src/arch/nt32/vtbl.c b/src/arch/nt32/vtbl.c
index ad0a0e9..8a0412f 100644
--- a/src/arch/nt32/vtbl.c
+++ b/src/arch/nt32/vtbl.c
@@ -6,6 +6,7 @@
const struct __ldso_vtbl * __ldso_vtbl = 0;
const struct __psx_vtbl * __psx_vtbl = 0;
const struct __seh_vtbl * __eh_vtbl = 0;
+const struct __dbg_vtbl * __db_vtbl = 0;
unsigned long ** __syscall_vtbl = 0;
unsigned long __teb_sys_idx = 0;
diff --git a/src/arch/nt64/crt_glue.c b/src/arch/nt64/crt_glue.c
index cd35d52..a710c39 100644
--- a/src/arch/nt64/crt_glue.c
+++ b/src/arch/nt64/crt_glue.c
@@ -9,6 +9,7 @@
extern const struct __ldso_vtbl * __ldso_vtbl;
extern const struct __psx_vtbl * __psx_vtbl;
extern const struct __seh_vtbl * __eh_vtbl;
+extern const struct __dbg_vtbl * __db_vtbl;
static int __pthread_surrogate_init(struct pthread * self);
@@ -86,6 +87,7 @@ void __libc_entry_routine(
__ldso_vtbl = ctx.ldso_vtbl;
__psx_vtbl = ctx.psx_vtbl;
__eh_vtbl = ctx.seh_vtbl;
+ __db_vtbl = ctx.dbg_vtbl;
__teb_sys_idx = ctx.teb_sys_idx;
__teb_libc_idx = ctx.teb_libc_idx;
diff --git a/src/arch/nt64/debug.c b/src/arch/nt64/debug.c
new file mode 100644
index 0000000..cfa6aee
--- /dev/null
+++ b/src/arch/nt64/debug.c
@@ -0,0 +1,79 @@
+#include <stdint.h>
+#include <stddef.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/debug.h>
+#include "psxdbg.h"
+
+extern const struct __dbg_vtbl * __db_vtbl;
+
+
+int __dbg_attach(pid_t pid)
+{
+ return __db_vtbl->dbg_attach(pid);
+}
+
+int __dbg_detach(int pfd)
+{
+ return __db_vtbl->dbg_detach(pfd);
+}
+
+int __dbg_spawn(const char * path, char ** argv, char ** envp)
+{
+ return __db_vtbl->dbg_spawn(path,argv,envp);
+}
+
+int __dbg_fork()
+{
+ return __db_vtbl->dbg_fork();
+}
+
+int __dbg_suspend(int pfd)
+{
+ return __db_vtbl->dbg_suspend(pfd);
+}
+
+int __dbg_kill(int pfd)
+{
+ return __db_vtbl->dbg_kill(pfd);
+}
+
+int __dbg_event_query_one(int pfd, struct __dbg_event * evt)
+{
+ return __db_vtbl->dbg_event_query_one(pfd,evt);
+}
+
+int __dbg_event_query_all(int pfd, struct __dbg_event evt[], int nelem)
+{
+ return __db_vtbl->dbg_event_query_all(pfd,evt,nelem);
+}
+
+int __dbg_event_acquire(int pfd, struct __dbg_event * evt)
+{
+ return __db_vtbl->dbg_event_acquire(pfd,evt);
+}
+
+int __dbg_event_respond(int pfd, struct __dbg_event * evt)
+{
+ return __db_vtbl->dbg_event_respond(pfd,evt);
+}
+
+int __dbg_query_cpid(int pfd)
+{
+ return __db_vtbl->dbg_query_cpid(pfd);
+}
+
+int __dbg_query_syspid(int pfd)
+{
+ return __db_vtbl->dbg_query_syspid(pfd);
+}
+
+int __dbg_common_error(void)
+{
+ return __db_vtbl->dbg_common_error();
+}
+
+int __dbg_native_error(void)
+{
+ return __db_vtbl->dbg_native_error();
+}
diff --git a/src/arch/nt64/vtbl.c b/src/arch/nt64/vtbl.c
index ad0a0e9..8a0412f 100644
--- a/src/arch/nt64/vtbl.c
+++ b/src/arch/nt64/vtbl.c
@@ -6,6 +6,7 @@
const struct __ldso_vtbl * __ldso_vtbl = 0;
const struct __psx_vtbl * __psx_vtbl = 0;
const struct __seh_vtbl * __eh_vtbl = 0;
+const struct __dbg_vtbl * __db_vtbl = 0;
unsigned long ** __syscall_vtbl = 0;
unsigned long __teb_sys_idx = 0;