* 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:
parent
314628f66c
commit
2e6784a89f
8 changed files with 197 additions and 54 deletions
|
@ -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, ®s[0 * 4 * 2], 4 * 8, 0);
|
||||
|
||||
/* Copy EIP & PS */
|
||||
mem2hex (&frame->ExceptionEIP, ®s[8 * 4 * 2], 4 * 2, 0);
|
||||
mem2hex (&frame->ExceptionPC, ®s[8 * 4 * 2], 4 * 2, 0);
|
||||
|
||||
/* Copy CS, SS, DS */
|
||||
mem2hex (&frame->ExceptionCS, ®s[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 (®s[0 * 4 * 2], &frame->ExceptionEAX, 4 * 8, 0);
|
||||
|
||||
/* Copy EIP & PS */
|
||||
hex2mem (®s[8 * 4 * 2], &frame->ExceptionEIP, 4 * 2, 0);
|
||||
hex2mem (®s[8 * 4 * 2], &frame->ExceptionPC, 4 * 2, 0);
|
||||
|
||||
/* Copy CS, SS, DS */
|
||||
hex2mem (®s[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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue