* Makefile.in: Re-install 29K/UDI stuff.

* remote-udi.c (udi_resume):  Clean up.
* (udi_wait):  Rewrite, leave out bugs.
* Add debugging code to print out all register fetches and stores.
* Straighten out target_ops.
* tm-29k.h (DUMMY_FRAME_RSIZE):  Pad out to doubleword.
This commit is contained in:
Stu Grossman 1992-10-05 23:19:59 +00:00
parent 446c5af7c2
commit aa1dea489b
4 changed files with 226 additions and 128 deletions

View File

@ -1,3 +1,12 @@
Mon Oct 5 16:02:04 1992 Stu Grossman (grossman at cygnus.com)
* Makefile.in: Re-install 29K/UDI stuff.
* remote-udi.c (udi_resume): Clean up.
* (udi_wait): Rewrite, leave out bugs.
* Add debugging code to print out all register fetches and stores.
* Straighten out target_ops.
* tm-29k.h (DUMMY_FRAME_RSIZE): Pad out to doubleword.
Mon Oct 5 09:46:44 1992 Ian Lance Taylor (ian@cygnus.com) Mon Oct 5 09:46:44 1992 Ian Lance Taylor (ian@cygnus.com)
* remote-udi.c (udi_create_inferior): run with no arguments should * remote-udi.c (udi_create_inferior): run with no arguments should

View File

@ -165,7 +165,7 @@ CDEPS = ${XM_CDEPS} ${TM_CDEPS} ${NAT_CDEPS} \
ADD_FILES = ${REGEX} ${ALLOCA} ${XM_ADD_FILES} ${TM_ADD_FILES} ${NAT_ADD_FILES} ADD_FILES = ${REGEX} ${ALLOCA} ${XM_ADD_FILES} ${TM_ADD_FILES} ${NAT_ADD_FILES}
ADD_DEPS = ${REGEX1} ${ALLOCA1} ${XM_ADD_FILES} ${TM_ADD_FILES} ${NAT_ADD_FILES} ADD_DEPS = ${REGEX1} ${ALLOCA1} ${XM_ADD_FILES} ${TM_ADD_FILES} ${NAT_ADD_FILES}
VERSION = 4.6.6 VERSION = 4.6.7
DIST=gdb DIST=gdb
LINT=/usr/5bin/lint LINT=/usr/5bin/lint
@ -223,7 +223,19 @@ SFILES_SUBDIR = \
${srcdir}/nindy-share/demux.h \ ${srcdir}/nindy-share/demux.h \
${srcdir}/nindy-share/env.h \ ${srcdir}/nindy-share/env.h \
${srcdir}/nindy-share/stop.h \ ${srcdir}/nindy-share/stop.h \
${srcdir}/nindy-share/ttycntl.h ${srcdir}/nindy-share/ttycntl.h \
${srcdir}/29k-share/include/coff.h \
${srcdir}/29k-share/include/error.h \
${srcdir}/29k-share/include/macros.h \
${srcdir}/29k-share/include/main.h \
${srcdir}/29k-share/include/memspcs.h \
${srcdir}/29k-share/include/miniint.h \
${srcdir}/29k-share/udi/udiphcfg.h \
${srcdir}/29k-share/udi/udiphsun.h \
${srcdir}/29k-share/udi/udiproc.h \
${srcdir}/29k-share/udi/udipt29k.h \
${srcdir}/29k-share/udi/udiptcfg.h \
${srcdir}/29k-share/udi/udisoc.h
# Non-source files in subdirs, that should go into gdb.tar.Z. # Non-source files in subdirs, that should go into gdb.tar.Z.
NONSRC_SUBDIR = \ NONSRC_SUBDIR = \
@ -412,6 +424,10 @@ alldeps.mak: ${srcdir}/config
-e 's!xdr_ptrace.o!vx-share/xdr_ptrace.c!' \ -e 's!xdr_ptrace.o!vx-share/xdr_ptrace.c!' \
-e 's!xdr_rdb.o!vx-share/xdr_rdb.c!' \ -e 's!xdr_rdb.o!vx-share/xdr_rdb.c!' \
-e 's!xdr_regs.o!vx-share/xdr_regs.c!' \ -e 's!xdr_regs.o!vx-share/xdr_regs.c!' \
-e 's!udr.o!29k-share/udi/udr.c!' \
-e 's!yank.o!29k-share/dfe/yank.c!' \
-e 's!udip2soc.o!29k-share/udi/udip2soc.c!' \
-e 's!mini2udi.o!29k-share/dfe/mini2udi.c!' \
-e 's/\.o/.c/' \ -e 's/\.o/.c/' \
>alldeps2.tmp >alldeps2.tmp
echo '# Start of "alldeps.mak" definitions' \ echo '# Start of "alldeps.mak" definitions' \
@ -463,6 +479,7 @@ depend: $(SOURCES) Makefile.in
-e 's; \./; $${srcdir}/;g' \ -e 's; \./; $${srcdir}/;g' \
-e 's; vx-share/; $${srcdir}/vx-share/;g' \ -e 's; vx-share/; $${srcdir}/vx-share/;g' \
-e 's; nindy-share/; $${srcdir}/nindy-share/;g' \ -e 's; nindy-share/; $${srcdir}/nindy-share/;g' \
-e 's; 29k-share/; $${srcdir}/29k-share/;g' \
>depend.tm2; \ >depend.tm2; \
rm depend.tmp; \ rm depend.tmp; \
mv depend.tm2 depend.tmp; \ mv depend.tm2 depend.tmp; \
@ -583,7 +600,10 @@ make-proto-gdb-1: ${TARFILES} ${TARDIRS} gdb.info
mkdir proto-gdb.dir/config mkdir proto-gdb.dir/config
cd proto-gdb.dir/config ; \ cd proto-gdb.dir/config ; \
for i in $(ALLCONFIG) ; do ln -s ../../$$i ../$$i ; done for i in $(ALLCONFIG) ; do ln -s ../../$$i ../$$i ; done
mkdir proto-gdb.dir/vx-share proto-gdb.dir/nindy-share mkdir proto-gdb.dir/vx-share proto-gdb.dir/nindy-share \
proto-gdb.dir/29k-share
mkdir proto-gdb.dir/29k-share/include proto-gdb.dir/29k-share/udi
mkdir proto-gdb.dir/29k-share/dfe
cd proto-gdb.dir/config ; \ cd proto-gdb.dir/config ; \
for i in $(SFILES_SUBDIR) $(NONSRC_SUBDIR) $(ALLDEPFILES_SUBDIR); \ for i in $(SFILES_SUBDIR) $(NONSRC_SUBDIR) $(ALLDEPFILES_SUBDIR); \
do ln -s ../../$$i ../$$i ; done do ln -s ../../$$i ../$$i ; done
@ -735,6 +755,18 @@ ttybreak.o: ${srcdir}/nindy-share/ttybreak.c
ttyflush.o: ${srcdir}/nindy-share/ttyflush.c ttyflush.o: ${srcdir}/nindy-share/ttyflush.c
${CC} -c ${INTERNAL_CFLAGS} ${srcdir}/nindy-share/ttyflush.c ${CC} -c ${INTERNAL_CFLAGS} ${srcdir}/nindy-share/ttyflush.c
udr.o: ${srcdir}/29k-share/udi/udr.c
${CC} -c ${INTERNAL_CFLAGS} ${srcdir}/29k-share/udi/udr.c
udip2soc.o: ${srcdir}/29k-share/udi/udip2soc.c
${CC} -c ${INTERNAL_CFLAGS} ${srcdir}/29k-share/udi/udip2soc.c
mini2udi.o: ${srcdir}/29k-share/dfe/mini2udi.c
${CC} -c ${INTERNAL_CFLAGS} ${srcdir}/29k-share/dfe/mini2udi.c
yank.o: ${srcdir}/29k-share/dfe/yank.c
${CC} -c ${INTERNAL_CFLAGS} ${srcdir}/29k-share/dfe/yank.c
lint: $(LINTFILES) lint: $(LINTFILES)
$(LINT) $(INCLUDE_CFLAGS) $(LINTFLAGS) $(LINTFILES) \ $(LINT) $(INCLUDE_CFLAGS) $(LINTFLAGS) $(LINTFILES) \
`echo ${DEPFILES} | sed 's/\.o /\.c /g' `echo ${DEPFILES} | sed 's/\.o /\.c /g'

View File

@ -48,16 +48,18 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "terminal.h" #include "terminal.h"
#include "target.h" #include "target.h"
#include "29k-share/udi/udiproc.h" #include "29k-share/udi/udiproc.h"
#include "gdbcmd.h"
/* access the register store directly, without going through /* access the register store directly, without going through
the normal handler functions. This avoids an extra data copy. */ the normal handler functions. This avoids an extra data copy. */
static int kiodebug;
extern int stop_soon_quietly; /* for wait_for_inferior */ extern int stop_soon_quietly; /* for wait_for_inferior */
extern struct value *call_function_by_hand(); extern struct value *call_function_by_hand();
static void udi_resume(); static void udi_resume();
static void udi_fetch_registers (); static void udi_fetch_registers ();
static void udi_load(); static void udi_load();
static int fetch_register (); static void fetch_register ();
static void udi_store_registers (); static void udi_store_registers ();
static int store_register (); static int store_register ();
static int regnum_to_srnum(); static int regnum_to_srnum();
@ -433,21 +435,23 @@ static void
udi_resume (step, sig) udi_resume (step, sig)
int step, sig; int step, sig;
{ {
UDIError tip_error; UDIError tip_error;
UDIUInt32 Steps = 1; UDIUInt32 Steps = 1;
UDIStepType StepType = UDIStepNatural; UDIStepType StepType = UDIStepNatural;
UDIRange Range; UDIRange Range;
if (step) /* step 1 instruction */ if (step) /* step 1 instruction */
{ tip_error = tip_error = UDIStep(Steps, StepType, Range); {
if(tip_error)fprintf(stderr, "UDIStep() error = %d\n", tip_error); tip_error = UDIStep (Steps, StepType, Range);
if(tip_error)error ("failed in udi_resume"); if (!tip_error)
return;
} fprintf (stderr, "UDIStep() error = %d\n", tip_error);
else error ("failed in udi_resume");
{ if(UDIExecute()) }
error ("UDIExecute() failed in udi_resume");
} if (UDIExecute())
error ("UDIExecute() failed in udi_resume");
} }
/******************************************************************** UDI_WAIT /******************************************************************** UDI_WAIT
@ -473,113 +477,122 @@ udi_wait (status)
*/ */
timeout = 0; /* Wait indefinetly for a message */ timeout = 0; /* Wait indefinetly for a message */
immediate_quit = 1; /* Helps ability to QUIT */ immediate_quit = 1; /* Helps ability to QUIT */
while(1) while(1)
{
i = 0;
MaxTime = UDIWaitForever;
UDIWait(MaxTime, &PId, &StopReason);
QUIT; /* Let user quit if they want */
switch (StopReason & 0xff)
{ {
default: i = 0;
goto halted; MaxTime = UDIWaitForever;
case UDIStdoutReady: UDIWait(MaxTime, &PId, &StopReason);
if(UDIGetStdout(sbuf, (UDISizeT)SBUF_MAX, &CountDone)) QUIT; /* Let user quit if they want */
error("UDIGetStdin() failed in udi_wait");
while(CountDone--)putc(sbuf[i++], stdout); switch (StopReason & UDIGrossState)
fflush(stdout); {
break; case UDIStdoutReady:
case UDIStderrReady: if (UDIGetStdout (sbuf, (UDISizeT)SBUF_MAX, &CountDone))
UDIGetStderr(sbuf, (UDISizeT)SBUF_MAX, &CountDone); error ("UDIGetStdin() failed in udi_wait");
while(CountDone--)putc(sbuf[i++], stderr); fwrite (sbuf, 1, CountDone, stdout);
fflush(stderr); fflush(stdout);
fflush(stderr); continue;
break; case UDIStderrReady:
case UDIStdinNeeded: UDIGetStderr (sbuf, (UDISizeT)SBUF_MAX, &CountDone);
printf("DEBUG: stdin requested ... continue\n"); fwrite (sbuf, 1, CountDone, stderr);
/* UDIPutStdin(sbuf, (UDISizeT)i, &CountDone); */ fflush(stderr);
break; continue;
case UDIStdinModeX: case UDIStdinNeeded:
break; printf("DEBUG: stdin requested ... continue\n");
/* UDIPutStdin(sbuf, (UDISizeT)i, &CountDone); */
continue;
case UDIStdinModeX:
continue;
default:
break;
}
break;
} }
continue;
} switch (StopReason & UDIGrossState)
halted: {
if (StopReason & 0xff == UDITrapped ) /* lower 8-bits == 0 */ case UDITrapped:
{ printf("Am290*0 received vector number %d\n", StopReason >> 24);
if (StopReason >> 24 == 0)
{ printf("Am290*0 received vector number 0 (break point)\n"); switch (StopReason >> 8)
WSETSTOP ((*status), SIGTRAP); {
} case 0: /* Illegal opcode */
else if (StopReason >> 24 == 1) printf(" (break point)\n");
{ printf("Am290*0 received vector 1\n"); WSETSTOP ((*status), SIGTRAP);
WSETSTOP ((*status), SIGBUS); break;
} case 1: /* Unaligned Access */
else if (StopReason >> 24 == 3 WSETSTOP ((*status), SIGBUS);
|| StopReason >> 24 == 4) break;
{ printf("Am290*0 received vector number %d\n", case 3:
StopReason >> 24); case 4:
WSETSTOP ((*status), SIGFPE); WSETSTOP ((*status), SIGFPE);
} break;
else if (StopReason >> 24 == 5) case 5: /* Protection Violation */
{ printf("Am290*0 received vector number %d\n", WSETSTOP ((*status), SIGILL);
StopReason >> 24); break;
WSETSTOP ((*status), SIGILL); case 6:
} case 7:
else if (StopReason >> 24 >= 6 case 8: /* User Instruction Mapping Miss */
&& StopReason >> 24 <= 11) case 9: /* User Data Mapping Miss */
{ printf("Am290*0 received vector number %d\n", case 10: /* Supervisor Instruction Mapping Miss */
StopReason >> 24); case 11: /* Supervisor Data Mapping Miss */
WSETSTOP ((*status), SIGSEGV); WSETSTOP ((*status), SIGSEGV);
} break;
else if (StopReason >> 24 == 12 case 12:
|| StopReason >> 24 == 13) case 13:
{ printf("Am290*0 received vector number %d\n", WSETSTOP ((*status), SIGILL);
StopReason >> 24); break;
WSETSTOP ((*status), SIGILL); case 14: /* Timer */
} WSETSTOP ((*status), SIGALRM);
else if ((StopReason & 0xff) == 14) break;
{ printf("Am290*0 received vector number %d\n", case 15: /* Trace */
StopReason >> 24); WSETSTOP ((*status), SIGTRAP);
WSETSTOP ((*status), SIGALRM); break;
} case 16: /* INTR0 */
else if ((StopReason & 0xff) == 15) case 17: /* INTR1 */
WSETSTOP ((*status), SIGTRAP); case 18: /* INTR2 */
else if ((StopReason >> 24) >= 16 case 19: /* INTR3/Internal */
&& (StopReason >> 24) <= 21) case 20: /* TRAP0 */
{ printf("Am290*0 received vector number %d\n", case 21: /* TRAP1 */
StopReason >> 24); WSETSTOP ((*status), SIGINT);
WSETSTOP ((*status), SIGINT); break;
} case 22: /* Floating-Point Exception */
else if ((StopReason & 0xff) == 22) WSETSTOP ((*status), SIGILL);
{ printf("Am290*0 received vector number %d\n", break;
StopReason >> 24); case 77: /* assert 77 */
WSETSTOP ((*status), SIGILL); WSETSTOP ((*status), SIGTRAP);
} break;
else if ((StopReason & 0xff) == 77) default:
WSETSTOP ((*status), SIGTRAP); WSETEXIT ((*status), 0);
else }
exit: break;
WSETEXIT ((*status), 0); case UDINotExecuting:
}
else if ((StopReason & 0xff) == UDIBreak)
WSETSTOP ((*status), SIGTRAP);
else if ((StopReason & 0xff) == UDINotExecuting)
WSETSTOP ((*status), SIGTERM); WSETSTOP ((*status), SIGTERM);
else if ((StopReason & 0xff) == UDIRunning) break;
case UDIRunning:
WSETSTOP ((*status), SIGILL); WSETSTOP ((*status), SIGILL);
else if ((StopReason & 0xff) == UDIStopped) break;
case UDIStopped:
WSETSTOP ((*status), SIGTSTP); WSETSTOP ((*status), SIGTSTP);
else if ((StopReason & 0xff) == UDIWarned) break;
case UDIWarned:
WSETSTOP ((*status), SIGLOST); WSETSTOP ((*status), SIGLOST);
else if ((StopReason & 0xff) == UDIStepped) break;
case UDIStepped:
case UDIBreak:
WSETSTOP ((*status), SIGTRAP); WSETSTOP ((*status), SIGTRAP);
else if ((StopReason & 0xff) == UDIWaiting) break;
case UDIWaiting:
WSETSTOP ((*status), SIGSTOP); WSETSTOP ((*status), SIGSTOP);
else if ((StopReason & 0xff) == UDIHalted) break;
case UDIHalted:
WSETSTOP ((*status), SIGKILL); WSETSTOP ((*status), SIGKILL);
else break;
WSETEXIT ((*status), 0); case UDIExited:
default:
WSETEXIT ((*status), 0);
}
timeout = old_timeout; /* Restore original timeout value */ timeout = old_timeout; /* Restore original timeout value */
immediate_quit = old_immediate_quit; immediate_quit = old_immediate_quit;
@ -688,6 +701,14 @@ int regno;
register_valid[i] = 1; register_valid[i] = 1;
} }
if (kiodebug)
{
printf("Fetching all registers\n");
printf("Fetching PC0 = 0x%x, PC1 = 0x%x, PC2 = 0x%x\n",
read_register(NPC_REGNUM), read_register(PC_REGNUM),
read_register(PC2_REGNUM));
}
/* There doesn't seem to be any way to get these. */ /* There doesn't seem to be any way to get these. */
{ {
int val = -1; int val = -1;
@ -721,6 +742,13 @@ int regno;
return; return;
} }
if (kiodebug)
{
printf("Storing all registers\n");
printf("PC0 = 0x%x, PC1 = 0x%x, PC2 = 0x%x\n", read_register(NPC_REGNUM),
read_register(PC_REGNUM), read_register(PC2_REGNUM));
}
/* Gr1/rsp */ /* Gr1/rsp */
From = (UDIUInt32 *)&registers[4 * GR1_REGNUM]; From = (UDIUInt32 *)&registers[4 * GR1_REGNUM];
@ -1082,7 +1110,7 @@ int num;
/* Fetch a single register indicatated by 'regno'. /* Fetch a single register indicatated by 'regno'.
* Returns 0/-1 on success/failure. * Returns 0/-1 on success/failure.
*/ */
static int static void
fetch_register (regno) fetch_register (regno)
int regno; int regno;
{ {
@ -1124,7 +1152,7 @@ fetch_register (regno)
{ {
int val = -1; int val = -1;
supply_register(160 + (regno - FPE_REGNUM),(char *) &val); supply_register(160 + (regno - FPE_REGNUM),(char *) &val);
return 0; /* Pretend Success */ return; /* Pretend Success */
} }
else else
{ {
@ -1136,7 +1164,9 @@ fetch_register (regno)
error("UDIRead() failed in udi_fetch_registers"); error("UDIRead() failed in udi_fetch_registers");
supply_register(regno, (char *) &To); supply_register(regno, (char *) &To);
return result;
if (kiodebug)
printf("Fetching register %s = 0x%x\n", reg_names[regno], To);
} }
/*****************************************************************************/ /*****************************************************************************/
/* Store a single register indicated by 'regno'. /* Store a single register indicated by 'regno'.
@ -1156,6 +1186,9 @@ store_register (regno)
From = read_register (regno); /* get data value */ From = read_register (regno); /* get data value */
if (kiodebug)
printf("Storing register %s = 0x%x\n", reg_names[regno], From);
if (regno == GR1_REGNUM) if (regno == GR1_REGNUM)
{ To.Space = UDI29KGlobalRegs; { To.Space = UDI29KGlobalRegs;
To.Offset = 1; To.Offset = 1;
@ -1281,31 +1314,55 @@ int QuietMode = 0; /* used for debugging */
* Define the target subroutine names * Define the target subroutine names
*/ */
static struct target_ops udi_ops = { static struct target_ops udi_ops = {
"udi", "Remote UDI connected TIP", "udi",
"Remote UDI connected TIP",
"Remote debug an AMD 29k using UDI socket connection to TIP process", "Remote debug an AMD 29k using UDI socket connection to TIP process",
udi_open, udi_close, udi_open,
udi_attach, udi_detach, udi_resume, udi_wait, udi_close,
udi_fetch_registers, udi_store_registers, udi_attach,
udi_detach,
udi_resume,
udi_wait,
udi_fetch_registers,
udi_store_registers,
udi_prepare_to_store, udi_prepare_to_store,
udi_xfer_inferior_memory, udi_xfer_inferior_memory,
udi_files_info, udi_files_info,
udi_insert_breakpoint, udi_remove_breakpoint, /* Breakpoints */ udi_insert_breakpoint,
0, 0, 0, 0, 0, /* Terminal handling */ udi_remove_breakpoint,
0, /* termial_init */
0, /* terminal_inferior */
0, /* terminal_ours_for_output */
0, /* terminal_ours */
0, /* terminal_info */
udi_kill, /* FIXME, kill */ udi_kill, /* FIXME, kill */
udi_load, udi_load,
0, /* lookup_symbol */ 0, /* lookup_symbol */
udi_create_inferior, /* create_inferior */ udi_create_inferior,
udi_mourn, /* mourn_inferior FIXME */ udi_mourn, /* mourn_inferior FIXME */
0, /* can_run */ 0, /* can_run */
process_stratum, 0, /* next */ process_stratum,
1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */ 0, /* next */
0, 0, /* Section pointers */ 1, /* has_all_memory */
1, /* has_memory */
1, /* has_stack */
1, /* has_registers */
1, /* has_execution */
0, /* sections */
0, /* sections_end */
OPS_MAGIC, /* Always the last thing */ OPS_MAGIC, /* Always the last thing */
}; };
void _initialize_remote_udi() void _initialize_remote_udi()
{ {
add_target (&udi_ops); add_target (&udi_ops);
add_show_from_set (
add_set_cmd ("remotedebug", no_class, var_boolean,
(char *)&kiodebug,
"Set debugging of UDI I/O.\n\
When enabled, debugging info is displayed.",
&setlist),
&showlist);
} }
#ifdef NO_HIF_SUPPORT #ifdef NO_HIF_SUPPORT

View File

@ -603,7 +603,7 @@ extern CORE_ADDR frame_locals_address ();
+ DUMMY_SAVE_SR160 * 4 \ + DUMMY_SAVE_SR160 * 4 \
+ DUMMY_SAVE_SR128 * 4 \ + DUMMY_SAVE_SR128 * 4 \
+ DUMMY_ARG \ + DUMMY_ARG \
) + 4 /* pad to doubleword */ )
/* Push an empty stack frame, to record the current PC, etc. */ /* Push an empty stack frame, to record the current PC, etc. */