major rework of jvmti. now we have three processes in jvmti mode. there are still...
[cacao.git] / src / native / jvmti / dbg.h
index 6313e1364a13840d6a19e357d350c4da59c10da0..44370c39e953bce035e63cede5002bc50cafda09 100644 (file)
    Changes:             
 
    
-   $Id: dbg.h 4357 2006-01-22 23:33:38Z twisti $
+   $Id: dbg.h 4661 2006-03-21 00:04:59Z motse $
 
 */
 
 /* at the moment linux/i386 is the only plattform available */
 #if defined(__LINUX__)  && defined (__I386__)
+
+#ifndef _DBG_H
+#define _DBG_H
+
+#include <sys/types.h>
 #include <sys/ptrace.h>
 
 #define TRACEME ptrace(PTRACE_TRACEME, 0, 0, 0)
-#define GETREGS(pid, regs) ptrace(PTRACE_GETREGS, pid, 0, &regs)
-#define GETMEM(pid, addr) ptrace(PTRACE_PEEKDATA, pid, (caddr_t) addr, 0)
-#define ENABLEBRK(pid,ins,addr) ptrace(PTRACE_POKEDATA, pid, (caddr_t) addr, (ins & ~0x000000FF) | 0xcc)
-#define CONT(pid) ptrace(PTRACE_CONT, pid, 0, 0)
+#define DETACH(pid,sig)  ptrace(PTRACE_DETACH, pid, 0, sig)
+#define TRAPINS 0xcc /* opcode for brk */
+#define TRAP asm("int3")
+#define GETMEM(pid, addr) ptrace(PTRACE_PEEKDATA, pid, addr, 0)
+#define CONT(pid,sig) if(ptrace(PTRACE_CONT, pid, 0, sig)==-1) \
+                         perror("continue failed: ");
 #define DISABLEBRK(pid,ins,addr) ptrace(PTRACE_POKEDATA, pid, (caddr_t) addr, ins)
-#define GETIP(pid,ip) ptrace(PTRACE_GETREGS, pid, 0, &regs); \
-                      ip=regs.eip;
-#define SETIP(pid,ip) ip=regs.eip; \
-                      ptrace(PTRACE_SETREGS, pid, 0, &regs); 
+#define GETREGS(pid,regs) ptrace(PTRACE_GETREGS, pid, 0, &regs)
+
+void* getip(pid_t pid);
+void setip(pid_t pid, void* ip);
+
+void setbrk(pid_t pid, void* addr,long* orig);
+
+#endif
 #endif
 
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */