diff options
author | Jason Molenda <jmolenda@apple.com> | 1999-11-02 04:44:47 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 1999-11-02 04:44:47 +0000 |
commit | 5c44784c11ecc8febfff615b88496c56c9ad5274 (patch) | |
tree | 74f9079f5b0ddae1182abf087af8adc02103e149 /gdb/rdi-share | |
parent | 9503fd8735ec438fcb2fca34afa276e3e6ca94f5 (diff) | |
download | gdb-5c44784c11ecc8febfff615b88496c56c9ad5274.zip gdb-5c44784c11ecc8febfff615b88496c56c9ad5274.tar.gz gdb-5c44784c11ecc8febfff615b88496c56c9ad5274.tar.bz2 |
import gdb-1999-11-01 snapshot
Diffstat (limited to 'gdb/rdi-share')
-rw-r--r-- | gdb/rdi-share/Makefile.am | 12 | ||||
-rw-r--r-- | gdb/rdi-share/Makefile.in | 12 | ||||
-rw-r--r-- | gdb/rdi-share/angel_bytesex.c | 57 | ||||
-rw-r--r-- | gdb/rdi-share/angel_bytesex.h | 42 | ||||
-rw-r--r-- | gdb/rdi-share/angel_endian.h | 125 | ||||
-rw-r--r-- | gdb/rdi-share/ardi.c | 6 | ||||
-rw-r--r-- | gdb/rdi-share/devsw.c | 175 | ||||
-rw-r--r-- | gdb/rdi-share/devsw.h | 7 | ||||
-rw-r--r-- | gdb/rdi-share/etherdrv.c | 6 | ||||
-rw-r--r-- | gdb/rdi-share/hostchan.c | 12 | ||||
-rw-r--r-- | gdb/rdi-share/hostchan.h | 7 | ||||
-rw-r--r-- | gdb/rdi-share/hsys.c | 2 | ||||
-rw-r--r-- | gdb/rdi-share/msgbuild.c | 2 | ||||
-rw-r--r-- | gdb/rdi-share/params.c | 2 | ||||
-rw-r--r-- | gdb/rdi-share/rx.c | 2 | ||||
-rw-r--r-- | gdb/rdi-share/tx.c | 2 | ||||
-rw-r--r-- | gdb/rdi-share/unixcomm.c | 9 |
17 files changed, 457 insertions, 23 deletions
diff --git a/gdb/rdi-share/Makefile.am b/gdb/rdi-share/Makefile.am index 9d63d1c..4dd71d8 100644 --- a/gdb/rdi-share/Makefile.am +++ b/gdb/rdi-share/Makefile.am @@ -4,15 +4,15 @@ AUTOMAKE_OPTIONS = cygnus noinst_LIBRARIES = libangsd.a -libangsd_a_SOURCES = ardi.c bytesex.c crc.c devsw.c drivers.c etherdrv.c \ - hostchan.c hsys.c logging.c msgbuild.c params.c rx.c \ - serdrv.c serpardr.c tx.c unixcomm.c +libangsd_a_SOURCES = ardi.c angel_bytesex.c crc.c devsw.c drivers.c etherdrv.c \ + hostchan.c hsys.c logging.c msgbuild.c params.c rx.c \ + serdrv.c serpardr.c tx.c unixcomm.c -noinst_HEADERS = adp.h adperr.h angel.h ardi.h armdbg.h buffers.h bytesex.h \ +noinst_HEADERS = adp.h adperr.h angel.h ardi.h armdbg.h buffers.h \ chandefs.h channels.h chanpriv.h crc.h dbg_conf.h dbg_cp.h \ dbg_hif.h dbg_rdi.h devclnt.h devices.h devsw.h drivers.h \ - endian.h ethernet.h host.h hostchan.h hsys.h logging.h \ - msgbuild.h params.h rxtx.h sys.h unixcomm.h + angel_endian.h ethernet.h host.h hostchan.h hsys.h logging.h \ + msgbuild.h params.h rxtx.h sys.h unixcomm.h angel_bytesex.h EXTRA_DIST = README.CYGNUS diff --git a/gdb/rdi-share/Makefile.in b/gdb/rdi-share/Makefile.in index 33274da..a24e1af 100644 --- a/gdb/rdi-share/Makefile.in +++ b/gdb/rdi-share/Makefile.in @@ -70,15 +70,15 @@ AUTOMAKE_OPTIONS = cygnus noinst_LIBRARIES = libangsd.a -libangsd_a_SOURCES = ardi.c bytesex.c crc.c devsw.c drivers.c etherdrv.c \ - hostchan.c hsys.c logging.c msgbuild.c params.c rx.c \ - serdrv.c serpardr.c tx.c unixcomm.c +libangsd_a_SOURCES = ardi.c angel_bytesex.c crc.c devsw.c drivers.c etherdrv.c \ + hostchan.c hsys.c logging.c msgbuild.c params.c rx.c \ + serdrv.c serpardr.c tx.c unixcomm.c -noinst_HEADERS = adp.h adperr.h angel.h ardi.h armdbg.h buffers.h bytesex.h \ +noinst_HEADERS = adp.h adperr.h angel.h ardi.h armdbg.h buffers.h \ chandefs.h channels.h chanpriv.h crc.h dbg_conf.h dbg_cp.h \ dbg_hif.h dbg_rdi.h devclnt.h devices.h devsw.h drivers.h \ - endian.h ethernet.h host.h hostchan.h hsys.h logging.h \ - msgbuild.h params.h rxtx.h sys.h unixcomm.h + angel_endian.h ethernet.h host.h hostchan.h hsys.h logging.h \ + msgbuild.h params.h rxtx.h sys.h unixcomm.h angel_bytesex.h EXTRA_DIST = README.CYGNUS diff --git a/gdb/rdi-share/angel_bytesex.c b/gdb/rdi-share/angel_bytesex.c new file mode 100644 index 0000000..054f960 --- /dev/null +++ b/gdb/rdi-share/angel_bytesex.c @@ -0,0 +1,57 @@ +/* + * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved. + * + * This software may be freely used, copied, modified, and distributed + * provided that the above copyright notice is preserved in all copies of the + * software. + */ + +/* + * angel_bytesex.c - Code to support byte-sex independence + * Copyright: (C) 1991, Advanced RISC Machines Ltd., Cambridge, England. + */ + +/* + * RCS $Revision$ + * Checkin $Date$ + */ + +#include "angel_bytesex.h" + +static int reversing_bytes = 0; + +void bytesex_reverse(yes_or_no) +int yes_or_no; +{ reversing_bytes = yes_or_no; +} + +int bytesex_reversing() +{ + return reversing_bytes; +} + +int32 bytesex_hostval(v) +int32 v; +{ /* Return v with the same endian-ness as the host */ + /* This mess generates better ARM code than the more obvious mess */ + /* and may eventually peephole to optimal code... */ + if (reversing_bytes) + { unsigned32 t; + /* t = v ^ (v ror 16) */ + t = v ^ ((v << 16) | (((unsigned32)v) >> 16)); + t &= ~0xff0000; + /* v = v ror 8 */ + v = (v << 24) | (((unsigned32)v) >> 8); + v = v ^ (t >> 8); + } + return v; +} + +int32 bytesex_hostval_16(v) +int32 v; +{ + if (reversing_bytes) { + v = ((v >> 8) & 0xff) | ((v << 8) & 0xff00); + } + return v; +} diff --git a/gdb/rdi-share/angel_bytesex.h b/gdb/rdi-share/angel_bytesex.h new file mode 100644 index 0000000..cb86af4 --- /dev/null +++ b/gdb/rdi-share/angel_bytesex.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved. + * + * This software may be freely used, copied, modified, and distributed + * provided that the above copyright notice is preserved in all copies of the + * software. + */ + +/* + Title: Code to support byte-sex independence + Copyright: (C) 1991, Advanced RISC Machines Ltd., Cambridge, England. +*/ +/* + * RCS $Revision$ + * Checkin $Date$ + */ + +#ifndef angel_bytesex_h +#define angel_bytesex_h + +#include "host.h" + +void bytesex_reverse(int yes_or_no); +/* + * Turn sex-reversal on or off - 0 means off, non-0 means on. + */ + +int bytesex_reversing(void); +/* + * Return non-0 if reversing the byte sex, else 0. + */ + +int32 bytesex_hostval(int32 v); +/* + * Return v or byte-reversed v, according to whether sex-reversval + * is on or off. + */ + +int32 bytesex_hostval_16(int32 v); +/* Return v or byte-reversed v for a 16 bit value */ + +#endif diff --git a/gdb/rdi-share/angel_endian.h b/gdb/rdi-share/angel_endian.h new file mode 100644 index 0000000..4e40dcb --- /dev/null +++ b/gdb/rdi-share/angel_endian.h @@ -0,0 +1,125 @@ +/* + * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved. + * + * This software may be freely used, copied, modified, and distributed + * provided that the above copyright notice is preserved in all copies of the + * software. + */ + +/* -*-C-*- + * + * $Revision$ + * $Date$ + * + * + * angel_endian.h - target endianness independent read/write primitives. + */ + +#ifndef angel_endian_h +#define angel_endian_h + +/* + * The endianness of the data being processed needs to be known, but + * the host endianness is not required (since the data is constructed + * using bytes). At the moment these are provided as macros. This + * gives the compiler freedom in optimising individual calls. However, + * if space is at a premium then functions should be provided. + * + * NOTE: These macros assume that the data has been packed in the same format + * as the packing on the build host. If this is not the case then + * the wrong addresses could be used when dealing with structures. + * + */ + +/* + * For all the following routines the target endianness is defined by the + * following boolean definitions. + */ +#define BE (1 == 1) /* TRUE : big-endian */ +#define LE (1 == 0) /* FALSE : little-endian */ + +/* + * The following type definitions are used by the endianness converting + * macros. + */ +typedef unsigned char U8; +typedef U8 *P_U8; +typedef const U8 *CP_U8; + +typedef unsigned short U16; +typedef U16 *P_U16; + +typedef unsigned int U32; +typedef U32 *P_U32; + +/* + * If the endianness of the host and target are known (fixed) and the same + * then the following macro definitions can be used. These just directly copy + * the data. + * + * #define READ(e,a) (a) + * #define WRITE(e,a,v) ((a) = (v)) + * #define PREAD(e,a) (a) + * #define PWRITE(e,a,v) (*(a) = (v)) + */ + +/* + * These macros assume that a byte (char) is 8bits in size, and that the + * endianness is not important when reading or writing bytes. + */ +#define PUT8(a,v) (*((P_U8)(a)) = (U8)(v)) +#define PUT16LE(a,v) (PUT8(a,((v) & 0xFF)), \ + PUT8((((P_U8)(a)) + sizeof(char)),((v) >> 8))) +#define PUT16BE(a,v) (PUT8(a,((v) >> 8)), \ + PUT8((((P_U8)(a)) + sizeof(char)),((v) & 0xFF))) +#define PUT32LE(a,v) (PUT16LE(a,v), \ + PUT16LE((((P_U8)(a)) + sizeof(short)),((v) >> 16))) +#define PUT32BE(a,v) (PUT16BE(a,((v) >> 16)), \ + PUT16BE((((P_U8)(a)) + sizeof(short)),v)) + +#define GET8(a) (*((CP_U8)(a))) +#define GET16LE(a) (GET8(a) | (((U16)GET8(((CP_U8)(a)) + sizeof(char))) << 8)) +#define GET16BE(a) ((((U16)GET8(a)) << 8) | GET8(((CP_U8)(a)) + sizeof(char))) +#define GET32LE(a) (GET16LE(a) | \ + (((U32)GET16LE(((CP_U8)(a)) + sizeof(short))) << 16)) +#define GET32BE(a) ((((U32)GET16BE(a)) << 16) | \ + GET16BE(((CP_U8)(a)) + sizeof(short))) + +/* + * These macros simplify the code in respect to reading and writing the + * correct size data when dealing with endianness. "e" is TRUE if we are + * dealing with big-endian data, FALSE if we are dealing with little-endian. + */ + +/* void WRITE(int endianness, void *address, unsigned value); */ + +#define WRITE16(e,a,v) ((e) ? PUT16BE(&(a),v) : PUT16LE(&(a),v)) +#define WRITE32(e,a,v) ((e) ? PUT32BE(&(a),v) : PUT32LE(&(a),v)) +#define WRITE(e,a,v) ((sizeof(v) == sizeof(char)) ? \ + PUT8(&(a),v) : ((sizeof(v) == sizeof(short)) ? \ + WRITE16(e,a,v) : WRITE32(e,a,v))) + +/* unsigned READ(int endianness, void *address) */ +#define READ16(e,a) ((e) ? GET16BE(&(a)) : GET16LE(&(a))) +#define READ32(e,a) ((e) ? GET32BE(&(a)) : GET32LE(&(a))) +#define READ(e,a) ((sizeof(a) == sizeof(char)) ? \ + GET8((CP_U8)&(a)) : ((sizeof(a) == sizeof(short)) ? \ + READ16(e,a) : READ32(e,a))) + +/* void PWRITE(int endianness, void *address, unsigned value); */ +#define PWRITE16(e,a,v) ((e) ? PUT16BE(a,v) : PUT16LE(a,v)) +#define PWRITE32(e,a,v) ((e) ? PUT32BE(a,v) : PUT32LE(a,v)) +#define PWRITE(e,a,v) ((sizeof(v) == sizeof(char)) ? \ + PUT8(a,v) : ((sizeof(v) == sizeof(short)) ? \ + PWRITE16(e,a,v) : PWRITE32(e,a,v))) + +/* unsigned PREAD(int endianness, void *address) */ +#define PREAD16(e,a) ((e) ? GET16BE(a) : GET16LE(a)) +#define PREAD32(e,a) ((e) ? GET32BE(a) : GET32LE(a)) +#define PREAD(e,a) ((sizeof(*(a)) == sizeof(char)) ? \ + GET8((CP_U8)a) : ((sizeof(*(a)) == sizeof(short)) ? \ + PREAD16(e,a) : PREAD32(e,a))) + +#endif /* !defined(angel_endian_h) */ + +/* EOF angel_endian.h */ diff --git a/gdb/rdi-share/ardi.c b/gdb/rdi-share/ardi.c index f61f724..f7a391e 100644 --- a/gdb/rdi-share/ardi.c +++ b/gdb/rdi-share/ardi.c @@ -27,13 +27,13 @@ #undef uint -#include "endian.h" +#include "angel_endian.h" #include "ardi.h" #include "buffers.h" #include "channels.h" #include "hostchan.h" #include "host.h" -#include "bytesex.h" +#include "angel_bytesex.h" #include "dbg_cp.h" #include "adp.h" #include "hsys.h" @@ -1300,7 +1300,7 @@ static int HandleStoppedMessage(Packet *packet, void *stateptr) { stopped_info->stopped_status = RDIError_NoError; break; default: - stopped_info->stopped_status = RDIError_NoError; + stopped_info->stopped_status = RDIError_Error; break; } return RDIError_NoError; diff --git a/gdb/rdi-share/devsw.c b/gdb/rdi-share/devsw.c index 7fa142b..51ac29e 100644 --- a/gdb/rdi-share/devsw.c +++ b/gdb/rdi-share/devsw.c @@ -14,6 +14,7 @@ */ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "adp.h" #include "hsys.h" @@ -26,6 +27,172 @@ #include "hostchan.h" #include "logging.h" +static char *angelDebugFilename = NULL; +static FILE *angelDebugLogFile = NULL; +static int angelDebugLogEnable = 0; + +static void openLogFile () +{ + time_t t; + struct tm lt; + + if (angelDebugFilename == NULL || *angelDebugFilename =='\0') + return; + + angelDebugLogFile = fopen (angelDebugFilename,"a"); + + if (!angelDebugLogFile) + { + fprintf (stderr,"Error opening log file '%s'\n",angelDebugFilename); + perror ("fopen"); + } + else + setlinebuf (angelDebugLogFile); + + time (&t); + fprintf (angelDebugLogFile,"ADP log file opened at %s\n",asctime(localtime(&t))); +} + + +static void closeLogFile (void) +{ + time_t t; + struct tm lt; + + if (!angelDebugLogFile) + return; + + time (&t); + fprintf (angelDebugLogFile,"ADP log file closed at %s\n",asctime(localtime(&t))); + + fclose (angelDebugLogFile); + angelDebugLogFile = NULL; +} + +void DevSW_SetLogEnable (int logEnableFlag) +{ + if (logEnableFlag && !angelDebugLogFile) + openLogFile (); + else if (!logEnableFlag && angelDebugLogFile) + closeLogFile (); + + angelDebugLogEnable = logEnableFlag; +} + + +void DevSW_SetLogfile (const char *filename) +{ + closeLogFile (); + + if (angelDebugFilename) + { + free (angelDebugFilename); + angelDebugFilename = NULL; + } + + if (filename && *filename) + { + angelDebugFilename = strdup (filename); + if (angelDebugLogEnable) + openLogFile (); + } +} + + +#define WordAt(p) ((unsigned long) ((p)[0] | ((p)[1]<<8) | ((p)[2]<<16) | ((p)[3]<<24))) + +static void dumpPacket(FILE *fp, char *label, struct data_packet *p) +{ + unsigned r; + int i; + + if (!fp) + return; + + fprintf(fp,"%s [T=%d L=%d] ",label,p->type,p->len); + for (i=0; i<p->len; ++i) + fprintf(fp,"%02x ",p->data[i]); + fprintf(fp,"\n"); + + r = WordAt(p->data+4); + + fprintf(fp,"R=%08x ",r); + fprintf(fp,"%s ", r&0x80000000 ? "H<-T" : "H->T"); + + switch ((r>>16) & 0xff) + { + case CI_PRIVATE: fprintf(fp,"CI_PRIVATE: "); break; + case CI_HADP: fprintf(fp,"CI_HADP: "); break; + case CI_TADP: fprintf(fp,"CI_TADP: "); break; + case CI_HBOOT: fprintf(fp,"CI_HBOOT: "); break; + case CI_TBOOT: fprintf(fp,"CI_TBOOT: "); break; + case CI_CLIB: fprintf(fp,"CI_CLIB: "); break; + case CI_HUDBG: fprintf(fp,"CI_HUDBG: "); break; + case CI_TUDBG: fprintf(fp,"CI_TUDBG: "); break; + case CI_HTDCC: fprintf(fp,"CI_HTDCC: "); break; + case CI_TTDCC: fprintf(fp,"CI_TTDCC: "); break; + case CI_TLOG: fprintf(fp,"CI_TLOG: "); break; + default: fprintf(fp,"BadChan: "); break; + } + + switch (r & 0xffffff) + { + case ADP_Booted: fprintf(fp," ADP_Booted "); break; +#if defined(ADP_TargetResetIndication) + case ADP_TargetResetIndication: fprintf(fp," ADP_TargetResetIndication "); break; +#endif + case ADP_Reboot: fprintf(fp," ADP_Reboot "); break; + case ADP_Reset: fprintf(fp," ADP_Reset "); break; +#if defined(ADP_HostResetIndication) + case ADP_HostResetIndication: fprintf(fp," ADP_HostResetIndication "); break; +#endif + case ADP_ParamNegotiate: fprintf(fp," ADP_ParamNegotiate "); break; + case ADP_LinkCheck: fprintf(fp," ADP_LinkCheck "); break; + case ADP_HADPUnrecognised: fprintf(fp," ADP_HADPUnrecognised "); break; + case ADP_Info: fprintf(fp," ADP_Info "); break; + case ADP_Control: fprintf(fp," ADP_Control "); break; + case ADP_Read: fprintf(fp," ADP_Read "); break; + case ADP_Write: fprintf(fp," ADP_Write "); break; + case ADP_CPUread: fprintf(fp," ADP_CPUread "); break; + case ADP_CPUwrite: fprintf(fp," ADP_CPUwrite "); break; + case ADP_CPread: fprintf(fp," ADP_CPread "); break; + case ADP_CPwrite: fprintf(fp," ADP_CPwrite "); break; + case ADP_SetBreak: fprintf(fp," ADP_SetBreak "); break; + case ADP_ClearBreak: fprintf(fp," ADP_ClearBreak "); break; + case ADP_SetWatch: fprintf(fp," ADP_SetWatch "); break; + case ADP_ClearWatch: fprintf(fp," ADP_ClearWatch "); break; + case ADP_Execute: fprintf(fp," ADP_Execute "); break; + case ADP_Step: fprintf(fp," ADP_Step "); break; + case ADP_InterruptRequest: fprintf(fp," ADP_InterruptRequest "); break; + case ADP_HW_Emulation: fprintf(fp," ADP_HW_Emulation "); break; + case ADP_ICEbreakerHADP: fprintf(fp," ADP_ICEbreakerHADP "); break; + case ADP_ICEman: fprintf(fp," ADP_ICEman "); break; + case ADP_Profile: fprintf(fp," ADP_Profile "); break; + case ADP_InitialiseApplication: fprintf(fp," ADP_InitialiseApplication "); break; + case ADP_End: fprintf(fp," ADP_End "); break; + case ADP_TADPUnrecognised: fprintf(fp," ADP_TADPUnrecognised "); break; + case ADP_Stopped: fprintf(fp," ADP_Stopped "); break; + case ADP_TDCC_ToHost: fprintf(fp," ADP_TDCC_ToHost "); break; + case ADP_TDCC_FromHost: fprintf(fp," ADP_TDCC_FromHost "); break; + default: fprintf(fp," BadReason "); break; + } + + i = 20; + + if (((r & 0xffffff) == ADP_CPUread || + (r & 0xffffff) == ADP_CPUwrite) && (r&0x80000000)==0) + { + fprintf(fp,"%02x ", p->data[i]); + ++i; + } + + for (; i<p->len; i+=4) + fprintf(fp,"%08x ",WordAt(p->data+i)); + + fprintf(fp,"\n"); +} + + /* * TODO: this should be adjustable - it could be done by defining * a reason code for DevSW_Ioctl. It could even be a @@ -309,6 +476,10 @@ AdpErrs DevSW_Read(const DeviceDescr *device, const DevChanID type, #ifdef RET_DEBUG printf("got a complete packet\n"); #endif + + if (angelDebugLogEnable) + dumpPacket(angelDebugLogFile,"rx:",&ds->ds_activeread.dc_packet); + enqueue_packet(ds); *packet = Adp_removeFromQueue(&ds->ds_readqueue[type]); return adp_ok; @@ -380,6 +551,10 @@ AdpErrs DevSW_Write(const DeviceDescr *device, Packet *packet, DevChanID type) * we can take this packet - set things up, then try to get rid of it */ initialise_write(dc, packet, type); + + if (angelDebugLogEnable) + dumpPacket(angelDebugLogFile,"tx:",&dc->dc_packet); + flush_packet(device, dc); return adp_ok; diff --git a/gdb/rdi-share/devsw.h b/gdb/rdi-share/devsw.h index f561768..749e7e6 100644 --- a/gdb/rdi-share/devsw.h +++ b/gdb/rdi-share/devsw.h @@ -259,6 +259,13 @@ AdpErrs DevSW_Ioctl(const DeviceDescr *device, const int opcode, void *args); */ bool DevSW_WriteFinished(const DeviceDescr *device); + +/* + * set filename and enable/disable logginf of ADP packets + */ +void DevSW_SetLogfile(const char *filename); +void DevSW_SetLogEnable(int logEnableFlag); + #ifdef __cplusplus } #endif diff --git a/gdb/rdi-share/etherdrv.c b/gdb/rdi-share/etherdrv.c index 58462d4..d9c5c0f 100644 --- a/gdb/rdi-share/etherdrv.c +++ b/gdb/rdi-share/etherdrv.c @@ -71,7 +71,7 @@ #include "hsys.h" #include "devices.h" -#include "endian.h" +#include "angel_endian.h" #include "buffers.h" #include "hostchan.h" #include "params.h" @@ -282,6 +282,10 @@ static void fetch_ports(void) * port on the remote target */ ia->sin_port = htons(CTRL_PORT); +#ifdef DEBUG + printf("CTLR_PORT=0x%04x sin_port=0x%04x\n"); +#endif + if (sendto(sock, ctrlpacket, sizeof(ctrlpacket), 0, (struct sockaddr *)ia, sizeof(*ia)) < 0) { diff --git a/gdb/rdi-share/hostchan.c b/gdb/rdi-share/hostchan.c index 8e41da4..3114c52 100644 --- a/gdb/rdi-share/hostchan.c +++ b/gdb/rdi-share/hostchan.c @@ -230,7 +230,7 @@ void Adp_addToQueue(Packet **head, Packet *newpkt) */ ASSERT(&(((Packet *)0)->pk_next) == 0, "bad struct Packet layout"); -#if DEBUG && 0 +#if defined(DEBUG) && 0 printf("Adp_addToQueue(%p, %p)\n", head, newpkt); #endif @@ -265,6 +265,16 @@ Packet *Adp_removeFromQueue(Packet **head) return pk; } +void Adp_SetLogEnable(int logEnableFlag) +{ + DevSW_SetLogEnable(logEnableFlag); +} + +void Adp_SetLogfile(const char *filename) +{ + DevSW_SetLogfile(filename); +} + AdpErrs Adp_OpenDevice(const char *name, const char *arg, unsigned int heartbeat_on) { diff --git a/gdb/rdi-share/hostchan.h b/gdb/rdi-share/hostchan.h index 44563a6..b9acb77 100644 --- a/gdb/rdi-share/hostchan.h +++ b/gdb/rdi-share/hostchan.h @@ -92,6 +92,13 @@ extern void Adp_addToQueue(Packet **head, Packet *newpkt); extern Packet *Adp_removeFromQueue(Packet **head); /* + * Set log file and Enable/disable logging of ADP packets to file. + */ + +void Adp_SetLogfile(const char *filename); +void Adp_SetLogEnable(int logEnableFlag); + +/* * Function: Adp_OpenDevice * Purpose: Open a device to use for channels communication. This is a * very thin veneer to the device drivers: what hostchan.c diff --git a/gdb/rdi-share/hsys.c b/gdb/rdi-share/hsys.c index ef42a30..3913756 100644 --- a/gdb/rdi-share/hsys.c +++ b/gdb/rdi-share/hsys.c @@ -29,7 +29,7 @@ #include "ardi.h" #include "buffers.h" #include "channels.h" /* Channel interface. */ -#include "endian.h" +#include "angel_endian.h" #include "logging.h" /* Angel support functions. */ #include "msgbuild.h" #include "sys.h" diff --git a/gdb/rdi-share/msgbuild.c b/gdb/rdi-share/msgbuild.c index e2db2cc..63263e7 100644 --- a/gdb/rdi-share/msgbuild.c +++ b/gdb/rdi-share/msgbuild.c @@ -28,7 +28,7 @@ #include "channels.h" #include "buffers.h" -#include "endian.h" /* Endianness support macros */ +#include "angel_endian.h" /* Endianness support macros */ #include "msgbuild.h" /* Header file for this source code */ #ifndef UNUSED diff --git a/gdb/rdi-share/params.c b/gdb/rdi-share/params.c index 2c78188..55d9eb2 100644 --- a/gdb/rdi-share/params.c +++ b/gdb/rdi-share/params.c @@ -19,7 +19,7 @@ #include "params.h" -#include "endian.h" +#include "angel_endian.h" #include "logging.h" diff --git a/gdb/rdi-share/rx.c b/gdb/rdi-share/rx.c index 4f434f0..caf833a 100644 --- a/gdb/rdi-share/rx.c +++ b/gdb/rdi-share/rx.c @@ -19,7 +19,7 @@ #include <stdarg.h> /* ANSI varargs support */ #include "angel.h" /* Angel system definitions */ -#include "endian.h" /* Endian independant memory access macros */ +#include "angel_endian.h" /* Endian independant memory access macros */ #include "crc.h" /* crc generation definitions and headers */ #include "rxtx.h" #include "channels.h" diff --git a/gdb/rdi-share/tx.c b/gdb/rdi-share/tx.c index a52286c..7d8d154 100644 --- a/gdb/rdi-share/tx.c +++ b/gdb/rdi-share/tx.c @@ -18,7 +18,7 @@ #include <stdarg.h> /* ANSI varargs support */ #include "angel.h" /* Angel system definitions */ -#include "endian.h" /* Endian independant memory access macros */ +#include "angel_endian.h" /* Endian independant memory access macros */ #include "crc.h" /* crc generation definitions and headers */ #include "rxtx.h" #include "channels.h" diff --git a/gdb/rdi-share/unixcomm.c b/gdb/rdi-share/unixcomm.c index 61d84e3..86bffc0 100644 --- a/gdb/rdi-share/unixcomm.c +++ b/gdb/rdi-share/unixcomm.c @@ -287,7 +287,14 @@ extern int Unix_ReadSerial(unsigned char *buf, int n, bool block) return -1; } else if (err > 0 && FD_ISSET(serpfd, &fdset)) - return read(serpfd, buf, n); + { + int s; + + s = read(serpfd, buf, n); + if (s < 0) + perror("read:"); + return s; + } else /* err == 0 || FD_CLR(serpfd, &fdset) */ { errno = ERRNO_FOR_BLOCKED_IO; |