gdbmach.h
Go to the documentation of this file.00001 #ifndef GDBMACH_H
00002 #define GDBMACH_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <stdint.h>
00014
00015 typedef unsigned long gdbreg_t;
00016
00017
00018
00019 enum {
00020 GDBMACH_EAX,
00021 GDBMACH_ECX,
00022 GDBMACH_EDX,
00023 GDBMACH_EBX,
00024 GDBMACH_ESP,
00025 GDBMACH_EBP,
00026 GDBMACH_ESI,
00027 GDBMACH_EDI,
00028 GDBMACH_EIP,
00029 GDBMACH_EFLAGS,
00030 GDBMACH_CS,
00031 GDBMACH_SS,
00032 GDBMACH_DS,
00033 GDBMACH_ES,
00034 GDBMACH_FS,
00035 GDBMACH_GS,
00036 GDBMACH_NREGS,
00037 GDBMACH_SIZEOF_REGS = GDBMACH_NREGS * sizeof ( gdbreg_t )
00038 };
00039
00040
00041 enum {
00042 GDBMACH_BPMEM,
00043 GDBMACH_BPHW,
00044 GDBMACH_WATCH,
00045 GDBMACH_RWATCH,
00046 GDBMACH_AWATCH,
00047 };
00048
00049 static inline void gdbmach_set_pc ( gdbreg_t *regs, gdbreg_t pc ) {
00050 regs [ GDBMACH_EIP ] = pc;
00051 }
00052
00053 static inline void gdbmach_set_single_step ( gdbreg_t *regs, int step ) {
00054 regs [ GDBMACH_EFLAGS ] &= ~( 1 << 8 );
00055 regs [ GDBMACH_EFLAGS ] |= ( step << 8 );
00056 }
00057
00058 static inline void gdbmach_breakpoint ( void ) {
00059 __asm__ __volatile__ ( "int $3\n" );
00060 }
00061
00062 extern int gdbmach_set_breakpoint ( int type, unsigned long addr, size_t len, int enable );
00063
00064 #endif