00001
00029 #ifndef _AC_GDB_H_
00030 #define _AC_GDB_H_
00031
00032 #include "breakpoints.H"
00033 #include "ac_gdb_interface.H"
00034 #include "ac_resources.H"
00035
00036 #include <stdio.h>
00037 #include <stdlib.h>
00038 #include <sys/types.h>
00039 #include <sys/socket.h>
00040 #include <netinet/in.h>
00041 #include <arpa/inet.h>
00042 #include <netdb.h>
00043 #include <unistd.h>
00044 #include <signal.h>
00045
00046 #ifndef BREAKPOINTS
00047 # define BREAKPOINTS 200
00048 #endif
00049
00050 #ifndef GDB_BUFFERSIZE
00051 # define GDB_BUFFERSIZE 2048
00052 #endif
00053
00054 #ifdef DEBUG
00055 # define debug( x ) \
00056 cerr << "debug:" << __FILE__ << ":" << __LINE__ << "=>" << ( x ) << endl
00057 #else
00058 # define debug( x )
00059 #endif
00060
00061
00062 static const char hexchars[]="0123456789abcdef";
00067 class AC_GDB {
00068 public:
00069 AC_GDB( AC_GDB_Interface* proc, int port );
00070 ~AC_GDB();
00071
00072 void process_bp();
00073 bool stop( unsigned int decoded_pc );
00074 void exit( int ac_exit_status );
00075
00076
00077 void disable();
00078 void enable();
00079 int is_disabled();
00080 void connect();
00081
00082
00083 void set_port( int port );
00084 int get_port();
00085
00086 private:
00087 Breakpoints *bps;
00088 AC_GDB_Interface* proc;
00090
00091 int sd;
00092 int port;
00094
00095 char connected;
00096 char first_time;
00097 char step;
00098 char disabled;
00100
00101 char out_buffer[ GDB_BUFFERSIZE ];
00102 char in_buffer[ GDB_BUFFERSIZE ];
00104
00105 void reg_read( char *ib, char *ob );
00106 void reg_write( char *ib, char *ob );
00107
00108
00109 void mem_read( char *ib, char *ob );
00110 void mem_write( char *ib, char *ob );
00111
00112
00113 void continue_execution( char *ib, char *ob );
00114 void stepmode( char *ib, char *ob );
00115 void cc( char *ib, char *ob );
00116
00117
00118 void break_insert( char *ib, char *ob );
00119 void break_remove( char *ib, char *ob );
00120
00121
00122 void comm_getpacket ( char *buffer );
00123 void comm_putpacket( const char *buffer );
00124 int comm_putchar( const char c );
00125 char comm_getchar();
00126
00127
00128 int hex( unsigned char ch );
00129 };
00130
00131 #endif