You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This is like remote.c but is for an esoteric situation--
having a 29k board attached to an Adapt inline monitor.
7/91 o - Freeze mode tracing can be done on a 29050. */
#include "defs.h"
-#include <string.h>
+#include "gdb_string.h"
#include "inferior.h"
#include "wait.h"
#include "value.h"
static void adapt_close ();
static int adapt_clear_breakpoints();
-/*
- * Processor types. It is assumed that the adapt has the correct
- * ROM for the given processor.
- */
-#define TYPE_UNKNOWN 0
-#define TYPE_A29000 1
-#define TYPE_A29030 2
-#define TYPE_A29050 3
-static char *processor_name[] = { "Unknown", "A29000", "A29030", "A29050" };
-static int processor_type=TYPE_UNKNOWN;
-
#define FREEZE_MODE (read_register(CPS_REGNUM) && 0x400)
-#define USE_SHADOW_PC ((processor_type == TYPE_A29050) && FREEZE_MODE)
+#define USE_SHADOW_PC ((processor_type == a29k_freeze_mode) && FREEZE_MODE)
/* Can't seem to get binary coff working */
#define ASCII_COFF /* Adapt will be downloaded with ascii coff */
+/* FIXME: Replace with `set remotedebug'. */
#define LOG_FILE "adapt.log"
#if defined (LOG_FILE)
FILE *log_file=NULL;
long val;
while (n--) {
val = get_hex_word();
- supply_register(regno++,&val);
+ supply_register(regno++,(char *) &val);
}
}
/* Called when SIGALRM signal sent due to alarm() timeout. */
expect_prompt ();
#else
insert_breakpoints (); /* Needed to get correct instruction in cache */
- proceed(entry_pt, -1, 0);
+ proceed(entry_pt, TARGET_SIGNAL_DEFAULT, 0);
#endif
} else {
error ("\
Please include the name of the device for the serial port,\n\
the baud rate, and the name of the program to run on the remote system.");
- dev_name = (char*)malloc(p - name + 1);
+ dev_name = (char*)xmalloc(p - name + 1);
strncpy (dev_name, name, p - name);
dev_name[p - name] = '\0';
/* Clear any break points */
adapt_clear_breakpoints();
- /* Determine the processor revision level */
- prl = (unsigned int)read_register(CFG_REGNUM) >> 24;
- if (prl == 0x03) {
- processor_type = TYPE_A29000;
- } else if ((prl&0xf0) == 0x40) { /* 29030 = 0x4* */
- processor_type = TYPE_A29030;
- fprintf_filtered(stderr,"WARNING: debugging of A29030 not tested.\n");
- } else if ((prl&0xf0) == 0x20) { /* 29050 = 0x2* */
- processor_type = TYPE_A29050;
- fprintf_filtered(stderr,"WARNING: debugging of A29050 not tested.\n");
- } else {
- processor_type = TYPE_UNKNOWN;
- fprintf_filtered(stderr,"WARNING: processor type unknown.\n");
- }
-
/* Print out some stuff, letting the user now what's going on */
- printf_filtered("Remote debugging on an %s connect to an Adapt via %s.\n",
- processor_name[processor_type],dev_name);
+ printf_filtered("Connected to an Adapt via %s.\n", dev_name);
/* FIXME: can this restriction be removed? */
printf_filtered("Remote debugging using virtual addresses works only\n");
printf_filtered("\twhen virtual addresses map 1:1 to physical addresses.\n");
- if (processor_type != TYPE_A29050) {
+ if (processor_type != a29k_freeze_mode) {
fprintf_filtered(stderr,
"Freeze-mode debugging not available, and can only be done on an A29050.\n");
}
/* Tell the remote machine to resume. */
void
-adapt_resume (step, sig)
- int step, sig;
+adapt_resume (pid, step, sig)
+ int pid, step;
+ enum target_signal sig;
{
if (step)
{
int
adapt_wait (status)
- WAITTYPE *status;
+ struct target_waitstatus *status;
{
/* Strings to look for. '?' means match any single character.
Note that with the algorithm we use, the initial character
int old_timeout = timeout;
int old_immediate_quit = immediate_quit;
- WSETEXIT ((*status), 0);
+ status->kind = TARGET_WAITKIND_EXITED;
+ status->value.integer = 0;
if (need_artificial_trap != 0)
{
- WSETSTOP ((*status), SIGTRAP);
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_TRAP;
need_artificial_trap--;
return 0;
}
}
expect_prompt ();
if (*bp== '\0')
- WSETSTOP ((*status), SIGTRAP);
+ {
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_TRAP;
+ }
else
- WSETEXIT ((*status), 0);
+ {
+ status->kind = TARGET_WAITKIND_EXITED;
+ status->value.integer = 0;
+ }
timeout = old_timeout;
immediate_quit = old_immediate_quit;
return 0;
sreg_buf[12] = read_register(PC2_REGNUM); /* pc2 */
}
for (i=0 ; i<14 ; i++) /* Supply vab -> lru */
- supply_register(VAB_REGNUM+i,&sreg_buf[i]);
+ supply_register(VAB_REGNUM+i, (char *) &sreg_buf[i]);
sprintf (tempbuf, "dw sr128\r");
write (adapt_desc, tempbuf, strlen (tempbuf));
for (i=0 ; i<2 ; i++) { /* SR128 - SR135 */
sreg_buf[i*4 + j] = get_hex_word();
}
expect_prompt();
- supply_register(IPC_REGNUM,&sreg_buf[0]);
- supply_register(IPA_REGNUM,&sreg_buf[1]);
- supply_register(IPB_REGNUM,&sreg_buf[2]);
- supply_register(Q_REGNUM, &sreg_buf[3]);
+ supply_register(IPC_REGNUM,(char *) &sreg_buf[0]);
+ supply_register(IPA_REGNUM,(char *) &sreg_buf[1]);
+ supply_register(IPB_REGNUM,(char *) &sreg_buf[2]);
+ supply_register(Q_REGNUM, (char *) &sreg_buf[3]);
/* Skip ALU */
- supply_register(BP_REGNUM, &sreg_buf[5]);
- supply_register(FC_REGNUM, &sreg_buf[6]);
- supply_register(CR_REGNUM, &sreg_buf[7]);
+ supply_register(BP_REGNUM, (char *) &sreg_buf[5]);
+ supply_register(FC_REGNUM, (char *) &sreg_buf[6]);
+ supply_register(CR_REGNUM, (char *) &sreg_buf[7]);
/* There doesn't seem to be any way to get these. */
{
int val = -1;
- supply_register (FPE_REGNUM, &val);
- supply_register (INTE_REGNUM, &val);
- supply_register (FPS_REGNUM, &val);
- supply_register (EXO_REGNUM, &val);
+ supply_register (FPE_REGNUM, (char *) &val);
+ supply_register (INTE_REGNUM, (char *) &val);
+ supply_register (FPS_REGNUM, (char *) &val);
+ supply_register (EXO_REGNUM, (char *) &val);
}
write (adapt_desc, "dw gr1,gr1\r", 11);
break;
/* Begin commands that take input in the form 'c x,y[,z...]' */
case 'S': /* Set memory or register */
- if (index(args,',')) { /* Assume it is properly formatted */
+ if (strchr(args,',')) { /* Assume it is properly formatted */
write(adapt_desc,args,strlen(args));
write(adapt_desc,"\r",1);
expect_prompt();
adapt_create_inferior, /* create_inferior */
adapt_mourn, /* mourn_inferior FIXME */
0, /* can_run */
+ 0, /* notice_signals */
+ 0, /* to_stop */
process_stratum, 0, /* next */
1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
0,0, /* Section pointers */