* 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)
* 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_DEPS = ${REGEX1} ${ALLOCA1} ${XM_ADD_FILES} ${TM_ADD_FILES} ${NAT_ADD_FILES}
VERSION = 4.6.6
VERSION = 4.6.7
DIST=gdb
LINT=/usr/5bin/lint
@ -223,7 +223,19 @@ SFILES_SUBDIR = \
${srcdir}/nindy-share/demux.h \
${srcdir}/nindy-share/env.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.
NONSRC_SUBDIR = \
@ -412,6 +424,10 @@ alldeps.mak: ${srcdir}/config
-e 's!xdr_ptrace.o!vx-share/xdr_ptrace.c!' \
-e 's!xdr_rdb.o!vx-share/xdr_rdb.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/' \
>alldeps2.tmp
echo '# Start of "alldeps.mak" definitions' \
@ -463,6 +479,7 @@ depend: $(SOURCES) Makefile.in
-e 's; \./; $${srcdir}/;g' \
-e 's; vx-share/; $${srcdir}/vx-share/;g' \
-e 's; nindy-share/; $${srcdir}/nindy-share/;g' \
-e 's; 29k-share/; $${srcdir}/29k-share/;g' \
>depend.tm2; \
rm depend.tmp; \
mv depend.tm2 depend.tmp; \
@ -583,7 +600,10 @@ make-proto-gdb-1: ${TARFILES} ${TARDIRS} gdb.info
mkdir proto-gdb.dir/config
cd proto-gdb.dir/config ; \
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 ; \
for i in $(SFILES_SUBDIR) $(NONSRC_SUBDIR) $(ALLDEPFILES_SUBDIR); \
do ln -s ../../$$i ../$$i ; done
@ -735,6 +755,18 @@ ttybreak.o: ${srcdir}/nindy-share/ttybreak.c
ttyflush.o: ${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) $(INCLUDE_CFLAGS) $(LINTFLAGS) $(LINTFILES) \
`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 "target.h"
#include "29k-share/udi/udiproc.h"
#include "gdbcmd.h"
/* access the register store directly, without going through
the normal handler functions. This avoids an extra data copy. */
static int kiodebug;
extern int stop_soon_quietly; /* for wait_for_inferior */
extern struct value *call_function_by_hand();
static void udi_resume();
static void udi_fetch_registers ();
static void udi_load();
static int fetch_register ();
static void fetch_register ();
static void udi_store_registers ();
static int store_register ();
static int regnum_to_srnum();
@ -439,16 +441,18 @@ udi_resume (step, sig)
UDIRange Range;
if (step) /* step 1 instruction */
{ tip_error = tip_error = UDIStep(Steps, StepType, Range);
if(tip_error)fprintf(stderr, "UDIStep() error = %d\n", tip_error);
if(tip_error)error ("failed in udi_resume");
{
tip_error = UDIStep (Steps, StepType, Range);
if (!tip_error)
return;
fprintf (stderr, "UDIStep() error = %d\n", tip_error);
error ("failed in udi_resume");
}
else
{ if(UDIExecute())
if (UDIExecute())
error ("UDIExecute() failed in udi_resume");
}
}
/******************************************************************** UDI_WAIT
** Wait until the remote machine stops, then return,
@ -473,113 +477,122 @@ udi_wait (status)
*/
timeout = 0; /* Wait indefinetly for a message */
immediate_quit = 1; /* Helps ability to QUIT */
while(1)
{
i = 0;
MaxTime = UDIWaitForever;
UDIWait(MaxTime, &PId, &StopReason);
QUIT; /* Let user quit if they want */
switch (StopReason & 0xff)
switch (StopReason & UDIGrossState)
{
default:
goto halted;
case UDIStdoutReady:
if (UDIGetStdout (sbuf, (UDISizeT)SBUF_MAX, &CountDone))
error ("UDIGetStdin() failed in udi_wait");
while(CountDone--)putc(sbuf[i++], stdout);
fwrite (sbuf, 1, CountDone, stdout);
fflush(stdout);
break;
continue;
case UDIStderrReady:
UDIGetStderr (sbuf, (UDISizeT)SBUF_MAX, &CountDone);
while(CountDone--)putc(sbuf[i++], stderr);
fwrite (sbuf, 1, CountDone, stderr);
fflush(stderr);
fflush(stderr);
break;
continue;
case UDIStdinNeeded:
printf("DEBUG: stdin requested ... continue\n");
/* UDIPutStdin(sbuf, (UDISizeT)i, &CountDone); */
break;
case UDIStdinModeX:
break;
}
continue;
case UDIStdinModeX:
continue;
default:
break;
}
halted:
if (StopReason & 0xff == UDITrapped ) /* lower 8-bits == 0 */
break;
}
switch (StopReason & UDIGrossState)
{
if (StopReason >> 24 == 0)
{ printf("Am290*0 received vector number 0 (break point)\n");
case UDITrapped:
printf("Am290*0 received vector number %d\n", StopReason >> 24);
switch (StopReason >> 8)
{
case 0: /* Illegal opcode */
printf(" (break point)\n");
WSETSTOP ((*status), SIGTRAP);
}
else if (StopReason >> 24 == 1)
{ printf("Am290*0 received vector 1\n");
break;
case 1: /* Unaligned Access */
WSETSTOP ((*status), SIGBUS);
}
else if (StopReason >> 24 == 3
|| StopReason >> 24 == 4)
{ printf("Am290*0 received vector number %d\n",
StopReason >> 24);
break;
case 3:
case 4:
WSETSTOP ((*status), SIGFPE);
}
else if (StopReason >> 24 == 5)
{ printf("Am290*0 received vector number %d\n",
StopReason >> 24);
break;
case 5: /* Protection Violation */
WSETSTOP ((*status), SIGILL);
}
else if (StopReason >> 24 >= 6
&& StopReason >> 24 <= 11)
{ printf("Am290*0 received vector number %d\n",
StopReason >> 24);
break;
case 6:
case 7:
case 8: /* User Instruction Mapping Miss */
case 9: /* User Data Mapping Miss */
case 10: /* Supervisor Instruction Mapping Miss */
case 11: /* Supervisor Data Mapping Miss */
WSETSTOP ((*status), SIGSEGV);
}
else if (StopReason >> 24 == 12
|| StopReason >> 24 == 13)
{ printf("Am290*0 received vector number %d\n",
StopReason >> 24);
break;
case 12:
case 13:
WSETSTOP ((*status), SIGILL);
}
else if ((StopReason & 0xff) == 14)
{ printf("Am290*0 received vector number %d\n",
StopReason >> 24);
break;
case 14: /* Timer */
WSETSTOP ((*status), SIGALRM);
}
else if ((StopReason & 0xff) == 15)
break;
case 15: /* Trace */
WSETSTOP ((*status), SIGTRAP);
else if ((StopReason >> 24) >= 16
&& (StopReason >> 24) <= 21)
{ printf("Am290*0 received vector number %d\n",
StopReason >> 24);
break;
case 16: /* INTR0 */
case 17: /* INTR1 */
case 18: /* INTR2 */
case 19: /* INTR3/Internal */
case 20: /* TRAP0 */
case 21: /* TRAP1 */
WSETSTOP ((*status), SIGINT);
}
else if ((StopReason & 0xff) == 22)
{ printf("Am290*0 received vector number %d\n",
StopReason >> 24);
break;
case 22: /* Floating-Point Exception */
WSETSTOP ((*status), SIGILL);
}
else if ((StopReason & 0xff) == 77)
break;
case 77: /* assert 77 */
WSETSTOP ((*status), SIGTRAP);
else
exit:
break;
default:
WSETEXIT ((*status), 0);
}
else if ((StopReason & 0xff) == UDIBreak)
WSETSTOP ((*status), SIGTRAP);
else if ((StopReason & 0xff) == UDINotExecuting)
break;
case UDINotExecuting:
WSETSTOP ((*status), SIGTERM);
else if ((StopReason & 0xff) == UDIRunning)
break;
case UDIRunning:
WSETSTOP ((*status), SIGILL);
else if ((StopReason & 0xff) == UDIStopped)
break;
case UDIStopped:
WSETSTOP ((*status), SIGTSTP);
else if ((StopReason & 0xff) == UDIWarned)
break;
case UDIWarned:
WSETSTOP ((*status), SIGLOST);
else if ((StopReason & 0xff) == UDIStepped)
break;
case UDIStepped:
case UDIBreak:
WSETSTOP ((*status), SIGTRAP);
else if ((StopReason & 0xff) == UDIWaiting)
break;
case UDIWaiting:
WSETSTOP ((*status), SIGSTOP);
else if ((StopReason & 0xff) == UDIHalted)
break;
case UDIHalted:
WSETSTOP ((*status), SIGKILL);
else
break;
case UDIExited:
default:
WSETEXIT ((*status), 0);
}
timeout = old_timeout; /* Restore original timeout value */
immediate_quit = old_immediate_quit;
@ -688,6 +701,14 @@ int regno;
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. */
{
int val = -1;
@ -721,6 +742,13 @@ int regno;
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 */
From = (UDIUInt32 *)&registers[4 * GR1_REGNUM];
@ -1082,7 +1110,7 @@ int num;
/* Fetch a single register indicatated by 'regno'.
* Returns 0/-1 on success/failure.
*/
static int
static void
fetch_register (regno)
int regno;
{
@ -1124,7 +1152,7 @@ fetch_register (regno)
{
int val = -1;
supply_register(160 + (regno - FPE_REGNUM),(char *) &val);
return 0; /* Pretend Success */
return; /* Pretend Success */
}
else
{
@ -1136,7 +1164,9 @@ fetch_register (regno)
error("UDIRead() failed in udi_fetch_registers");
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'.
@ -1156,6 +1186,9 @@ store_register (regno)
From = read_register (regno); /* get data value */
if (kiodebug)
printf("Storing register %s = 0x%x\n", reg_names[regno], From);
if (regno == GR1_REGNUM)
{ To.Space = UDI29KGlobalRegs;
To.Offset = 1;
@ -1281,31 +1314,55 @@ int QuietMode = 0; /* used for debugging */
* Define the target subroutine names
*/
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",
udi_open, udi_close,
udi_attach, udi_detach, udi_resume, udi_wait,
udi_fetch_registers, udi_store_registers,
udi_open,
udi_close,
udi_attach,
udi_detach,
udi_resume,
udi_wait,
udi_fetch_registers,
udi_store_registers,
udi_prepare_to_store,
udi_xfer_inferior_memory,
udi_files_info,
udi_insert_breakpoint, udi_remove_breakpoint, /* Breakpoints */
0, 0, 0, 0, 0, /* Terminal handling */
udi_insert_breakpoint,
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_load,
0, /* lookup_symbol */
udi_create_inferior, /* create_inferior */
udi_create_inferior,
udi_mourn, /* mourn_inferior FIXME */
0, /* can_run */
process_stratum, 0, /* next */
1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
0, 0, /* Section pointers */
process_stratum,
0, /* next */
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 */
};
void _initialize_remote_udi()
{
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

View File

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