* configure.in: Add nlm subdir to configdirs for alpha-*-netware

target.
	* defs.h (enum language):  Add language_asm.
	* findvar.c (read_register_bytes read_register_gen
	write_register_bytes read_register read_register_pid
	write_register write_register_pid supply_register):  Move multi-
	thread handling down into these routines.  Create XXX_pid routines
	that allow register references to specify the pid.
	* findvar.c infcmd.c (read_pc read_pc_pid write_pc write_pc_pid
	read_sp write_sp read_fp write_fp):  Move these routines from
	infcmd to findvar to centralize the whole mess.
	* i386-nlmstub.c:  Portability fixes.
	* infptrace.c (child_resume):  Conditionalize to allow other natives
	to override it.  Remove PIDGET gubbish, it's no longer necessary.
	* infrun.c (wait_for_inferior):  Put registers_changed() before
	target_wait() to speed up remote debugging.
	* Replace code that reads registers from other threads with much
	nicer looking new function calls (see changes to findvar.c).
	* Don't skip prologues if debugging assembly source.
	* lynx-nat.c (child_resume):  Lynx now needs it's own version of
	child_resume to handle multi-thread debugging properly.
	* remote.c:  Add O response to get console output from target.
	* (readchar): Add timeout parameter.  Handle SERIAL_EOF and
	SERIAL_ERROR here to simplify callers.
	* Change static var timeout to remote_timeout.
	* (fromhex):  Remove unnecessary return -1 at end of routine.
	* (remote_wait):  Turn this into a big switch statement.  Add
	support for O response.
	* (putpkt):  Remove unnecessary handling of SERIAL_EOF/ERROR.
	* (getpkt):  Split getpkt into two parts.  read_frame deals with
	all formatting issues, run-length encoding, and framing.  getpkt
	now handles error recovery, and frame detection.
	* ser-tcp.c (tcp_readchar):  Handle EINTR from read().
	* ser-unix.c (hardwire_raw):  Set CLOCAL so that we ignore modem
	control.  (hardwire_readchar):  Handle EINTR from read().
	* symfile.c (deduce_language_from_filename):  Add support for .s
	files.
	* config/nm-lynx.h:  Define CHILD_WAIT so that lynx-nat.c can
	override infptrace's child_wait.
	* config/rs6000/rs6000lynx.mh:  Use xm-rs6000ly.h & nm-rs6000ly.h
	instead of XXXlynx.h.
	* config/rs6000/rs6000lynx.mt:  Use tm-rs6000ly.h instead of
	tm-rs6000lynx.h.
	* nlm/gdbserve.c:  Portability fixes.
This commit is contained in:
Stu Grossman 1994-06-02 16:58:48 +00:00
parent 314628f66c
commit 2e6784a89f
8 changed files with 197 additions and 54 deletions

View File

@ -1,3 +1,50 @@
Thu Jun 2 08:50:00 1994 Stu Grossman (grossman@cygnus.com)
* configure.in: Add nlm subdir to configdirs for alpha-*-netware
target.
* defs.h (enum language): Add language_asm.
* findvar.c (read_register_bytes read_register_gen
write_register_bytes read_register read_register_pid
write_register write_register_pid supply_register): Move multi-
thread handling down into these routines. Create XXX_pid routines
that allow register references to specify the pid.
* findvar.c infcmd.c (read_pc read_pc_pid write_pc write_pc_pid
read_sp write_sp read_fp write_fp): Move these routines from
infcmd to findvar to centralize the whole mess.
* i386-nlmstub.c: Portability fixes.
* infptrace.c (child_resume): Conditionalize to allow other natives
to override it. Remove PIDGET gubbish, it's no longer necessary.
* infrun.c (wait_for_inferior): Put registers_changed() before
target_wait() to speed up remote debugging.
* Replace code that reads registers from other threads with much
nicer looking new function calls (see changes to findvar.c).
* Don't skip prologues if debugging assembly source.
* lynx-nat.c (child_resume): Lynx now needs it's own version of
child_resume to handle multi-thread debugging properly.
* remote.c: Add O response to get console output from target.
* (readchar): Add timeout parameter. Handle SERIAL_EOF and
SERIAL_ERROR here to simplify callers.
* Change static var timeout to remote_timeout.
* (fromhex): Remove unnecessary return -1 at end of routine.
* (remote_wait): Turn this into a big switch statement. Add
support for O response.
* (putpkt): Remove unnecessary handling of SERIAL_EOF/ERROR.
* (getpkt): Split getpkt into two parts. read_frame deals with
all formatting issues, run-length encoding, and framing. getpkt
now handles error recovery, and frame detection.
* ser-tcp.c (tcp_readchar): Handle EINTR from read().
* ser-unix.c (hardwire_raw): Set CLOCAL so that we ignore modem
control. (hardwire_readchar): Handle EINTR from read().
* symfile.c (deduce_language_from_filename): Add support for .s
files.
* config/nm-lynx.h: Define CHILD_WAIT so that lynx-nat.c can
override infptrace's child_wait.
* config/rs6000/rs6000lynx.mh: Use xm-rs6000ly.h & nm-rs6000ly.h
instead of XXXlynx.h.
* config/rs6000/rs6000lynx.mt: Use tm-rs6000ly.h instead of
tm-rs6000lynx.h.
* nlm/gdbserve.c: Portability fixes.
Tue May 31 20:35:44 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
* inftarg.c (child_wait): Call proc_wait, not wait.

View File

@ -176,8 +176,9 @@ a29k-*-sym1*) gdb_target=ultra3 ;;
a29k-*-udi*) gdb_target=a29k-udi ;;
alpha-*-osf*) gdb_target=alpha-osf1 ;;
alpha-*-netware*) gdb_target=alpha-nw ;;
alpha-*-netware*) gdb_target=alpha-nw
configdirs="${configdirs} nlm"
;;
arm-*-*) gdb_target=arm ;;
c1-*-*) gdb_target=convex ;;

View File

@ -147,10 +147,20 @@ static const char hexchars[] = "0123456789abcdef";
#define NUM_REGS 16 /* Number of machine registers */
#define REGISTER_BYTES (NUM_REGS * 4) /* Total size of registers array */
#define ExceptionPC ExceptionEIP
#define DECR_PC_AFTER_BREAK 1 /* int 3 leaves PC pointing after insn */
#define BREAKPOINT {0xcc}
#define StackFrame T_TSS_StackFrame
unsigned char breakpoint_insn[] = BREAKPOINT;
#define BREAKPOINT_SIZE (sizeof breakpoint_insn)
static void flush_i_cache() {}
static char *mem2hex (void *mem, char *buf, int count, int may_fault);
static char *hex2mem (char *buf, void *mem, int count, int may_fault);
static void set_step_traps (struct StackFrame *);
static void clear_step_traps (struct StackFrame *);
#if 0
__main() {};
@ -205,14 +215,14 @@ putDebugChar (c)
static void
frame_to_registers (frame, regs)
T_TSS_StackFrame *frame;
struct StackFrame *frame;
char *regs;
{
/* Copy EAX -> EDI */
mem2hex (&frame->ExceptionEAX, &regs[0 * 4 * 2], 4 * 8, 0);
/* Copy EIP & PS */
mem2hex (&frame->ExceptionEIP, &regs[8 * 4 * 2], 4 * 2, 0);
mem2hex (&frame->ExceptionPC, &regs[8 * 4 * 2], 4 * 2, 0);
/* Copy CS, SS, DS */
mem2hex (&frame->ExceptionCS, &regs[10 * 4 * 2], 4 * 3, 0);
@ -229,13 +239,13 @@ frame_to_registers (frame, regs)
static void
registers_to_frame (regs, frame)
char *regs;
T_TSS_StackFrame *frame;
struct StackFrame *frame;
{
/* Copy EAX -> EDI */
hex2mem (&regs[0 * 4 * 2], &frame->ExceptionEAX, 4 * 8, 0);
/* Copy EIP & PS */
hex2mem (&regs[8 * 4 * 2], &frame->ExceptionEIP, 4 * 2, 0);
hex2mem (&regs[8 * 4 * 2], &frame->ExceptionPC, 4 * 2, 0);
/* Copy CS, SS, DS */
hex2mem (&regs[10 * 4 * 2], &frame->ExceptionCS, 4 * 3, 0);
@ -566,10 +576,24 @@ hexToInt(ptr, intValue)
return (numChars);
}
static void
set_step_traps (frame)
struct StackFrame *frame;
{
frame->ExceptionSystemFlags |= 0x100;
}
static void
clear_step_traps (frame)
struct StackFrame *frame;
{
frame->ExceptionSystemFlags &= ~0x100;
}
static void
do_status (ptr, frame)
char *ptr;
struct T_TSS_StackFrame *frame;
struct StackFrame *frame;
{
int sigval;
@ -579,7 +603,7 @@ do_status (ptr, frame)
ptr += 3;
sprintf (ptr, "%02x:", PC_REGNUM);
ptr = mem2hex (&frame->ExceptionEIP, ptr + 3, 4, 0);
ptr = mem2hex (&frame->ExceptionPC, ptr + 3, 4, 0);
*ptr++ = ';';
sprintf (ptr, "%02x:", SP_REGNUM);
@ -599,12 +623,12 @@ do_status (ptr, frame)
static LONG
handle_exception (frame)
T_TSS_StackFrame *frame;
struct StackFrame *frame;
{
int addr, length;
char *ptr;
static struct DBG_LoadDefinitionStructure *ldinfo = 0;
static LONG first_insn; /* The first instruction in the program. */
static unsigned char first_insn[BREAKPOINT_SIZE]; /* The first instruction in the program. */
/* Apparently the bell can sometimes be ringing at this point, and
should be stopped. */
@ -616,7 +640,7 @@ handle_exception (frame)
frame->ExceptionNumber,
frame->ExceptionDescription,
frame->ExceptionSystemFlags,
frame->ExceptionEIP,
frame->ExceptionPC,
GetThreadID ());
}
@ -629,8 +653,10 @@ handle_exception (frame)
ldinfo = ((struct DBG_LoadDefinitionStructure *)
frame->ExceptionErrorCode);
first_insn = *(unsigned char *)ldinfo->LDInitializationProcedure;
*(unsigned char *)ldinfo->LDInitializationProcedure = 0xcc;
memcpy (first_insn, ldinfo->LDInitializationProcedure,
BREAKPOINT_SIZE);
memcpy (ldinfo->LDInitializationProcedure, breakpoint_insn,
BREAKPOINT_SIZE);
flush_i_cache ();
return RETURN_TO_PROGRAM;
@ -642,11 +668,13 @@ handle_exception (frame)
case 3: /* Breakpoint */
/* After we've reached the initial breakpoint, reset it. */
if (frame->ExceptionEIP - 1 == (long) ldinfo->LDInitializationProcedure
&& *(unsigned char *) ldinfo->LDInitializationProcedure == 0xcc)
if (frame->ExceptionPC - DECR_PC_AFTER_BREAK == (LONG) ldinfo->LDInitializationProcedure
&& memcmp (ldinfo->LDInitializationProcedure, breakpoint_insn,
BREAKPOINT_SIZE) == 0)
{
*(unsigned char *) ldinfo->LDInitializationProcedure = first_insn;
frame->ExceptionEIP -= 1;
memcpy (ldinfo->LDInitializationProcedure, first_insn,
BREAKPOINT_SIZE);
frame->ExceptionPC -= DECR_PC_AFTER_BREAK;
flush_i_cache ();
}
/* Normal breakpoints end up here */
@ -670,16 +698,16 @@ handle_exception (frame)
instruction pointer is near set_char or get_char, then we caused
the fault ourselves accessing an illegal memory location. */
if (mem_may_fault
&& ((frame->ExceptionEIP >= (long) &set_char
&& frame->ExceptionEIP < (long) &set_char + 50)
|| (frame->ExceptionEIP >= (long) &get_char
&& frame->ExceptionEIP < (long) &get_char + 50)))
&& ((frame->ExceptionPC >= (long) &set_char
&& frame->ExceptionPC < (long) &set_char + 50)
|| (frame->ExceptionPC >= (long) &get_char
&& frame->ExceptionPC < (long) &get_char + 50)))
{
mem_err = 1;
/* Point the instruction pointer at an assembly language stub
which just returns from the function. */
frame->ExceptionEIP = (long) &just_return;
frame->ExceptionPC = (long) &just_return;
/* Keep going. This will act as though it returned from
set_char or get_char. The calling routine will check
@ -701,6 +729,8 @@ handle_exception (frame)
the range of the module we are debugging, but that doesn't help
much since an error could occur in a library routine. */
clear_step_traps (frame);
if (! putpacket(remcomOutBuffer))
return RETURN_TO_NEXT_DEBUGGER;
@ -803,12 +833,8 @@ handle_exception (frame)
while (1);
}
/* clear the trace bit */
frame->ExceptionSystemFlags &= ~0x100;
/* set the trace bit if we're stepping */
if (remcomInBuffer[0] == 's')
frame->ExceptionSystemFlags |= 0x100;
set_step_traps (frame);
flush_i_cache ();
return RETURN_TO_PROGRAM;

View File

@ -652,6 +652,44 @@ child_wait (pid, ourstatus)
}
}
/* Resume execution of the inferior process.
If STEP is nonzero, single-step it.
If SIGNAL is nonzero, give it that signal. */
void
child_resume (pid, step, signal)
int pid;
int step;
enum target_signal signal;
{
errno = 0;
if (pid == -1)
/* Resume all threads. */
/* I think this only gets used in the non-threaded case, where "resume
all threads" and "resume inferior_pid" are the same. */
pid = inferior_pid;
/* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where
it was. (If GDB wanted it to start some other way, we have already
written a new PC value to the child.)
If this system does not support PT_STEP, a higher level function will
have called single_step() to transmute the step request into a
continue request (by setting breakpoints on all possible successor
instructions), so we don't have to worry about that here. */
if (step)
ptrace (PTRACE_SINGLESTEP_ONE, pid, (PTRACE_ARG3_TYPE) 1,
target_signal_to_host (signal));
else
ptrace (PTRACE_CONT_ONE, pid, (PTRACE_ARG3_TYPE) 1,
target_signal_to_host (signal));
if (errno)
perror_with_name ("ptrace");
}
/* Convert a Lynx process ID to a string. Returns the string in a static
buffer. */

View File

@ -151,10 +151,19 @@ static const char hexchars[] = "0123456789abcdef";
#define NUM_REGS 66 /* Number of machine registers */
#define REGISTER_BYTES (NUM_REGS * 8) /* Total size of registers array */
#define ExceptionPC ExceptionRegs[SF_REG_PC].lo
#define DECR_PC_AFTER_BREAK 0 /* NT's Palcode gets this right! */
#define BREAKPOINT {0x80, 0, 0, 0} /* call_pal bpt */
unsigned char breakpoint_insn[] = BREAKPOINT;
#define BREAKPOINT_SIZE (sizeof breakpoint_insn)
/*#define flush_i_cache() asm("call_pal 0x86")*/
static char *mem2hex (void *mem, char *buf, int count, int may_fault);
static char *hex2mem (char *buf, void *mem, int count, int may_fault);
static void set_step_traps (struct StackFrame *);
static void clear_step_traps (struct StackFrame *);
#if 0
__main() {};
@ -212,7 +221,7 @@ frame_to_registers (frame, regs)
struct StackFrame *frame;
char *regs;
{
mem2hex (&frame->ExceptionRegs[SF_REG_PC], &regs[PC_REGNUM * 8 * 2], 8 * 1, 0);
mem2hex (&frame->ExceptionPC, &regs[PC_REGNUM * 8 * 2], 8 * 1, 0);
mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET], &regs[V0_REGNUM * 8 * 2], 8 * 64, 0);
}
@ -224,7 +233,7 @@ registers_to_frame (regs, frame)
char *regs;
struct StackFrame *frame;
{
hex2mem (&regs[PC_REGNUM * 8 * 2], &frame->ExceptionRegs[SF_REG_PC], 8 * 1, 0);
hex2mem (&regs[PC_REGNUM * 8 * 2], &frame->ExceptionPC, 8 * 1, 0);
hex2mem (&regs[V0_REGNUM * 8 * 2], &frame->ExceptionRegs[SF_IREG_OFFSET], 8 * 64, 0);
}
@ -581,14 +590,14 @@ static LONG saved_target_inst;
static LONG *saved_target_inst_pc = 0;
static void
set_step_breakpoint (pc, frame)
LONG *pc;
set_step_traps (frame)
struct StackFrame *frame;
{
union inst inst;
LONG *target;
int opcode;
int ra, rb;
LONG *pc = (LONG *)frame->ExceptionPC;
inst.l = *pc++;
@ -620,10 +629,11 @@ set_step_breakpoint (pc, frame)
set. */
static int
clear_step_breakpoint (pc)
LONG *pc;
clear_step_traps (frame)
struct StackFrame *frame;
{
int retcode;
LONG *pc = (LONG *)frame->ExceptionPC;
if (saved_inst_pc == pc || saved_target_inst_pc == pc)
retcode = 1;
@ -658,7 +668,7 @@ do_status (ptr, frame)
ptr += 3;
sprintf (ptr, "%02x:", PC_REGNUM);
ptr = mem2hex (&frame->ExceptionRegs[SF_REG_PC], ptr + 3, 8, 0);
ptr = mem2hex (&frame->ExceptionPC, ptr + 3, 8, 0);
*ptr++ = ';';
sprintf (ptr, "%02x:", SP_REGNUM);
@ -687,7 +697,7 @@ handle_exception (frame)
int addr, length;
char *ptr;
static struct DBG_LoadDefinitionStructure *ldinfo = 0;
static LONG first_insn; /* The first instruction in the program. */
static unsigned char first_insn[BREAKPOINT_SIZE]; /* The first instruction in the program. */
/* Apparently the bell can sometimes be ringing at this point, and
should be stopped. */
@ -698,7 +708,7 @@ handle_exception (frame)
ConsolePrintf ("vector=%d: %s, pc=%08x, thread=%08x\r\n",
frame->ExceptionNumber,
frame->ExceptionDescription,
frame->ExceptionRegs[SF_REG_PC].lo,
frame->ExceptionPC,
GetThreadID ());
}
@ -711,8 +721,10 @@ handle_exception (frame)
ldinfo = ((struct DBG_LoadDefinitionStructure *)
frame->ExceptionErrorCode);
first_insn = *(LONG *)ldinfo->LDInitializationProcedure;
*(LONG *)ldinfo->LDInitializationProcedure = 0x80; /* call_pal bpt */
memcpy (first_insn, ldinfo->LDInitializationProcedure,
BREAKPOINT_SIZE);
memcpy (ldinfo->LDInitializationProcedure, breakpoint_insn,
BREAKPOINT_SIZE);
flush_i_cache ();
return RETURN_TO_PROGRAM;
@ -724,10 +736,13 @@ handle_exception (frame)
case 3: /* Breakpoint */
/* After we've reached the initial breakpoint, reset it. */
if (frame->ExceptionRegs[SF_REG_PC].lo == (LONG) ldinfo->LDInitializationProcedure
&& *(LONG *) ldinfo->LDInitializationProcedure == 0x80)
if (frame->ExceptionPC - DECR_PC_AFTER_BREAK == (LONG) ldinfo->LDInitializationProcedure
&& memcmp (ldinfo->LDInitializationProcedure, breakpoint_insn,
BREAKPOINT_SIZE) == 0)
{
*(LONG *) ldinfo->LDInitializationProcedure = first_insn;
memcpy (ldinfo->LDInitializationProcedure, first_insn,
BREAKPOINT_SIZE);
frame->ExceptionPC -= DECR_PC_AFTER_BREAK;
flush_i_cache ();
}
/* Normal breakpoints end up here */
@ -751,16 +766,16 @@ handle_exception (frame)
instruction pointer is near set_char or get_char, then we caused
the fault ourselves accessing an illegal memory location. */
if (mem_may_fault
&& ((frame->ExceptionRegs[SF_REG_PC].lo >= (long) &set_char
&& frame->ExceptionRegs[SF_REG_PC].lo < (long) &set_char + 50)
|| (frame->ExceptionRegs[SF_REG_PC].lo >= (long) &get_char
&& frame->ExceptionRegs[SF_REG_PC].lo < (long) &get_char + 50)))
&& ((frame->ExceptionPC >= (long) &set_char
&& frame->ExceptionPC < (long) &set_char + 50)
|| (frame->ExceptionPC >= (long) &get_char
&& frame->ExceptionPC < (long) &get_char + 50)))
{
mem_err = 1;
/* Point the instruction pointer at an assembly language stub
which just returns from the function. */
frame->ExceptionRegs[SF_REG_PC].lo += 4; /* Skip the load or store */
frame->ExceptionPC += 4; /* Skip the load or store */
/* Keep going. This will act as though it returned from
set_char or get_char. The calling routine will check
@ -782,7 +797,7 @@ handle_exception (frame)
the range of the module we are debugging, but that doesn't help
much since an error could occur in a library routine. */
clear_step_breakpoint (frame->ExceptionRegs[SF_REG_PC]);
clear_step_traps (frame);
if (! putpacket(remcomOutBuffer))
return RETURN_TO_NEXT_DEBUGGER;
@ -887,7 +902,7 @@ handle_exception (frame)
}
if (remcomInBuffer[0] == 's')
set_step_breakpoint (frame->ExceptionRegs[SF_REG_PC].lo);
set_step_traps (frame);
flush_i_cache ();
return RETURN_TO_PROGRAM;

View File

@ -218,7 +218,12 @@ tcp_readchar(scb, timeout)
if (status < 0)
return status;
scb->bufcnt = read(scb->fd, scb->buf, BUFSIZ);
while (1)
{
scb->bufcnt = read(scb->fd, scb->buf, BUFSIZ);
if (scb->bufcnt != -1 || errno != EINTR)
break;
}
if (scb->bufcnt <= 0)
if (scb->bufcnt == 0)

View File

@ -353,7 +353,7 @@ hardwire_raw(scb)
state.termios.c_oflag = 0;
state.termios.c_lflag = 0;
state.termios.c_cflag &= ~(CSIZE|PARENB);
state.termios.c_cflag |= CS8;
state.termios.c_cflag |= CLOCAL | CS8;
state.termios.c_cc[VMIN] = 0;
state.termios.c_cc[VTIME] = 0;
#endif
@ -363,7 +363,7 @@ hardwire_raw(scb)
state.termio.c_oflag = 0;
state.termio.c_lflag = 0;
state.termio.c_cflag &= ~(CSIZE|PARENB);
state.termio.c_cflag |= CS8;
state.termio.c_cflag |= CLOCAL | CS8;
state.termio.c_cc[VMIN] = 0;
state.termio.c_cc[VTIME] = 0;
#endif
@ -534,6 +534,8 @@ hardwire_readchar(scb, timeout)
else
return SERIAL_TIMEOUT;
}
else if (errno == EINTR)
continue;
else
return SERIAL_ERROR; /* Got an error from read */
}

View File

@ -621,8 +621,15 @@ symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
return (objfile);
}
/* This is the symbol-file command. Read the file, analyze its symbols,
and add a struct symtab to a symtab list. */
/* This is the symbol-file command. Read the file, analyze its
symbols, and add a struct symtab to a symtab list. The syntax of
the command is rather bizarre--(1) buildargv implements various
quoting conventions which are undocumented and have little or
nothing in common with the way things are quoted (or not quoted)
elsewhere in GDB, (2) options are used, which are not generally
used in GDB (perhaps "set mapped on", "set readnow on" would be
better), (3) the order of options matters, which is contrary to GNU
conventions (because it is confusing and inconvenient). */
void
symbol_file_command (args, from_tty)
@ -902,7 +909,7 @@ generic_load (filename, from_tty)
printf_filtered ("Loading section %s, size 0x%lx vma ",
bfd_get_section_name (loadfile_bfd, s),
(unsigned long) size);
print_address_numeric (vma, gdb_stdout);
print_address_numeric (vma, 1, gdb_stdout);
printf_filtered ("\n");
bfd_get_section_contents (loadfile_bfd, s, buffer, 0, size);
@ -1202,6 +1209,8 @@ deduce_language_from_filename (filename)
return language_m2;
else if (STREQ(c,".c"))
return language_c;
else if (STREQ(c,".s"))
return language_asm;
else if (STREQ (c,".cc") || STREQ (c,".C") || STREQ (c, ".cxx")
|| STREQ (c, ".cpp"))
return language_cplus;