Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

gdbremote.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2001-2003 Stephane Magnenat & Julien Pilet.  
00003  * For any question or comment contact us at nct@ysagoon.com
00004  * or leto@calodox.org
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
00014  * See the GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00027 #ifndef _GDBREMOTE_H_
00028 #define _GDBREMOTE_H_
00029 
00030 #include <assert.h>
00031 #include "tcp.h"
00032 #include <map>
00033 
00034 #define GDB_REMOTE_DEFAULT_PORT 3141
00035 #define GDB_REMOTE_BUFFER_SIZE (32 * 1024)
00036 
00038 #define BKPT_0_INSTR 0xe1200070 
00039 
00040 class JTAGpxa250;
00041 
00047 class GdbRemote { 
00048 public:
00049 
00050         GdbRemote(JTAGpxa250 *pxa);
00051         ~GdbRemote();
00052 
00056         bool openPort(int port = GDB_REMOTE_DEFAULT_PORT);
00057 
00060         int prepareFD_SET(fd_set *set);
00061 
00063         void processFD_SET(fd_set *set);
00064 
00066         void printError();
00067 
00068 private:
00069         JTAGpxa250 *pxa;
00070         int clientSocket;       
00071         bool running;
00072         unsigned int hardBreak[2];
00073 
00075         unsigned char buffer[GDB_REMOTE_BUFFER_SIZE];   
00076 
00078         char message[GDB_REMOTE_BUFFER_SIZE];
00079         int bufferLength;
00080         int ptr;
00081         void reset() { ptr = 0; }
00082         unsigned char current() { return buffer[ptr]; }
00083         bool next() { ++ptr; assert(ptr<GDB_REMOTE_BUFFER_SIZE); return ptr < bufferLength; }
00084 
00085         void sendPacket();
00086         void parse();
00087         void parsePacket();
00088         void parseValidPacket();
00089         static unsigned char toAsciiHex(unsigned int v);
00090         static unsigned char asciiToHex(unsigned char c);
00091         static void hexPrintWord(unsigned char *str, unsigned int val);
00092         unsigned int parseHexWord();
00093         unsigned int parseHexByte();
00094 
00095         static void callback(void *p);
00096 
00097         void resumeExec();
00098         void query();
00099         void lastSignal();
00100         void setThread();
00101         void getRegisters();
00102         void setRegisters();
00103         void readMem();
00104         void writeMem();
00105         void cont();
00106         void insertBreakWatch();
00107         void removeBreakWatch();
00108         void step();
00109 };
00110 
00111 #endif // _GDB_REMOTE_H_
00112 

Generated on Fri May 16 13:01:45 2003 for Jelie by doxygen1.2.15