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, ®s)
-#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, ®s); \
- ip=regs.eip;
-#define SETIP(pid,ip) ip=regs.eip; \
- ptrace(PTRACE_SETREGS, pid, 0, ®s);
+#define GETREGS(pid,regs) ptrace(PTRACE_GETREGS, pid, 0, ®s)
+
+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:
+ */