From 28a86f5cc006038eeefb09bf74b756b3aacc1afa Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 6 Oct 2003 19:10:44 +0000 Subject: [PATCH] 2003-10-06 Andrew Cagney * z8k-tdep.c, symm-tdep.c, symm-nat.c: Delete obsolete file. * sparclet-stub.c, sparclet-rom.c: Delete obsolete file. * sparcl-tdep.c, sparcl-stub.c, h8500-tdep.c: Delete obsolete file. * m3-nat.c, mipsm3-nat.c, mn10200-tdep.c: Delete obsolete file. --- gdb/ChangeLog | 7 + gdb/h8500-tdep.c | 739 --------- gdb/m3-nat.c | 4566 --------------------------------------------------- gdb/mipsm3-nat.c | 386 ----- gdb/mn10200-tdep.c | 899 ---------- gdb/sparcl-stub.c | 946 ----------- gdb/sparcl-tdep.c | 869 ---------- gdb/sparclet-rom.c | 316 ---- gdb/sparclet-stub.c | 1167 ------------- gdb/symm-nat.c | 902 ---------- gdb/symm-tdep.c | 102 -- gdb/z8k-tdep.c | 535 ------ 12 files changed, 7 insertions(+), 11427 deletions(-) delete mode 100644 gdb/h8500-tdep.c delete mode 100644 gdb/m3-nat.c delete mode 100644 gdb/mipsm3-nat.c delete mode 100644 gdb/mn10200-tdep.c delete mode 100644 gdb/sparcl-stub.c delete mode 100644 gdb/sparcl-tdep.c delete mode 100644 gdb/sparclet-rom.c delete mode 100644 gdb/sparclet-stub.c delete mode 100644 gdb/symm-nat.c delete mode 100644 gdb/symm-tdep.c delete mode 100644 gdb/z8k-tdep.c diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ae1f1fe..ea7d3fc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2003-10-06 Andrew Cagney + + * z8k-tdep.c, symm-tdep.c, symm-nat.c: Delete obsolete file. + * sparclet-stub.c, sparclet-rom.c: Delete obsolete file. + * sparcl-tdep.c, sparcl-stub.c, h8500-tdep.c: Delete obsolete file. + * m3-nat.c, mipsm3-nat.c, mn10200-tdep.c: Delete obsolete file. + 2003-10-06 David Lecomber * f-valprint.c: Reformatting diff --git a/gdb/h8500-tdep.c b/gdb/h8500-tdep.c deleted file mode 100644 index f30fbd0..0000000 --- a/gdb/h8500-tdep.c +++ /dev/null @@ -1,739 +0,0 @@ -// OBSOLETE /* Target-dependent code for Hitachi H8/500, for GDB. -// OBSOLETE -// OBSOLETE Copyright 1993, 1994, 1995, 1998, 2000, 2001, 2002 Free Software -// OBSOLETE Foundation, Inc. -// OBSOLETE -// OBSOLETE This file is part of GDB. -// OBSOLETE -// OBSOLETE This program is free software; you can redistribute it and/or modify -// OBSOLETE it under the terms of the GNU General Public License as published by -// OBSOLETE the Free Software Foundation; either version 2 of the License, or -// OBSOLETE (at your option) any later version. -// OBSOLETE -// OBSOLETE This program is distributed in the hope that it will be useful, -// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of -// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// OBSOLETE GNU General Public License for more details. -// OBSOLETE -// OBSOLETE You should have received a copy of the GNU General Public License -// OBSOLETE along with this program; if not, write to the Free Software -// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, -// OBSOLETE Boston, MA 02111-1307, USA. */ -// OBSOLETE -// OBSOLETE /* -// OBSOLETE Contributed by Steve Chamberlain -// OBSOLETE sac@cygnus.com -// OBSOLETE */ -// OBSOLETE -// OBSOLETE #include "defs.h" -// OBSOLETE #include "frame.h" -// OBSOLETE #include "symtab.h" -// OBSOLETE #include "gdbtypes.h" -// OBSOLETE #include "gdbcmd.h" -// OBSOLETE #include "value.h" -// OBSOLETE #include "dis-asm.h" -// OBSOLETE #include "gdbcore.h" -// OBSOLETE #include "regcache.h" -// OBSOLETE -// OBSOLETE #define UNSIGNED_SHORT(X) ((X) & 0xffff) -// OBSOLETE -// OBSOLETE static int code_size = 2; -// OBSOLETE -// OBSOLETE static int data_size = 2; -// OBSOLETE -// OBSOLETE /* Shape of an H8/500 frame : -// OBSOLETE -// OBSOLETE arg-n -// OBSOLETE .. -// OBSOLETE arg-2 -// OBSOLETE arg-1 -// OBSOLETE return address <2 or 4 bytes> -// OBSOLETE old fp <2 bytes> -// OBSOLETE auto-n -// OBSOLETE .. -// OBSOLETE auto-1 -// OBSOLETE saved registers -// OBSOLETE -// OBSOLETE */ -// OBSOLETE -// OBSOLETE /* an easy to debug H8 stack frame looks like: -// OBSOLETE 0x6df6 push r6 -// OBSOLETE 0x0d76 mov.w r7,r6 -// OBSOLETE 0x6dfn push reg -// OBSOLETE 0x7905 nnnn mov.w #n,r5 or 0x1b87 subs #2,sp -// OBSOLETE 0x1957 sub.w r5,sp -// OBSOLETE -// OBSOLETE */ -// OBSOLETE -// OBSOLETE #define IS_PUSH(x) (((x) & 0xff00)==0x6d00) -// OBSOLETE #define IS_LINK_8(x) ((x) == 0x17) -// OBSOLETE #define IS_LINK_16(x) ((x) == 0x1f) -// OBSOLETE #define IS_MOVE_FP(x) ((x) == 0x0d76) -// OBSOLETE #define IS_MOV_SP_FP(x) ((x) == 0x0d76) -// OBSOLETE #define IS_SUB2_SP(x) ((x) == 0x1b87) -// OBSOLETE #define IS_MOVK_R5(x) ((x) == 0x7905) -// OBSOLETE #define IS_SUB_R5SP(x) ((x) == 0x1957) -// OBSOLETE -// OBSOLETE #define LINK_8 0x17 -// OBSOLETE #define LINK_16 0x1f -// OBSOLETE -// OBSOLETE int minimum_mode = 1; -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE h8500_skip_prologue (CORE_ADDR start_pc) -// OBSOLETE { -// OBSOLETE short int w; -// OBSOLETE -// OBSOLETE w = read_memory_integer (start_pc, 1); -// OBSOLETE if (w == LINK_8) -// OBSOLETE { -// OBSOLETE start_pc += 2; -// OBSOLETE w = read_memory_integer (start_pc, 1); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (w == LINK_16) -// OBSOLETE { -// OBSOLETE start_pc += 3; -// OBSOLETE w = read_memory_integer (start_pc, 2); -// OBSOLETE } -// OBSOLETE -// OBSOLETE return start_pc; -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE h8500_addr_bits_remove (CORE_ADDR addr) -// OBSOLETE { -// OBSOLETE return ((addr) & 0xffffff); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Given a GDB frame, determine the address of the calling function's -// OBSOLETE frame. This will be used to create a new GDB frame struct, and -// OBSOLETE then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be -// OBSOLETE called for the new frame. -// OBSOLETE -// OBSOLETE For us, the frame address is its stack pointer value, so we look up -// OBSOLETE the function prologue to determine the caller's sp value, and return it. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE h8500_frame_chain (struct frame_info *thisframe) -// OBSOLETE { -// OBSOLETE if (!inside_entry_file (thisframe->pc)) -// OBSOLETE return (read_memory_integer (get_frame_base (thisframe), PTR_SIZE)); -// OBSOLETE else -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or -// OBSOLETE is not the address of a valid instruction, the address of the next -// OBSOLETE instruction beyond ADDR otherwise. *PWORD1 receives the first word -// OBSOLETE of the instruction. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, char *pword1) -// OBSOLETE { -// OBSOLETE if (addr < lim + 8) -// OBSOLETE { -// OBSOLETE read_memory (addr, pword1, 1); -// OBSOLETE read_memory (addr, pword1 + 1, 1); -// OBSOLETE return 1; -// OBSOLETE } -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Examine the prologue of a function. `ip' points to the first -// OBSOLETE instruction. `limit' is the limit of the prologue (e.g. the addr -// OBSOLETE of the first linenumber, or perhaps the program counter if we're -// OBSOLETE stepping through). `frame_sp' is the stack pointer value in use in -// OBSOLETE this frame. `fsr' is a pointer to a frame_saved_regs structure -// OBSOLETE into which we put info about the registers saved by this frame. -// OBSOLETE `fi' is a struct frame_info pointer; we fill in various fields in -// OBSOLETE it to reflect the offsets of the arg pointer and the locals -// OBSOLETE pointer. */ -// OBSOLETE -// OBSOLETE /* Return the saved PC from this frame. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE frame_saved_pc (struct frame_info *frame) -// OBSOLETE { -// OBSOLETE return read_memory_integer (get_frame_base (frame) + 2, PTR_SIZE); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE h8500_pop_frame (void) -// OBSOLETE { -// OBSOLETE unsigned regnum; -// OBSOLETE struct frame_saved_regs fsr; -// OBSOLETE struct frame_info *frame = get_current_frame (); -// OBSOLETE -// OBSOLETE deprecated_get_frame_saved_regs (frame, &fsr); -// OBSOLETE -// OBSOLETE for (regnum = 0; regnum < 8; regnum++) -// OBSOLETE { -// OBSOLETE if (fsr.regs[regnum]) -// OBSOLETE write_register (regnum, read_memory_short (fsr.regs[regnum])); -// OBSOLETE -// OBSOLETE flush_cached_frames (); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE h8500_print_register_hook (int regno) -// OBSOLETE { -// OBSOLETE if (regno == CCR_REGNUM) -// OBSOLETE { -// OBSOLETE /* CCR register */ -// OBSOLETE -// OBSOLETE int C, Z, N, V; -// OBSOLETE unsigned char b[2]; -// OBSOLETE unsigned char l; -// OBSOLETE -// OBSOLETE frame_register_read (deprecated_selected_frame, regno, b); -// OBSOLETE l = b[1]; -// OBSOLETE printf_unfiltered ("\t"); -// OBSOLETE printf_unfiltered ("I-%d - ", (l & 0x80) != 0); -// OBSOLETE N = (l & 0x8) != 0; -// OBSOLETE Z = (l & 0x4) != 0; -// OBSOLETE V = (l & 0x2) != 0; -// OBSOLETE C = (l & 0x1) != 0; -// OBSOLETE printf_unfiltered ("N-%d ", N); -// OBSOLETE printf_unfiltered ("Z-%d ", Z); -// OBSOLETE printf_unfiltered ("V-%d ", V); -// OBSOLETE printf_unfiltered ("C-%d ", C); -// OBSOLETE if ((C | Z) == 0) -// OBSOLETE printf_unfiltered ("u> "); -// OBSOLETE if ((C | Z) == 1) -// OBSOLETE printf_unfiltered ("u<= "); -// OBSOLETE if ((C == 0)) -// OBSOLETE printf_unfiltered ("u>= "); -// OBSOLETE if (C == 1) -// OBSOLETE printf_unfiltered ("u< "); -// OBSOLETE if (Z == 0) -// OBSOLETE printf_unfiltered ("!= "); -// OBSOLETE if (Z == 1) -// OBSOLETE printf_unfiltered ("== "); -// OBSOLETE if ((N ^ V) == 0) -// OBSOLETE printf_unfiltered (">= "); -// OBSOLETE if ((N ^ V) == 1) -// OBSOLETE printf_unfiltered ("< "); -// OBSOLETE if ((Z | (N ^ V)) == 0) -// OBSOLETE printf_unfiltered ("> "); -// OBSOLETE if ((Z | (N ^ V)) == 1) -// OBSOLETE printf_unfiltered ("<= "); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE h8500_print_registers_info (struct gdbarch *gdbarch, -// OBSOLETE struct ui_file *file, -// OBSOLETE struct frame_info *frame, -// OBSOLETE int regnum, int print_all) -// OBSOLETE { -// OBSOLETE int i; -// OBSOLETE const int numregs = NUM_REGS + NUM_PSEUDO_REGS; -// OBSOLETE char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); -// OBSOLETE char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); -// OBSOLETE -// OBSOLETE for (i = 0; i < numregs; i++) -// OBSOLETE { -// OBSOLETE /* Decide between printing all regs, non-float / vector regs, or -// OBSOLETE specific reg. */ -// OBSOLETE if (regnum == -1) -// OBSOLETE { -// OBSOLETE if (!print_all) -// OBSOLETE { -// OBSOLETE if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) -// OBSOLETE continue; -// OBSOLETE if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i))) -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE if (i != regnum) -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* If the register name is empty, it is undefined for this -// OBSOLETE processor, so don't display anything. */ -// OBSOLETE if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0') -// OBSOLETE continue; -// OBSOLETE -// OBSOLETE fputs_filtered (REGISTER_NAME (i), file); -// OBSOLETE print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file); -// OBSOLETE -// OBSOLETE /* Get the data in raw format. */ -// OBSOLETE if (! frame_register_read (frame, i, raw_buffer)) -// OBSOLETE { -// OBSOLETE fprintf_filtered (file, "*value not available*\n"); -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* FIXME: cagney/2002-08-03: This code shouldn't be necessary. -// OBSOLETE The function frame_register_read() should have returned the -// OBSOLETE pre-cooked register so no conversion is necessary. */ -// OBSOLETE /* Convert raw data to virtual format if necessary. */ -// OBSOLETE if (REGISTER_CONVERTIBLE (i)) -// OBSOLETE { -// OBSOLETE REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i), -// OBSOLETE raw_buffer, virtual_buffer); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE memcpy (virtual_buffer, raw_buffer, -// OBSOLETE REGISTER_VIRTUAL_SIZE (i)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* If virtual format is floating, print it that way, and in raw -// OBSOLETE hex. */ -// OBSOLETE if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) -// OBSOLETE { -// OBSOLETE int j; -// OBSOLETE -// OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, -// OBSOLETE file, 0, 1, 0, Val_pretty_default); -// OBSOLETE -// OBSOLETE fprintf_filtered (file, "\t(raw 0x"); -// OBSOLETE for (j = 0; j < REGISTER_RAW_SIZE (i); j++) -// OBSOLETE { -// OBSOLETE int idx; -// OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) -// OBSOLETE idx = j; -// OBSOLETE else -// OBSOLETE idx = REGISTER_RAW_SIZE (i) - 1 - j; -// OBSOLETE fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]); -// OBSOLETE } -// OBSOLETE fprintf_filtered (file, ")"); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* Print the register in hex. */ -// OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, -// OBSOLETE file, 'x', 1, 0, Val_pretty_default); -// OBSOLETE /* If not a vector register, print it also according to its -// OBSOLETE natural format. */ -// OBSOLETE if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0) -// OBSOLETE { -// OBSOLETE fprintf_filtered (file, "\t"); -// OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, -// OBSOLETE file, 0, 1, 0, Val_pretty_default); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Some h8500 specific info. */ -// OBSOLETE h8500_print_register_hook (i); -// OBSOLETE -// OBSOLETE fprintf_filtered (file, "\n"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE h8500_do_registers_info (int regnum, int all) -// OBSOLETE { -// OBSOLETE h8500_print_registers_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, -// OBSOLETE regnum, all); -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE h8500_register_size (int regno) -// OBSOLETE { -// OBSOLETE switch (regno) -// OBSOLETE { -// OBSOLETE case SEG_C_REGNUM: -// OBSOLETE case SEG_D_REGNUM: -// OBSOLETE case SEG_E_REGNUM: -// OBSOLETE case SEG_T_REGNUM: -// OBSOLETE return 1; -// OBSOLETE case R0_REGNUM: -// OBSOLETE case R1_REGNUM: -// OBSOLETE case R2_REGNUM: -// OBSOLETE case R3_REGNUM: -// OBSOLETE case R4_REGNUM: -// OBSOLETE case R5_REGNUM: -// OBSOLETE case R6_REGNUM: -// OBSOLETE case R7_REGNUM: -// OBSOLETE case CCR_REGNUM: -// OBSOLETE return 2; -// OBSOLETE -// OBSOLETE case PR0_REGNUM: -// OBSOLETE case PR1_REGNUM: -// OBSOLETE case PR2_REGNUM: -// OBSOLETE case PR3_REGNUM: -// OBSOLETE case PR4_REGNUM: -// OBSOLETE case PR5_REGNUM: -// OBSOLETE case PR6_REGNUM: -// OBSOLETE case PR7_REGNUM: -// OBSOLETE case PC_REGNUM: -// OBSOLETE return 4; -// OBSOLETE default: -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE struct type * -// OBSOLETE h8500_register_virtual_type (int regno) -// OBSOLETE { -// OBSOLETE switch (regno) -// OBSOLETE { -// OBSOLETE case SEG_C_REGNUM: -// OBSOLETE case SEG_E_REGNUM: -// OBSOLETE case SEG_D_REGNUM: -// OBSOLETE case SEG_T_REGNUM: -// OBSOLETE return builtin_type_unsigned_char; -// OBSOLETE case R0_REGNUM: -// OBSOLETE case R1_REGNUM: -// OBSOLETE case R2_REGNUM: -// OBSOLETE case R3_REGNUM: -// OBSOLETE case R4_REGNUM: -// OBSOLETE case R5_REGNUM: -// OBSOLETE case R6_REGNUM: -// OBSOLETE case R7_REGNUM: -// OBSOLETE case CCR_REGNUM: -// OBSOLETE return builtin_type_unsigned_short; -// OBSOLETE case PR0_REGNUM: -// OBSOLETE case PR1_REGNUM: -// OBSOLETE case PR2_REGNUM: -// OBSOLETE case PR3_REGNUM: -// OBSOLETE case PR4_REGNUM: -// OBSOLETE case PR5_REGNUM: -// OBSOLETE case PR6_REGNUM: -// OBSOLETE case PR7_REGNUM: -// OBSOLETE case PC_REGNUM: -// OBSOLETE return builtin_type_unsigned_long; -// OBSOLETE default: -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, -// OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. -// OBSOLETE This includes special registers such as pc and fp saved in special -// OBSOLETE ways in the stack frame. sp is even more special: -// OBSOLETE the address we return for it IS the sp for the next frame. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE frame_find_saved_regs (struct frame_info *frame_info, -// OBSOLETE struct frame_saved_regs *frame_saved_regs) -// OBSOLETE { -// OBSOLETE register int regnum; -// OBSOLETE register int regmask; -// OBSOLETE register CORE_ADDR next_addr; -// OBSOLETE register CORE_ADDR pc; -// OBSOLETE unsigned char thebyte; -// OBSOLETE -// OBSOLETE memset (frame_saved_regs, '\0', sizeof *frame_saved_regs); -// OBSOLETE -// OBSOLETE if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4 -// OBSOLETE && (frame_info)->pc <= (frame_info)->frame) -// OBSOLETE { -// OBSOLETE next_addr = (frame_info)->frame; -// OBSOLETE pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE pc = get_pc_function_start ((frame_info)->pc); -// OBSOLETE /* Verify we have a link a6 instruction next; -// OBSOLETE if not we lose. If we win, find the address above the saved -// OBSOLETE regs using the amount of storage from the link instruction. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE thebyte = read_memory_integer (pc, 1); -// OBSOLETE if (0x1f == thebyte) -// OBSOLETE next_addr = (frame_info)->frame + read_memory_integer (pc += 1, 2), pc += 2; -// OBSOLETE else if (0x17 == thebyte) -// OBSOLETE next_addr = (frame_info)->frame + read_memory_integer (pc += 1, 1), pc += 1; -// OBSOLETE else -// OBSOLETE goto lose; -// OBSOLETE #if 0 -// OBSOLETE /* FIXME steve */ -// OBSOLETE /* If have an add:g.waddal #-n, sp next, adjust next_addr. */ -// OBSOLETE if ((0x0c0177777 & read_memory_integer (pc, 2)) == 0157774) -// OBSOLETE next_addr += read_memory_integer (pc += 2, 4), pc += 4; -// OBSOLETE #endif -// OBSOLETE } -// OBSOLETE -// OBSOLETE thebyte = read_memory_integer (pc, 1); -// OBSOLETE if (thebyte == 0x12) -// OBSOLETE { -// OBSOLETE /* Got stm */ -// OBSOLETE pc++; -// OBSOLETE regmask = read_memory_integer (pc, 1); -// OBSOLETE pc++; -// OBSOLETE for (regnum = 0; regnum < 8; regnum++, regmask >>= 1) -// OBSOLETE { -// OBSOLETE if (regmask & 1) -// OBSOLETE { -// OBSOLETE (frame_saved_regs)->regs[regnum] = (next_addr += 2) - 2; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE thebyte = read_memory_integer (pc, 1); -// OBSOLETE } -// OBSOLETE /* Maybe got a load of pushes */ -// OBSOLETE while (thebyte == 0xbf) -// OBSOLETE { -// OBSOLETE pc++; -// OBSOLETE regnum = read_memory_integer (pc, 1) & 0x7; -// OBSOLETE pc++; -// OBSOLETE (frame_saved_regs)->regs[regnum] = (next_addr += 2) - 2; -// OBSOLETE thebyte = read_memory_integer (pc, 1); -// OBSOLETE } -// OBSOLETE -// OBSOLETE lose:; -// OBSOLETE -// OBSOLETE /* Remember the address of the frame pointer */ -// OBSOLETE (frame_saved_regs)->regs[FP_REGNUM] = (frame_info)->frame; -// OBSOLETE -// OBSOLETE /* This is where the old sp is hidden */ -// OBSOLETE (frame_saved_regs)->regs[SP_REGNUM] = (frame_info)->frame; -// OBSOLETE -// OBSOLETE /* And the PC - remember the pushed FP is always two bytes long */ -// OBSOLETE (frame_saved_regs)->regs[PC_REGNUM] = (frame_info)->frame + 2; -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE saved_pc_after_call (void) -// OBSOLETE { -// OBSOLETE int x; -// OBSOLETE int a = read_register (SP_REGNUM); -// OBSOLETE -// OBSOLETE x = read_memory_integer (a, code_size); -// OBSOLETE if (code_size == 2) -// OBSOLETE { -// OBSOLETE /* Stick current code segement onto top */ -// OBSOLETE x &= 0xffff; -// OBSOLETE x |= read_register (SEG_C_REGNUM) << 16; -// OBSOLETE } -// OBSOLETE x &= 0xffffff; -// OBSOLETE return x; -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE h8500_set_pointer_size (int newsize) -// OBSOLETE { -// OBSOLETE static int oldsize = 0; -// OBSOLETE -// OBSOLETE if (oldsize != newsize) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("pointer size set to %d bits\n", newsize); -// OBSOLETE oldsize = newsize; -// OBSOLETE if (newsize == 32) -// OBSOLETE { -// OBSOLETE minimum_mode = 0; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE minimum_mode = 1; -// OBSOLETE } -// OBSOLETE _initialize_gdbtypes (); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE big_command (char *arg, int from_tty) -// OBSOLETE { -// OBSOLETE h8500_set_pointer_size (32); -// OBSOLETE code_size = 4; -// OBSOLETE data_size = 4; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE medium_command (char *arg, int from_tty) -// OBSOLETE { -// OBSOLETE h8500_set_pointer_size (32); -// OBSOLETE code_size = 4; -// OBSOLETE data_size = 2; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE compact_command (char *arg, int from_tty) -// OBSOLETE { -// OBSOLETE h8500_set_pointer_size (32); -// OBSOLETE code_size = 2; -// OBSOLETE data_size = 4; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE small_command (char *arg, int from_tty) -// OBSOLETE { -// OBSOLETE h8500_set_pointer_size (16); -// OBSOLETE code_size = 2; -// OBSOLETE data_size = 2; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static struct cmd_list_element *setmemorylist; -// OBSOLETE -// OBSOLETE static void -// OBSOLETE set_memory (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n"); -// OBSOLETE help_list (setmemorylist, "set memory ", -1, gdb_stdout); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* See if variable name is ppc or pr[0-7] */ -// OBSOLETE -// OBSOLETE int -// OBSOLETE h8500_is_trapped_internalvar (char *name) -// OBSOLETE { -// OBSOLETE if (name[0] != 'p') -// OBSOLETE return 0; -// OBSOLETE -// OBSOLETE if (strcmp (name + 1, "pc") == 0) -// OBSOLETE return 1; -// OBSOLETE -// OBSOLETE if (name[1] == 'r' -// OBSOLETE && name[2] >= '0' -// OBSOLETE && name[2] <= '7' -// OBSOLETE && name[3] == '\000') -// OBSOLETE return 1; -// OBSOLETE else -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE struct value * -// OBSOLETE h8500_value_of_trapped_internalvar (struct internalvar *var) -// OBSOLETE { -// OBSOLETE LONGEST regval; -// OBSOLETE unsigned char regbuf[4]; -// OBSOLETE int page_regnum, regnum; -// OBSOLETE -// OBSOLETE regnum = var->name[2] == 'c' ? PC_REGNUM : var->name[2] - '0'; -// OBSOLETE -// OBSOLETE switch (var->name[2]) -// OBSOLETE { -// OBSOLETE case 'c': -// OBSOLETE page_regnum = SEG_C_REGNUM; -// OBSOLETE break; -// OBSOLETE case '0': -// OBSOLETE case '1': -// OBSOLETE case '2': -// OBSOLETE case '3': -// OBSOLETE page_regnum = SEG_D_REGNUM; -// OBSOLETE break; -// OBSOLETE case '4': -// OBSOLETE case '5': -// OBSOLETE page_regnum = SEG_E_REGNUM; -// OBSOLETE break; -// OBSOLETE case '6': -// OBSOLETE case '7': -// OBSOLETE page_regnum = SEG_T_REGNUM; -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE -// OBSOLETE get_saved_register (regbuf, NULL, NULL, deprecated_selected_frame, page_regnum, NULL); -// OBSOLETE regval = regbuf[0] << 16; -// OBSOLETE -// OBSOLETE get_saved_register (regbuf, NULL, NULL, deprecated_selected_frame, regnum, NULL); -// OBSOLETE regval |= regbuf[0] << 8 | regbuf[1]; /* XXX host/target byte order */ -// OBSOLETE -// OBSOLETE xfree (var->value); /* Free up old value */ -// OBSOLETE -// OBSOLETE var->value = value_from_longest (builtin_type_unsigned_long, regval); -// OBSOLETE release_value (var->value); /* Unchain new value */ -// OBSOLETE -// OBSOLETE VALUE_LVAL (var->value) = lval_internalvar; -// OBSOLETE VALUE_INTERNALVAR (var->value) = var; -// OBSOLETE return var->value; -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE h8500_set_trapped_internalvar (struct internalvar *var, struct value *newval, -// OBSOLETE int bitpos, int bitsize, int offset) -// OBSOLETE { -// OBSOLETE char *page_regnum, *regnum; -// OBSOLETE char expression[100]; -// OBSOLETE unsigned new_regval; -// OBSOLETE struct type *type; -// OBSOLETE enum type_code newval_type_code; -// OBSOLETE -// OBSOLETE type = check_typedef (VALUE_TYPE (newval)); -// OBSOLETE newval_type_code = TYPE_CODE (type); -// OBSOLETE -// OBSOLETE if ((newval_type_code != TYPE_CODE_INT -// OBSOLETE && newval_type_code != TYPE_CODE_PTR) -// OBSOLETE || TYPE_LENGTH (type) != sizeof (new_regval)) -// OBSOLETE error ("Illegal type (%s) for assignment to $%s\n", -// OBSOLETE TYPE_NAME (VALUE_TYPE (newval)), var->name); -// OBSOLETE -// OBSOLETE new_regval = *(long *) VALUE_CONTENTS_RAW (newval); -// OBSOLETE -// OBSOLETE regnum = var->name + 1; -// OBSOLETE -// OBSOLETE switch (var->name[2]) -// OBSOLETE { -// OBSOLETE case 'c': -// OBSOLETE page_regnum = "cp"; -// OBSOLETE break; -// OBSOLETE case '0': -// OBSOLETE case '1': -// OBSOLETE case '2': -// OBSOLETE case '3': -// OBSOLETE page_regnum = "dp"; -// OBSOLETE break; -// OBSOLETE case '4': -// OBSOLETE case '5': -// OBSOLETE page_regnum = "ep"; -// OBSOLETE break; -// OBSOLETE case '6': -// OBSOLETE case '7': -// OBSOLETE page_regnum = "tp"; -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE -// OBSOLETE sprintf (expression, "$%s=%d", page_regnum, new_regval >> 16); -// OBSOLETE parse_and_eval (expression); -// OBSOLETE -// OBSOLETE sprintf (expression, "$%s=%d", regnum, new_regval & 0xffff); -// OBSOLETE parse_and_eval (expression); -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE h8500_read_sp (void) -// OBSOLETE { -// OBSOLETE return read_register (PR7_REGNUM); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE h8500_write_sp (CORE_ADDR v) -// OBSOLETE { -// OBSOLETE write_register (PR7_REGNUM, v); -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE h8500_read_pc (ptid_t ptid) -// OBSOLETE { -// OBSOLETE return read_register (PC_REGNUM); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE h8500_write_pc (CORE_ADDR v, ptid_t ptid) -// OBSOLETE { -// OBSOLETE write_register (PC_REGNUM, v); -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE h8500_read_fp (void) -// OBSOLETE { -// OBSOLETE return read_register (PR6_REGNUM); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE _initialize_h8500_tdep (void) -// OBSOLETE { -// OBSOLETE tm_print_insn = print_insn_h8500; -// OBSOLETE -// OBSOLETE add_prefix_cmd ("memory", no_class, set_memory, -// OBSOLETE "set the memory model", &setmemorylist, "set memory ", 0, -// OBSOLETE &setlist); -// OBSOLETE -// OBSOLETE add_cmd ("small", class_support, small_command, -// OBSOLETE "Set small memory model. (16 bit code, 16 bit data)", &setmemorylist); -// OBSOLETE -// OBSOLETE add_cmd ("big", class_support, big_command, -// OBSOLETE "Set big memory model. (32 bit code, 32 bit data)", &setmemorylist); -// OBSOLETE -// OBSOLETE add_cmd ("medium", class_support, medium_command, -// OBSOLETE "Set medium memory model. (32 bit code, 16 bit data)", &setmemorylist); -// OBSOLETE -// OBSOLETE add_cmd ("compact", class_support, compact_command, -// OBSOLETE "Set compact memory model. (16 bit code, 32 bit data)", &setmemorylist); -// OBSOLETE -// OBSOLETE } diff --git a/gdb/m3-nat.c b/gdb/m3-nat.c deleted file mode 100644 index 9e3f93b..0000000 --- a/gdb/m3-nat.c +++ /dev/null @@ -1,4566 +0,0 @@ -// OBSOLETE /* Interface GDB to Mach 3.0 operating systems. -// OBSOLETE (Most) Mach 3.0 related routines live in this file. -// OBSOLETE -// OBSOLETE Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -// OBSOLETE 2002 Free Software Foundation, Inc. -// OBSOLETE -// OBSOLETE This file is part of GDB. -// OBSOLETE -// OBSOLETE This program is free software; you can redistribute it and/or modify -// OBSOLETE it under the terms of the GNU General Public License as published by -// OBSOLETE the Free Software Foundation; either version 2 of the License, or -// OBSOLETE (at your option) any later version. -// OBSOLETE -// OBSOLETE This program is distributed in the hope that it will be useful, -// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of -// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// OBSOLETE GNU General Public License for more details. -// OBSOLETE -// OBSOLETE You should have received a copy of the GNU General Public License -// OBSOLETE along with this program; if not, write to the Free Software -// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, -// OBSOLETE Boston, MA 02111-1307, USA. */ -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Author: Jukka Virtanen -// OBSOLETE * Computing Centre -// OBSOLETE * Helsinki University of Technology -// OBSOLETE * Finland -// OBSOLETE * -// OBSOLETE * Thanks to my friends who helped with ideas and testing: -// OBSOLETE * -// OBSOLETE * Johannes Helander, Antti Louko, Tero Mononen, -// OBSOLETE * jvh@cs.hut.fi alo@hut.fi tmo@cs.hut.fi -// OBSOLETE * -// OBSOLETE * Tero Kivinen and Eamonn McManus -// OBSOLETE * kivinen@cs.hut.fi emcmanus@gr.osf.org -// OBSOLETE * -// OBSOLETE */ -// OBSOLETE -// OBSOLETE #include -// OBSOLETE -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE -// OBSOLETE #include "defs.h" -// OBSOLETE #include "inferior.h" -// OBSOLETE #include "symtab.h" -// OBSOLETE #include "value.h" -// OBSOLETE #include "language.h" -// OBSOLETE #include "target.h" -// OBSOLETE #include "gdb_wait.h" -// OBSOLETE #include "gdbcmd.h" -// OBSOLETE #include "gdbcore.h" -// OBSOLETE #include "regcache.h" -// OBSOLETE -// OBSOLETE #if 0 -// OBSOLETE #include -// OBSOLETE #else -// OBSOLETE #define MACH_TYPE_TASK 1 -// OBSOLETE #define MACH_TYPE_THREAD 2 -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE /* Included only for signal names and NSIG -// OBSOLETE -// OBSOLETE * note: There are many problems in signal handling with -// OBSOLETE * gdb in Mach 3.0 in general. -// OBSOLETE */ -// OBSOLETE #include -// OBSOLETE #define SIG_UNKNOWN 0 /* Exception that has no matching unix signal */ -// OBSOLETE -// OBSOLETE #include -// OBSOLETE -// OBSOLETE /* This is what a cproc looks like. This is here partly because -// OBSOLETE cthread_internals.h is not a header we can just #include, partly with -// OBSOLETE an eye towards perhaps getting this to work with cross-debugging -// OBSOLETE someday. Best solution is if CMU publishes a real interface to this -// OBSOLETE stuff. */ -// OBSOLETE #define CPROC_NEXT_OFFSET 0 -// OBSOLETE #define CPROC_NEXT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT) -// OBSOLETE #define CPROC_INCARNATION_OFFSET (CPROC_NEXT_OFFSET + CPROC_NEXT_SIZE) -// OBSOLETE #define CPROC_INCARNATION_SIZE (sizeof (cthread_t)) -// OBSOLETE #define CPROC_LIST_OFFSET (CPROC_INCARNATION_OFFSET + CPROC_INCARNATION_SIZE) -// OBSOLETE #define CPROC_LIST_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT) -// OBSOLETE #define CPROC_WAIT_OFFSET (CPROC_LIST_OFFSET + CPROC_LIST_SIZE) -// OBSOLETE #define CPROC_WAIT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT) -// OBSOLETE #define CPROC_REPLY_OFFSET (CPROC_WAIT_OFFSET + CPROC_WAIT_SIZE) -// OBSOLETE #define CPROC_REPLY_SIZE (sizeof (mach_port_t)) -// OBSOLETE #define CPROC_CONTEXT_OFFSET (CPROC_REPLY_OFFSET + CPROC_REPLY_SIZE) -// OBSOLETE #define CPROC_CONTEXT_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -// OBSOLETE #define CPROC_LOCK_OFFSET (CPROC_CONTEXT_OFFSET + CPROC_CONTEXT_SIZE) -// OBSOLETE #define CPROC_LOCK_SIZE (sizeof (spin_lock_t)) -// OBSOLETE #define CPROC_STATE_OFFSET (CPROC_LOCK_OFFSET + CPROC_LOCK_SIZE) -// OBSOLETE #define CPROC_STATE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -// OBSOLETE #define CPROC_WIRED_OFFSET (CPROC_STATE_OFFSET + CPROC_STATE_SIZE) -// OBSOLETE #define CPROC_WIRED_SIZE (sizeof (mach_port_t)) -// OBSOLETE #define CPROC_BUSY_OFFSET (CPROC_WIRED_OFFSET + CPROC_WIRED_SIZE) -// OBSOLETE #define CPROC_BUSY_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -// OBSOLETE #define CPROC_MSG_OFFSET (CPROC_BUSY_OFFSET + CPROC_BUSY_SIZE) -// OBSOLETE #define CPROC_MSG_SIZE (sizeof (mach_msg_header_t)) -// OBSOLETE #define CPROC_BASE_OFFSET (CPROC_MSG_OFFSET + CPROC_MSG_SIZE) -// OBSOLETE #define CPROC_BASE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -// OBSOLETE #define CPROC_SIZE_OFFSET (CPROC_BASE_OFFSET + CPROC_BASE_SIZE) -// OBSOLETE #define CPROC_SIZE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -// OBSOLETE #define CPROC_SIZE (CPROC_SIZE_OFFSET + CPROC_SIZE_SIZE) -// OBSOLETE -// OBSOLETE /* Values for the state field in the cproc. */ -// OBSOLETE #define CPROC_RUNNING 0 -// OBSOLETE #define CPROC_SWITCHING 1 -// OBSOLETE #define CPROC_BLOCKED 2 -// OBSOLETE #define CPROC_CONDWAIT 4 -// OBSOLETE -// OBSOLETE /* For cproc and kernel thread mapping */ -// OBSOLETE typedef struct gdb_thread -// OBSOLETE { -// OBSOLETE mach_port_t name; -// OBSOLETE CORE_ADDR sp; -// OBSOLETE CORE_ADDR pc; -// OBSOLETE CORE_ADDR fp; -// OBSOLETE boolean_t in_emulator; -// OBSOLETE int slotid; -// OBSOLETE -// OBSOLETE /* This is for the mthreads list. It points to the cproc list. -// OBSOLETE Perhaps the two lists should be merged (or perhaps it was a mistake -// OBSOLETE to make them both use a struct gdb_thread). */ -// OBSOLETE struct gdb_thread *cproc; -// OBSOLETE -// OBSOLETE /* These are for the cproc list, which is linked through the next field -// OBSOLETE of the struct gdb_thread. */ -// OBSOLETE char raw_cproc[CPROC_SIZE]; -// OBSOLETE /* The cthread which is pointed to by the incarnation field from the -// OBSOLETE cproc. This points to the copy we've read into GDB. */ -// OBSOLETE cthread_t cthread; -// OBSOLETE /* Point back to the mthreads list. */ -// OBSOLETE int reverse_map; -// OBSOLETE struct gdb_thread *next; -// OBSOLETE } -// OBSOLETE *gdb_thread_t; -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Actions for Mach exceptions. -// OBSOLETE * -// OBSOLETE * sigmap field maps the exception to corresponding Unix signal. -// OBSOLETE * -// OBSOLETE * I do not know how to map the exception to unix signal -// OBSOLETE * if SIG_UNKNOWN is specified. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE struct exception_list -// OBSOLETE { -// OBSOLETE char *name; -// OBSOLETE boolean_t forward; -// OBSOLETE boolean_t print; -// OBSOLETE int sigmap; -// OBSOLETE } -// OBSOLETE exception_map[] = -// OBSOLETE { -// OBSOLETE { -// OBSOLETE "not_mach3_exception", FALSE, TRUE, SIG_UNKNOWN -// OBSOLETE } -// OBSOLETE , -// OBSOLETE { -// OBSOLETE "EXC_BAD_ACCESS", FALSE, TRUE, SIGSEGV -// OBSOLETE } -// OBSOLETE , -// OBSOLETE { -// OBSOLETE "EXC_BAD_INSTRUCTION", FALSE, TRUE, SIGILL -// OBSOLETE } -// OBSOLETE , -// OBSOLETE { -// OBSOLETE "EXC_ARITHMETIC", FALSE, TRUE, SIGFPE -// OBSOLETE } -// OBSOLETE , -// OBSOLETE { -// OBSOLETE "EXC_EMULATION", FALSE, TRUE, SIGEMT -// OBSOLETE } -// OBSOLETE , /* ??? */ -// OBSOLETE { -// OBSOLETE "EXC_SOFTWARE", FALSE, TRUE, SIG_UNKNOWN -// OBSOLETE } -// OBSOLETE , -// OBSOLETE { -// OBSOLETE "EXC_BREAKPOINT", FALSE, FALSE, SIGTRAP -// OBSOLETE } -// OBSOLETE }; -// OBSOLETE -// OBSOLETE /* Mach exception table size */ -// OBSOLETE int max_exception = sizeof (exception_map) / sizeof (struct exception_list) - 1; -// OBSOLETE -// OBSOLETE #define MAX_EXCEPTION max_exception -// OBSOLETE -// OBSOLETE WAITTYPE wait_status; -// OBSOLETE -// OBSOLETE /* If you define this, intercepted bsd server calls will be -// OBSOLETE * dumped while waiting the inferior to EXEC the correct -// OBSOLETE * program -// OBSOLETE */ -// OBSOLETE /* #define DUMP_SYSCALL /* debugging interceptor */ -// OBSOLETE -// OBSOLETE /* xx_debug() outputs messages if this is nonzero. -// OBSOLETE * If > 1, DUMP_SYSCALL will dump message contents. -// OBSOLETE */ -// OBSOLETE int debug_level = 0; -// OBSOLETE -// OBSOLETE /* "Temporary" debug stuff */ -// OBSOLETE void -// OBSOLETE xx_debug (char *fmt, int a, int b, int c) -// OBSOLETE { -// OBSOLETE if (debug_level) -// OBSOLETE warning (fmt, a, b, c); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* This is in libmach.a */ -// OBSOLETE extern mach_port_t name_server_port; -// OBSOLETE -// OBSOLETE /* Set in catch_exception_raise */ -// OBSOLETE int stop_exception, stop_code, stop_subcode; -// OBSOLETE int stopped_in_exception; -// OBSOLETE -// OBSOLETE /* Thread that was the active thread when we stopped */ -// OBSOLETE thread_t stop_thread = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE char *hostname = ""; -// OBSOLETE -// OBSOLETE /* Set when task is attached or created */ -// OBSOLETE boolean_t emulator_present = FALSE; -// OBSOLETE -// OBSOLETE task_t inferior_task; -// OBSOLETE thread_t current_thread; -// OBSOLETE -// OBSOLETE /* Exception ports for inferior task */ -// OBSOLETE mach_port_t inferior_exception_port = MACH_PORT_NULL; -// OBSOLETE mach_port_t inferior_old_exception_port = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE /* task exceptions and notifications */ -// OBSOLETE mach_port_t inferior_wait_port_set = MACH_PORT_NULL; -// OBSOLETE mach_port_t our_notify_port = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE /* This is "inferior_wait_port_set" when not single stepping, and -// OBSOLETE * "singlestepped_thread_port" when we are single stepping. -// OBSOLETE * -// OBSOLETE * This is protected by a cleanup function: discard_single_step() -// OBSOLETE */ -// OBSOLETE mach_port_t currently_waiting_for = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE /* A port for external messages to gdb. -// OBSOLETE * External in the meaning that they do not come -// OBSOLETE * from the inferior_task, but rather from external -// OBSOLETE * tasks. -// OBSOLETE * -// OBSOLETE * As a debugging feature: -// OBSOLETE * A debugger debugging another debugger can stop the -// OBSOLETE * inferior debugger by the following command sequence -// OBSOLETE * (without running external programs) -// OBSOLETE * -// OBSOLETE * (top-gdb) set stop_inferior_gdb () -// OBSOLETE * (top-gdb) continue -// OBSOLETE */ -// OBSOLETE mach_port_t our_message_port = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE /* For single stepping */ -// OBSOLETE mach_port_t thread_exception_port = MACH_PORT_NULL; -// OBSOLETE mach_port_t thread_saved_exception_port = MACH_PORT_NULL; -// OBSOLETE mach_port_t singlestepped_thread_port = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE /* For machid calls */ -// OBSOLETE mach_port_t mid_server = MACH_PORT_NULL; -// OBSOLETE mach_port_t mid_auth = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE /* If gdb thinks the inferior task is not suspended, it -// OBSOLETE * must take suspend/abort the threads when it reads the state. -// OBSOLETE */ -// OBSOLETE int must_suspend_thread = 0; -// OBSOLETE -// OBSOLETE /* When single stepping, we switch the port that mach_really_wait() listens to. -// OBSOLETE * This cleanup is a guard to prevent the port set from being left to -// OBSOLETE * the singlestepped_thread_port when error() is called. -// OBSOLETE * This is nonzero only when we are single stepping. -// OBSOLETE */ -// OBSOLETE #define NULL_CLEANUP (struct cleanup *)0 -// OBSOLETE struct cleanup *cleanup_step = NULL_CLEANUP; -// OBSOLETE -// OBSOLETE -// OBSOLETE static struct target_ops m3_ops; -// OBSOLETE -// OBSOLETE static void m3_kill_inferior (); -// OBSOLETE -// OBSOLETE #if 0 -// OBSOLETE #define MACH_TYPE_EXCEPTION_PORT -1 -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE /* Chain of ports to remember requested notifications. */ -// OBSOLETE -// OBSOLETE struct port_chain -// OBSOLETE { -// OBSOLETE struct port_chain *next; -// OBSOLETE mach_port_t port; -// OBSOLETE int type; -// OBSOLETE int mid; /* Now only valid with MACH_TYPE_THREAD and */ -// OBSOLETE /* MACH_TYPE_THREAD */ -// OBSOLETE }; -// OBSOLETE typedef struct port_chain *port_chain_t; -// OBSOLETE -// OBSOLETE /* Room for chain nodes comes from pchain_obstack */ -// OBSOLETE struct obstack pchain_obstack; -// OBSOLETE struct obstack *port_chain_obstack = &pchain_obstack; -// OBSOLETE -// OBSOLETE /* For thread handling */ -// OBSOLETE struct obstack Cproc_obstack; -// OBSOLETE struct obstack *cproc_obstack = &Cproc_obstack; -// OBSOLETE -// OBSOLETE /* the list of notified ports */ -// OBSOLETE port_chain_t notify_chain = (port_chain_t) NULL; -// OBSOLETE -// OBSOLETE port_chain_t -// OBSOLETE port_chain_insert (port_chain_t list, mach_port_t name, int type) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE port_chain_t new; -// OBSOLETE int mid; -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (name)) -// OBSOLETE return list; -// OBSOLETE -// OBSOLETE if (type == MACH_TYPE_TASK || type == MACH_TYPE_THREAD) -// OBSOLETE { -// OBSOLETE if (!MACH_PORT_VALID (mid_server)) -// OBSOLETE { -// OBSOLETE warning ("Machid server port invalid, can not map port 0x%x to MID", -// OBSOLETE name); -// OBSOLETE mid = name; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE ret = machid_mach_register (mid_server, mid_auth, name, type, &mid); -// OBSOLETE -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE warning ("Can not map name (0x%x) to MID with machid", name); -// OBSOLETE mid = name; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); -// OBSOLETE -// OBSOLETE new = (port_chain_t) obstack_alloc (port_chain_obstack, -// OBSOLETE sizeof (struct port_chain)); -// OBSOLETE new->next = list; -// OBSOLETE new->port = name; -// OBSOLETE new->type = type; -// OBSOLETE new->mid = mid; -// OBSOLETE -// OBSOLETE return new; -// OBSOLETE } -// OBSOLETE -// OBSOLETE port_chain_t -// OBSOLETE port_chain_delete (port_chain_t list, mach_port_t elem) -// OBSOLETE { -// OBSOLETE if (list) -// OBSOLETE if (list->port == elem) -// OBSOLETE list = list->next; -// OBSOLETE else -// OBSOLETE while (list->next) -// OBSOLETE { -// OBSOLETE if (list->next->port == elem) -// OBSOLETE list->next = list->next->next; /* GCd with obstack_free() */ -// OBSOLETE else -// OBSOLETE list = list->next; -// OBSOLETE } -// OBSOLETE return list; -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE port_chain_destroy (struct obstack *ostack) -// OBSOLETE { -// OBSOLETE obstack_free (ostack, 0); -// OBSOLETE obstack_init (ostack); -// OBSOLETE } -// OBSOLETE -// OBSOLETE port_chain_t -// OBSOLETE port_chain_member (port_chain_t list, mach_port_t elem) -// OBSOLETE { -// OBSOLETE while (list) -// OBSOLETE { -// OBSOLETE if (list->port == elem) -// OBSOLETE return list; -// OBSOLETE list = list->next; -// OBSOLETE } -// OBSOLETE return (port_chain_t) NULL; -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE map_port_name_to_mid (mach_port_t name, int type) -// OBSOLETE { -// OBSOLETE port_chain_t elem; -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (name)) -// OBSOLETE return -1; -// OBSOLETE -// OBSOLETE elem = port_chain_member (notify_chain, name); -// OBSOLETE -// OBSOLETE if (elem && (elem->type == type)) -// OBSOLETE return elem->mid; -// OBSOLETE -// OBSOLETE if (elem) -// OBSOLETE return -1; -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (mid_server)) -// OBSOLETE { -// OBSOLETE warning ("Machid server port invalid, can not map port 0x%x to mid", -// OBSOLETE name); -// OBSOLETE return -1; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE int mid; -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE ret = machid_mach_register (mid_server, mid_auth, name, type, &mid); -// OBSOLETE -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE warning ("Can not map name (0x%x) to mid with machid", name); -// OBSOLETE return -1; -// OBSOLETE } -// OBSOLETE return mid; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Guard for currently_waiting_for and singlestepped_thread_port */ -// OBSOLETE static void -// OBSOLETE discard_single_step (thread_t thread) -// OBSOLETE { -// OBSOLETE currently_waiting_for = inferior_wait_port_set; -// OBSOLETE -// OBSOLETE cleanup_step = NULL_CLEANUP; -// OBSOLETE if (MACH_PORT_VALID (thread) && MACH_PORT_VALID (singlestepped_thread_port)) -// OBSOLETE setup_single_step (thread, FALSE); -// OBSOLETE } -// OBSOLETE -// OBSOLETE setup_single_step (thread_t thread, boolean_t start_step) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (thread)) -// OBSOLETE error ("Invalid thread supplied to setup_single_step"); -// OBSOLETE else -// OBSOLETE { -// OBSOLETE mach_port_t teport; -// OBSOLETE -// OBSOLETE /* Get the current thread exception port */ -// OBSOLETE ret = thread_get_exception_port (thread, &teport); -// OBSOLETE CHK ("Getting thread's exception port", ret); -// OBSOLETE -// OBSOLETE if (start_step) -// OBSOLETE { -// OBSOLETE if (MACH_PORT_VALID (singlestepped_thread_port)) -// OBSOLETE { -// OBSOLETE warning ("Singlestepped_thread_port (0x%x) is still valid?", -// OBSOLETE singlestepped_thread_port); -// OBSOLETE singlestepped_thread_port = MACH_PORT_NULL; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* If we are already stepping this thread */ -// OBSOLETE if (MACH_PORT_VALID (teport) && teport == thread_exception_port) -// OBSOLETE { -// OBSOLETE ret = mach_port_deallocate (mach_task_self (), teport); -// OBSOLETE CHK ("Could not deallocate thread exception port", ret); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE ret = thread_set_exception_port (thread, thread_exception_port); -// OBSOLETE CHK ("Setting exception port for thread", ret); -// OBSOLETE #if 0 -// OBSOLETE /* Insert thread exception port to wait port set */ -// OBSOLETE ret = mach_port_move_member (mach_task_self (), -// OBSOLETE thread_exception_port, -// OBSOLETE inferior_wait_port_set); -// OBSOLETE CHK ("Moving thread exception port to inferior_wait_port_set", -// OBSOLETE ret); -// OBSOLETE #endif -// OBSOLETE thread_saved_exception_port = teport; -// OBSOLETE } -// OBSOLETE -// OBSOLETE thread_trace (thread, TRUE); -// OBSOLETE -// OBSOLETE singlestepped_thread_port = thread_exception_port; -// OBSOLETE currently_waiting_for = singlestepped_thread_port; -// OBSOLETE cleanup_step = make_cleanup (discard_single_step, thread); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE if (!MACH_PORT_VALID (teport)) -// OBSOLETE error ("Single stepped thread had an invalid exception port?"); -// OBSOLETE -// OBSOLETE if (teport != thread_exception_port) -// OBSOLETE error ("Single stepped thread had an unknown exception port?"); -// OBSOLETE -// OBSOLETE ret = mach_port_deallocate (mach_task_self (), teport); -// OBSOLETE CHK ("Couldn't deallocate thread exception port", ret); -// OBSOLETE #if 0 -// OBSOLETE /* Remove thread exception port from wait port set */ -// OBSOLETE ret = mach_port_move_member (mach_task_self (), -// OBSOLETE thread_exception_port, -// OBSOLETE MACH_PORT_NULL); -// OBSOLETE CHK ("Removing thread exception port from inferior_wait_port_set", -// OBSOLETE ret); -// OBSOLETE #endif -// OBSOLETE /* Restore thread's old exception port */ -// OBSOLETE ret = thread_set_exception_port (thread, -// OBSOLETE thread_saved_exception_port); -// OBSOLETE CHK ("Restoring stepped thread's exception port", ret); -// OBSOLETE -// OBSOLETE if (MACH_PORT_VALID (thread_saved_exception_port)) -// OBSOLETE (void) mach_port_deallocate (mach_task_self (), -// OBSOLETE thread_saved_exception_port); -// OBSOLETE -// OBSOLETE thread_trace (thread, FALSE); -// OBSOLETE -// OBSOLETE singlestepped_thread_port = MACH_PORT_NULL; -// OBSOLETE currently_waiting_for = inferior_wait_port_set; -// OBSOLETE if (cleanup_step) -// OBSOLETE discard_cleanups (cleanup_step); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static -// OBSOLETE request_notify (mach_port_t name, mach_msg_id_t variant, int type) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE mach_port_t previous_port_dummy = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (name)) -// OBSOLETE return; -// OBSOLETE -// OBSOLETE if (port_chain_member (notify_chain, name)) -// OBSOLETE return; -// OBSOLETE -// OBSOLETE ret = mach_port_request_notification (mach_task_self (), -// OBSOLETE name, -// OBSOLETE variant, -// OBSOLETE 1, -// OBSOLETE our_notify_port, -// OBSOLETE MACH_MSG_TYPE_MAKE_SEND_ONCE, -// OBSOLETE &previous_port_dummy); -// OBSOLETE CHK ("Serious: request_notify failed", ret); -// OBSOLETE -// OBSOLETE (void) mach_port_deallocate (mach_task_self (), -// OBSOLETE previous_port_dummy); -// OBSOLETE -// OBSOLETE notify_chain = port_chain_insert (notify_chain, name, type); -// OBSOLETE } -// OBSOLETE -// OBSOLETE reverse_msg_bits (mach_msg_header_t *msgp, int type) -// OBSOLETE { -// OBSOLETE int rbits, lbits; -// OBSOLETE rbits = MACH_MSGH_BITS_REMOTE (msgp->msgh_bits); -// OBSOLETE lbits = type; -// OBSOLETE msgp->msgh_bits = -// OBSOLETE (msgp->msgh_bits & ~MACH_MSGH_BITS_PORTS_MASK) | -// OBSOLETE MACH_MSGH_BITS (lbits, rbits); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* On the third day He said: -// OBSOLETE -// OBSOLETE Let this be global -// OBSOLETE and then it was global. -// OBSOLETE -// OBSOLETE When creating the inferior fork, the -// OBSOLETE child code in inflow.c sets the name of the -// OBSOLETE bootstrap_port in its address space to this -// OBSOLETE variable. -// OBSOLETE -// OBSOLETE The name is transferred to our address space -// OBSOLETE with mach3_read_inferior(). -// OBSOLETE -// OBSOLETE Thou shalt not do this with -// OBSOLETE task_get_bootstrap_port() in this task, since -// OBSOLETE the name in the inferior task is different than -// OBSOLETE the one we get. -// OBSOLETE -// OBSOLETE For blessed are the meek, as they shall inherit -// OBSOLETE the address space. -// OBSOLETE */ -// OBSOLETE mach_port_t original_server_port_name = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE -// OBSOLETE /* Called from inferior after FORK but before EXEC */ -// OBSOLETE static void -// OBSOLETE m3_trace_me (void) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE /* Get the NAME of the bootstrap port in this task -// OBSOLETE so that GDB can read it */ -// OBSOLETE ret = task_get_bootstrap_port (mach_task_self (), -// OBSOLETE &original_server_port_name); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); -// OBSOLETE ret = mach_port_deallocate (mach_task_self (), -// OBSOLETE original_server_port_name); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); -// OBSOLETE -// OBSOLETE /* Suspend this task to let the parent change my ports. -// OBSOLETE Resumed by the debugger */ -// OBSOLETE ret = task_suspend (mach_task_self ()); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Intercept system calls to Unix server. -// OBSOLETE * After EXEC_COUNTER calls to exec(), return. -// OBSOLETE * -// OBSOLETE * Pre-assertion: Child is suspended. (Not verified) -// OBSOLETE * Post-condition: Child is suspended after EXEC_COUNTER exec() calls. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE intercept_exec_calls (int exec_counter) -// OBSOLETE { -// OBSOLETE int terminal_initted = 0; -// OBSOLETE -// OBSOLETE struct syscall_msg_t -// OBSOLETE { -// OBSOLETE mach_msg_header_t header; -// OBSOLETE mach_msg_type_t type; -// OBSOLETE char room[2000]; /* Enuff space */ -// OBSOLETE }; -// OBSOLETE -// OBSOLETE struct syscall_msg_t syscall_in, syscall_out; -// OBSOLETE -// OBSOLETE mach_port_t fake_server; -// OBSOLETE mach_port_t original_server_send; -// OBSOLETE mach_port_t original_exec_reply; -// OBSOLETE mach_port_t exec_reply; -// OBSOLETE mach_port_t exec_reply_send; -// OBSOLETE mach_msg_type_name_t acquired; -// OBSOLETE mach_port_t emulator_server_port_name; -// OBSOLETE struct task_basic_info info; -// OBSOLETE mach_msg_type_number_t info_count; -// OBSOLETE -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE if (exec_counter <= 0) -// OBSOLETE return; /* We are already set up in the correct program */ -// OBSOLETE -// OBSOLETE ret = mach_port_allocate (mach_task_self (), -// OBSOLETE MACH_PORT_RIGHT_RECEIVE, -// OBSOLETE &fake_server); -// OBSOLETE CHK ("create inferior_fake_server port failed", ret); -// OBSOLETE -// OBSOLETE /* Wait for inferior_task to suspend itself */ -// OBSOLETE while (1) -// OBSOLETE { -// OBSOLETE info_count = sizeof (info); -// OBSOLETE ret = task_info (inferior_task, -// OBSOLETE TASK_BASIC_INFO, -// OBSOLETE (task_info_t) & info, -// OBSOLETE &info_count); -// OBSOLETE CHK ("Task info", ret); -// OBSOLETE -// OBSOLETE if (info.suspend_count) -// OBSOLETE break; -// OBSOLETE -// OBSOLETE /* Note that the definition of the parameter was undefined -// OBSOLETE * at the time of this writing, so I just use an `ad hoc' value. -// OBSOLETE */ -// OBSOLETE (void) swtch_pri (42); /* Universal Priority Value */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Read the inferior's bootstrap port name */ -// OBSOLETE if (!mach3_read_inferior (&original_server_port_name, -// OBSOLETE &original_server_port_name, -// OBSOLETE sizeof (original_server_port_name))) -// OBSOLETE error ("Can't read inferior task bootstrap port name"); -// OBSOLETE -// OBSOLETE /* @@ BUG: If more than 1 send right GDB will FAIL!!! */ -// OBSOLETE /* Should get refs, and set them back when restoring */ -// OBSOLETE /* Steal the original bsd server send right from inferior */ -// OBSOLETE ret = mach_port_extract_right (inferior_task, -// OBSOLETE original_server_port_name, -// OBSOLETE MACH_MSG_TYPE_MOVE_SEND, -// OBSOLETE &original_server_send, -// OBSOLETE &acquired); -// OBSOLETE CHK ("mach_port_extract_right (bsd server send)", ret); -// OBSOLETE -// OBSOLETE if (acquired != MACH_MSG_TYPE_PORT_SEND) -// OBSOLETE error ("Incorrect right extracted, send right to bsd server expected"); -// OBSOLETE -// OBSOLETE ret = mach_port_insert_right (inferior_task, -// OBSOLETE original_server_port_name, -// OBSOLETE fake_server, -// OBSOLETE MACH_MSG_TYPE_MAKE_SEND); -// OBSOLETE CHK ("mach_port_insert_right (fake server send)", ret); -// OBSOLETE -// OBSOLETE xx_debug ("inferior task bsd server ports set up \nfs %x, ospn %x, oss %x\n", -// OBSOLETE fake_server, -// OBSOLETE original_server_port_name, original_server_send); -// OBSOLETE -// OBSOLETE /* A receive right to the reply generated by unix server exec() request */ -// OBSOLETE ret = mach_port_allocate (mach_task_self (), -// OBSOLETE MACH_PORT_RIGHT_RECEIVE, -// OBSOLETE &exec_reply); -// OBSOLETE CHK ("create intercepted_reply_port port failed", ret); -// OBSOLETE -// OBSOLETE /* Pass this send right to Unix server so it replies to us after exec() */ -// OBSOLETE ret = mach_port_extract_right (mach_task_self (), -// OBSOLETE exec_reply, -// OBSOLETE MACH_MSG_TYPE_MAKE_SEND_ONCE, -// OBSOLETE &exec_reply_send, -// OBSOLETE &acquired); -// OBSOLETE CHK ("mach_port_extract_right (exec_reply)", ret); -// OBSOLETE -// OBSOLETE if (acquired != MACH_MSG_TYPE_PORT_SEND_ONCE) -// OBSOLETE error ("Incorrect right extracted, send once expected for exec reply"); -// OBSOLETE -// OBSOLETE ret = mach_port_move_member (mach_task_self (), -// OBSOLETE fake_server, -// OBSOLETE inferior_wait_port_set); -// OBSOLETE CHK ("Moving fake syscall port to inferior_wait_port_set", ret); -// OBSOLETE -// OBSOLETE xx_debug ("syscall fake server set up, resuming inferior\n"); -// OBSOLETE -// OBSOLETE ret = task_resume (inferior_task); -// OBSOLETE CHK ("task_resume (startup)", ret); -// OBSOLETE -// OBSOLETE /* Read requests from the inferior. -// OBSOLETE Pass directly through everything else except exec() calls. -// OBSOLETE */ -// OBSOLETE while (exec_counter > 0) -// OBSOLETE { -// OBSOLETE ret = mach_msg (&syscall_in.header, /* header */ -// OBSOLETE MACH_RCV_MSG, /* options */ -// OBSOLETE 0, /* send size */ -// OBSOLETE sizeof (struct syscall_msg_t), /* receive size */ -// OBSOLETE inferior_wait_port_set, /* receive_name */ -// OBSOLETE MACH_MSG_TIMEOUT_NONE, -// OBSOLETE MACH_PORT_NULL); -// OBSOLETE CHK ("mach_msg (intercepted sycall)", ret); -// OBSOLETE -// OBSOLETE #ifdef DUMP_SYSCALL -// OBSOLETE print_msg (&syscall_in.header); -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE /* ASSERT : msgh_local_port == fake_server */ -// OBSOLETE -// OBSOLETE if (notify_server (&syscall_in.header, &syscall_out.header)) -// OBSOLETE error ("received a notify while intercepting syscalls"); -// OBSOLETE -// OBSOLETE if (syscall_in.header.msgh_id == MIG_EXEC_SYSCALL_ID) -// OBSOLETE { -// OBSOLETE xx_debug ("Received EXEC SYSCALL, counter = %d\n", exec_counter); -// OBSOLETE if (exec_counter == 1) -// OBSOLETE { -// OBSOLETE original_exec_reply = syscall_in.header.msgh_remote_port; -// OBSOLETE syscall_in.header.msgh_remote_port = exec_reply_send; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (!terminal_initted) -// OBSOLETE { -// OBSOLETE /* Now that the child has exec'd we know it has already set its -// OBSOLETE process group. On POSIX systems, tcsetpgrp will fail with -// OBSOLETE EPERM if we try it before the child's setpgid. */ -// OBSOLETE -// OBSOLETE /* Set up the "saved terminal modes" of the inferior -// OBSOLETE based on what modes we are starting it with. */ -// OBSOLETE target_terminal_init (); -// OBSOLETE -// OBSOLETE /* Install inferior's terminal modes. */ -// OBSOLETE target_terminal_inferior (); -// OBSOLETE -// OBSOLETE terminal_initted = 1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE exec_counter--; -// OBSOLETE } -// OBSOLETE -// OBSOLETE syscall_in.header.msgh_local_port = syscall_in.header.msgh_remote_port; -// OBSOLETE syscall_in.header.msgh_remote_port = original_server_send; -// OBSOLETE -// OBSOLETE reverse_msg_bits (&syscall_in.header, MACH_MSG_TYPE_COPY_SEND); -// OBSOLETE -// OBSOLETE ret = mach_msg_send (&syscall_in.header); -// OBSOLETE CHK ("Forwarded syscall", ret); -// OBSOLETE } -// OBSOLETE -// OBSOLETE ret = mach_port_move_member (mach_task_self (), -// OBSOLETE fake_server, -// OBSOLETE MACH_PORT_NULL); -// OBSOLETE CHK ("Moving fake syscall out of inferior_wait_port_set", ret); -// OBSOLETE -// OBSOLETE ret = mach_port_move_member (mach_task_self (), -// OBSOLETE exec_reply, -// OBSOLETE inferior_wait_port_set); -// OBSOLETE CHK ("Moving exec_reply to inferior_wait_port_set", ret); -// OBSOLETE -// OBSOLETE ret = mach_msg (&syscall_in.header, /* header */ -// OBSOLETE MACH_RCV_MSG, /* options */ -// OBSOLETE 0, /* send size */ -// OBSOLETE sizeof (struct syscall_msg_t), /* receive size */ -// OBSOLETE inferior_wait_port_set, /* receive_name */ -// OBSOLETE MACH_MSG_TIMEOUT_NONE, -// OBSOLETE MACH_PORT_NULL); -// OBSOLETE CHK ("mach_msg (exec reply)", ret); -// OBSOLETE -// OBSOLETE ret = task_suspend (inferior_task); -// OBSOLETE CHK ("Suspending inferior after last exec", ret); -// OBSOLETE -// OBSOLETE must_suspend_thread = 0; -// OBSOLETE -// OBSOLETE xx_debug ("Received exec reply from bsd server, suspended inferior task\n"); -// OBSOLETE -// OBSOLETE #ifdef DUMP_SYSCALL -// OBSOLETE print_msg (&syscall_in.header); -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE /* Message should appear as if it came from the unix server */ -// OBSOLETE syscall_in.header.msgh_local_port = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE /* and go to the inferior task original reply port */ -// OBSOLETE syscall_in.header.msgh_remote_port = original_exec_reply; -// OBSOLETE -// OBSOLETE reverse_msg_bits (&syscall_in.header, MACH_MSG_TYPE_MOVE_SEND_ONCE); -// OBSOLETE -// OBSOLETE ret = mach_msg_send (&syscall_in.header); -// OBSOLETE CHK ("Forwarding exec reply to inferior", ret); -// OBSOLETE -// OBSOLETE /* Garbage collect */ -// OBSOLETE ret = mach_port_deallocate (inferior_task, -// OBSOLETE original_server_port_name); -// OBSOLETE CHK ("deallocating fake server send right", ret); -// OBSOLETE -// OBSOLETE ret = mach_port_insert_right (inferior_task, -// OBSOLETE original_server_port_name, -// OBSOLETE original_server_send, -// OBSOLETE MACH_MSG_TYPE_MOVE_SEND); -// OBSOLETE CHK ("Restoring the original bsd server send right", ret); -// OBSOLETE -// OBSOLETE ret = mach_port_destroy (mach_task_self (), -// OBSOLETE fake_server); -// OBSOLETE fake_server = MACH_PORT_DEAD; -// OBSOLETE CHK ("mach_port_destroy (fake_server)", ret); -// OBSOLETE -// OBSOLETE ret = mach_port_destroy (mach_task_self (), -// OBSOLETE exec_reply); -// OBSOLETE exec_reply = MACH_PORT_DEAD; -// OBSOLETE CHK ("mach_port_destroy (exec_reply)", ret); -// OBSOLETE -// OBSOLETE xx_debug ("Done with exec call interception\n"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE consume_send_rights (thread_array_t thread_list, int thread_count) -// OBSOLETE { -// OBSOLETE int index; -// OBSOLETE -// OBSOLETE if (!thread_count) -// OBSOLETE return; -// OBSOLETE -// OBSOLETE for (index = 0; index < thread_count; index++) -// OBSOLETE { -// OBSOLETE /* Since thread kill command kills threads, don't check ret */ -// OBSOLETE (void) mach_port_deallocate (mach_task_self (), -// OBSOLETE thread_list[index]); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* suspend/abort/resume a thread. */ -// OBSOLETE setup_thread (mach_port_t thread, int what) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE if (what) -// OBSOLETE { -// OBSOLETE ret = thread_suspend (thread); -// OBSOLETE CHK ("setup_thread thread_suspend", ret); -// OBSOLETE -// OBSOLETE ret = thread_abort (thread); -// OBSOLETE CHK ("setup_thread thread_abort", ret); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE ret = thread_resume (thread); -// OBSOLETE CHK ("setup_thread thread_resume", ret); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE map_slot_to_mid (int slot, thread_array_t threads, int thread_count) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE int deallocate = 0; -// OBSOLETE int index; -// OBSOLETE int mid; -// OBSOLETE -// OBSOLETE if (!threads) -// OBSOLETE { -// OBSOLETE deallocate++; -// OBSOLETE ret = task_threads (inferior_task, &threads, &thread_count); -// OBSOLETE CHK ("Can not select a thread from a dead task", ret); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (slot < 0 || slot >= thread_count) -// OBSOLETE { -// OBSOLETE if (deallocate) -// OBSOLETE { -// OBSOLETE consume_send_rights (threads, thread_count); -// OBSOLETE (void) vm_deallocate (mach_task_self (), (vm_address_t) threads, -// OBSOLETE (thread_count * sizeof (mach_port_t))); -// OBSOLETE } -// OBSOLETE if (slot < 0) -// OBSOLETE error ("invalid slot number"); -// OBSOLETE else -// OBSOLETE return -(slot + 1); -// OBSOLETE } -// OBSOLETE -// OBSOLETE mid = map_port_name_to_mid (threads[slot], MACH_TYPE_THREAD); -// OBSOLETE -// OBSOLETE if (deallocate) -// OBSOLETE { -// OBSOLETE consume_send_rights (threads, thread_count); -// OBSOLETE (void) vm_deallocate (mach_task_self (), (vm_address_t) threads, -// OBSOLETE (thread_count * sizeof (mach_port_t))); -// OBSOLETE } -// OBSOLETE -// OBSOLETE return mid; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static int -// OBSOLETE parse_thread_id (char *arg, int thread_count, int slots) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE int mid; -// OBSOLETE int slot; -// OBSOLETE int index; -// OBSOLETE -// OBSOLETE if (arg == 0) -// OBSOLETE return 0; -// OBSOLETE -// OBSOLETE while (*arg && (*arg == ' ' || *arg == '\t')) -// OBSOLETE arg++; -// OBSOLETE -// OBSOLETE if (!*arg) -// OBSOLETE return 0; -// OBSOLETE -// OBSOLETE /* Currently parse MID and @SLOTNUMBER */ -// OBSOLETE if (*arg != '@') -// OBSOLETE { -// OBSOLETE mid = atoi (arg); -// OBSOLETE if (mid <= 0) -// OBSOLETE error ("valid thread mid expected"); -// OBSOLETE return mid; -// OBSOLETE } -// OBSOLETE -// OBSOLETE arg++; -// OBSOLETE slot = atoi (arg); -// OBSOLETE -// OBSOLETE if (slot < 0) -// OBSOLETE error ("invalid slot number"); -// OBSOLETE -// OBSOLETE /* If you want slot numbers to remain slot numbers, set slots. -// OBSOLETE -// OBSOLETE * Well, since 0 is reserved, return the ordinal number -// OBSOLETE * of the thread rather than the slot number. Awk, this -// OBSOLETE * counts as a kludge. -// OBSOLETE */ -// OBSOLETE if (slots) -// OBSOLETE return -(slot + 1); -// OBSOLETE -// OBSOLETE if (thread_count && slot >= thread_count) -// OBSOLETE return -(slot + 1); -// OBSOLETE -// OBSOLETE mid = map_slot_to_mid (slot); -// OBSOLETE -// OBSOLETE return mid; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* THREAD_ID 0 is special; it selects the first kernel -// OBSOLETE * thread from the list (i.e. SLOTNUMBER 0) -// OBSOLETE * This is used when starting the program with 'run' or when attaching. -// OBSOLETE * -// OBSOLETE * If FLAG is 0 the context is not changed, and the registers, frame, etc -// OBSOLETE * will continue to describe the old thread. -// OBSOLETE * -// OBSOLETE * If FLAG is nonzero, really select the thread. -// OBSOLETE * If FLAG is 2, the THREAD_ID is a slotnumber instead of a mid. -// OBSOLETE * -// OBSOLETE */ -// OBSOLETE kern_return_t -// OBSOLETE select_thread (mach_port_t task, int thread_id, int flag) -// OBSOLETE { -// OBSOLETE thread_array_t thread_list; -// OBSOLETE int thread_count; -// OBSOLETE kern_return_t ret; -// OBSOLETE int index; -// OBSOLETE thread_t new_thread = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE if (thread_id < 0) -// OBSOLETE error ("Can't select cprocs without kernel thread"); -// OBSOLETE -// OBSOLETE ret = task_threads (task, &thread_list, &thread_count); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE warning ("Can not select a thread from a dead task"); -// OBSOLETE m3_kill_inferior (); -// OBSOLETE return KERN_FAILURE; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (thread_count == 0) -// OBSOLETE { -// OBSOLETE /* The task can not do anything anymore, but it still -// OBSOLETE * exists as a container for memory and ports. -// OBSOLETE */ -// OBSOLETE registers_changed (); -// OBSOLETE warning ("Task %d has no threads", -// OBSOLETE map_port_name_to_mid (task, MACH_TYPE_TASK)); -// OBSOLETE current_thread = MACH_PORT_NULL; -// OBSOLETE (void) vm_deallocate (mach_task_self (), -// OBSOLETE (vm_address_t) thread_list, -// OBSOLETE (thread_count * sizeof (mach_port_t))); -// OBSOLETE return KERN_FAILURE; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (!thread_id || flag == 2) -// OBSOLETE { -// OBSOLETE /* First thread or a slotnumber */ -// OBSOLETE if (!thread_id) -// OBSOLETE new_thread = thread_list[0]; -// OBSOLETE else -// OBSOLETE { -// OBSOLETE if (thread_id < thread_count) -// OBSOLETE new_thread = thread_list[thread_id]; -// OBSOLETE else -// OBSOLETE { -// OBSOLETE (void) vm_deallocate (mach_task_self (), -// OBSOLETE (vm_address_t) thread_list, -// OBSOLETE (thread_count * sizeof (mach_port_t))); -// OBSOLETE error ("No such thread slot number : %d", thread_id); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE for (index = 0; index < thread_count; index++) -// OBSOLETE if (thread_id == map_port_name_to_mid (thread_list[index], -// OBSOLETE MACH_TYPE_THREAD)) -// OBSOLETE { -// OBSOLETE new_thread = thread_list[index]; -// OBSOLETE index = -1; -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (index != -1) -// OBSOLETE error ("No thread with mid %d", thread_id); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Notify when the selected thread dies */ -// OBSOLETE request_notify (new_thread, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_THREAD); -// OBSOLETE -// OBSOLETE ret = vm_deallocate (mach_task_self (), -// OBSOLETE (vm_address_t) thread_list, -// OBSOLETE (thread_count * sizeof (mach_port_t))); -// OBSOLETE CHK ("vm_deallocate", ret); -// OBSOLETE -// OBSOLETE if (!flag) -// OBSOLETE current_thread = new_thread; -// OBSOLETE else -// OBSOLETE { -// OBSOLETE #if 0 -// OBSOLETE if (MACH_PORT_VALID (current_thread)) -// OBSOLETE { -// OBSOLETE /* Store the gdb's view of the thread we are deselecting -// OBSOLETE -// OBSOLETE * @@ I think gdb updates registers immediately when they are -// OBSOLETE * changed, so don't do this. -// OBSOLETE */ -// OBSOLETE ret = thread_abort (current_thread); -// OBSOLETE CHK ("Could not abort system calls when saving state of old thread", -// OBSOLETE ret); -// OBSOLETE target_prepare_to_store (); -// OBSOLETE target_store_registers (-1); -// OBSOLETE } -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE registers_changed (); -// OBSOLETE -// OBSOLETE current_thread = new_thread; -// OBSOLETE -// OBSOLETE ret = thread_abort (current_thread); -// OBSOLETE CHK ("Could not abort system calls when selecting a thread", ret); -// OBSOLETE -// OBSOLETE stop_pc = read_pc (); -// OBSOLETE flush_cached_frames (); -// OBSOLETE -// OBSOLETE select_frame (get_current_frame ()); -// OBSOLETE } -// OBSOLETE -// OBSOLETE return KERN_SUCCESS; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Switch to use thread named NEW_THREAD. -// OBSOLETE * Return it's MID -// OBSOLETE */ -// OBSOLETE int -// OBSOLETE switch_to_thread (thread_t new_thread) -// OBSOLETE { -// OBSOLETE thread_t saved_thread = current_thread; -// OBSOLETE int mid; -// OBSOLETE -// OBSOLETE mid = map_port_name_to_mid (new_thread, -// OBSOLETE MACH_TYPE_THREAD); -// OBSOLETE if (mid == -1) -// OBSOLETE warning ("Can't map thread name 0x%x to mid", new_thread); -// OBSOLETE else if (select_thread (inferior_task, mid, 1) != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE if (current_thread) -// OBSOLETE current_thread = saved_thread; -// OBSOLETE error ("Could not select thread %d", mid); -// OBSOLETE } -// OBSOLETE -// OBSOLETE return mid; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Do this in gdb after doing FORK but before STARTUP_INFERIOR. -// OBSOLETE * Note that the registers are not yet valid in the inferior task. -// OBSOLETE */ -// OBSOLETE static int -// OBSOLETE m3_trace_him (int pid) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE push_target (&m3_ops); -// OBSOLETE -// OBSOLETE inferior_task = task_by_pid (pid); -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (inferior_task)) -// OBSOLETE error ("Can not map Unix pid %d to Mach task", pid); -// OBSOLETE -// OBSOLETE /* Clean up previous notifications and create new ones */ -// OBSOLETE setup_notify_port (1); -// OBSOLETE -// OBSOLETE /* When notification appears, the inferior task has died */ -// OBSOLETE request_notify (inferior_task, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_TASK); -// OBSOLETE -// OBSOLETE emulator_present = have_emulator_p (inferior_task); -// OBSOLETE -// OBSOLETE /* By default, select the first thread, -// OBSOLETE * If task has no threads, gives a warning -// OBSOLETE * Does not fetch registers, since they are not yet valid. -// OBSOLETE */ -// OBSOLETE select_thread (inferior_task, 0, 0); -// OBSOLETE -// OBSOLETE inferior_exception_port = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE setup_exception_port (); -// OBSOLETE -// OBSOLETE xx_debug ("Now the debugged task is created\n"); -// OBSOLETE -// OBSOLETE /* One trap to exec the shell, one to exec the program being debugged. */ -// OBSOLETE intercept_exec_calls (2); -// OBSOLETE -// OBSOLETE return pid; -// OBSOLETE } -// OBSOLETE -// OBSOLETE setup_exception_port (void) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE ret = mach_port_allocate (mach_task_self (), -// OBSOLETE MACH_PORT_RIGHT_RECEIVE, -// OBSOLETE &inferior_exception_port); -// OBSOLETE CHK ("mach_port_allocate", ret); -// OBSOLETE -// OBSOLETE /* add send right */ -// OBSOLETE ret = mach_port_insert_right (mach_task_self (), -// OBSOLETE inferior_exception_port, -// OBSOLETE inferior_exception_port, -// OBSOLETE MACH_MSG_TYPE_MAKE_SEND); -// OBSOLETE CHK ("mach_port_insert_right", ret); -// OBSOLETE -// OBSOLETE ret = mach_port_move_member (mach_task_self (), -// OBSOLETE inferior_exception_port, -// OBSOLETE inferior_wait_port_set); -// OBSOLETE CHK ("mach_port_move_member", ret); -// OBSOLETE -// OBSOLETE ret = task_get_special_port (inferior_task, -// OBSOLETE TASK_EXCEPTION_PORT, -// OBSOLETE &inferior_old_exception_port); -// OBSOLETE CHK ("task_get_special_port(old exc)", ret); -// OBSOLETE -// OBSOLETE ret = task_set_special_port (inferior_task, -// OBSOLETE TASK_EXCEPTION_PORT, -// OBSOLETE inferior_exception_port); -// OBSOLETE CHK ("task_set_special_port", ret); -// OBSOLETE -// OBSOLETE ret = mach_port_deallocate (mach_task_self (), -// OBSOLETE inferior_exception_port); -// OBSOLETE CHK ("mack_port_deallocate", ret); -// OBSOLETE -// OBSOLETE #if 0 -// OBSOLETE /* When notify appears, the inferior_task's exception -// OBSOLETE * port has been destroyed. -// OBSOLETE * -// OBSOLETE * Not used, since the dead_name_notification already -// OBSOLETE * appears when task dies. -// OBSOLETE * -// OBSOLETE */ -// OBSOLETE request_notify (inferior_exception_port, -// OBSOLETE MACH_NOTIFY_NO_SENDERS, -// OBSOLETE MACH_TYPE_EXCEPTION_PORT); -// OBSOLETE #endif -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Nonzero if gdb is waiting for a message */ -// OBSOLETE int mach_really_waiting; -// OBSOLETE -// OBSOLETE /* Wait for the inferior to stop for some reason. -// OBSOLETE - Loop on notifications until inferior_task dies. -// OBSOLETE - Loop on exceptions until stopped_in_exception comes true. -// OBSOLETE (e.g. we receive a single step trace trap) -// OBSOLETE - a message arrives to gdb's message port -// OBSOLETE -// OBSOLETE There is no other way to exit this loop. -// OBSOLETE -// OBSOLETE Returns the inferior_ptid for rest of gdb. -// OBSOLETE Side effects: Set *OURSTATUS. */ -// OBSOLETE ptid_t -// OBSOLETE mach_really_wait (ptid_t ptid, struct target_waitstatus *ourstatus) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE int w; -// OBSOLETE -// OBSOLETE struct msg -// OBSOLETE { -// OBSOLETE mach_msg_header_t header; -// OBSOLETE mach_msg_type_t foo; -// OBSOLETE int data[8000]; -// OBSOLETE } -// OBSOLETE in_msg, out_msg; -// OBSOLETE -// OBSOLETE /* Either notify (death), exception or message can stop the inferior */ -// OBSOLETE stopped_in_exception = FALSE; -// OBSOLETE -// OBSOLETE while (1) -// OBSOLETE { -// OBSOLETE QUIT; -// OBSOLETE -// OBSOLETE stop_exception = stop_code = stop_subcode = -1; -// OBSOLETE stop_thread = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE mach_really_waiting = 1; -// OBSOLETE ret = mach_msg (&in_msg.header, /* header */ -// OBSOLETE MACH_RCV_MSG, /* options */ -// OBSOLETE 0, /* send size */ -// OBSOLETE sizeof (struct msg), /* receive size */ -// OBSOLETE currently_waiting_for, /* receive name */ -// OBSOLETE MACH_MSG_TIMEOUT_NONE, -// OBSOLETE MACH_PORT_NULL); -// OBSOLETE mach_really_waiting = 0; -// OBSOLETE CHK ("mach_msg (receive)", ret); -// OBSOLETE -// OBSOLETE /* Check if we received a notify of the childs' death */ -// OBSOLETE if (notify_server (&in_msg.header, &out_msg.header)) -// OBSOLETE { -// OBSOLETE /* If inferior_task is null then the inferior has -// OBSOLETE gone away and we want to return to command level. -// OBSOLETE Otherwise it was just an informative message and we -// OBSOLETE need to look to see if there are any more. */ -// OBSOLETE if (inferior_task != MACH_PORT_NULL) -// OBSOLETE continue; -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* Collect Unix exit status for gdb */ -// OBSOLETE -// OBSOLETE wait3 (&w, WNOHANG, 0); -// OBSOLETE -// OBSOLETE /* This mess is here to check that the rest of -// OBSOLETE * gdb knows that the inferior died. It also -// OBSOLETE * tries to hack around the fact that Mach 3.0 (mk69) -// OBSOLETE * unix server (ux28) does not always know what -// OBSOLETE * has happened to it's children when mach-magic -// OBSOLETE * is applied on them. -// OBSOLETE */ -// OBSOLETE if ((!WIFEXITED (w) && WIFSTOPPED (w)) || -// OBSOLETE (WIFEXITED (w) && WEXITSTATUS (w) > 0377)) -// OBSOLETE { -// OBSOLETE WSETEXIT (w, 0); -// OBSOLETE warning ("Using exit value 0 for terminated task"); -// OBSOLETE } -// OBSOLETE else if (!WIFEXITED (w)) -// OBSOLETE { -// OBSOLETE int sig = WTERMSIG (w); -// OBSOLETE -// OBSOLETE /* Signals cause problems. Warn the user. */ -// OBSOLETE if (sig != SIGKILL) /* Bad luck if garbage matches this */ -// OBSOLETE warning ("The terminating signal stuff may be nonsense"); -// OBSOLETE else if (sig > NSIG) -// OBSOLETE { -// OBSOLETE WSETEXIT (w, 0); -// OBSOLETE warning ("Using exit value 0 for terminated task"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE store_waitstatus (ourstatus, w); -// OBSOLETE return inferior_ptid; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Hmm. Check for exception, as it was not a notification. -// OBSOLETE exc_server() does an upcall to catch_exception_raise() -// OBSOLETE if this rpc is an exception. Further actions are decided -// OBSOLETE there. -// OBSOLETE */ -// OBSOLETE if (!exc_server (&in_msg.header, &out_msg.header)) -// OBSOLETE { -// OBSOLETE -// OBSOLETE /* Not an exception, check for message. -// OBSOLETE -// OBSOLETE * Messages don't come from the inferior, or if they -// OBSOLETE * do they better be asynchronous or it will hang. -// OBSOLETE */ -// OBSOLETE if (gdb_message_server (&in_msg.header)) -// OBSOLETE continue; -// OBSOLETE -// OBSOLETE error ("Unrecognized message received in mach_really_wait"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Send the reply of the exception rpc to the suspended task */ -// OBSOLETE ret = mach_msg_send (&out_msg.header); -// OBSOLETE CHK ("mach_msg_send (exc reply)", ret); -// OBSOLETE -// OBSOLETE if (stopped_in_exception) -// OBSOLETE { -// OBSOLETE /* Get unix state. May be changed in mach3_exception_actions() */ -// OBSOLETE wait3 (&w, WNOHANG, 0); -// OBSOLETE -// OBSOLETE mach3_exception_actions (&w, FALSE, "Task"); -// OBSOLETE -// OBSOLETE store_waitstatus (ourstatus, w); -// OBSOLETE return inferior_ptid; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Called by macro DO_QUIT() in utils.c(quit). -// OBSOLETE * This is called just before calling error() to return to command level -// OBSOLETE */ -// OBSOLETE void -// OBSOLETE mach3_quit (void) -// OBSOLETE { -// OBSOLETE int mid; -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE if (mach_really_waiting) -// OBSOLETE { -// OBSOLETE ret = task_suspend (inferior_task); -// OBSOLETE -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE warning ("Could not suspend task for interrupt: %s", -// OBSOLETE mach_error_string (ret)); -// OBSOLETE mach_really_waiting = 0; -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE must_suspend_thread = 0; -// OBSOLETE mach_really_waiting = 0; -// OBSOLETE -// OBSOLETE mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); -// OBSOLETE if (mid == -1) -// OBSOLETE { -// OBSOLETE warning ("Selecting first existing kernel thread"); -// OBSOLETE mid = 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE current_thread = MACH_PORT_NULL; /* Force setup */ -// OBSOLETE select_thread (inferior_task, mid, 1); -// OBSOLETE -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE #if 0 -// OBSOLETE /* bogus bogus bogus. It is NOT OK to quit out of target_wait. */ -// OBSOLETE -// OBSOLETE /* If ^C is typed when we are waiting for a message -// OBSOLETE * and your Unix server is able to notice that we -// OBSOLETE * should quit now. -// OBSOLETE * -// OBSOLETE * Called by REQUEST_QUIT() from utils.c(request_quit) -// OBSOLETE */ -// OBSOLETE void -// OBSOLETE mach3_request_quit (void) -// OBSOLETE { -// OBSOLETE if (mach_really_waiting) -// OBSOLETE immediate_quit = 1; -// OBSOLETE } -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Gdb message server. -// OBSOLETE * Currently implemented is the STOP message, that causes -// OBSOLETE * gdb to return to the command level like ^C had been typed from terminal. -// OBSOLETE */ -// OBSOLETE int -// OBSOLETE gdb_message_server (mach_msg_header_t *InP) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE int mid; -// OBSOLETE -// OBSOLETE if (InP->msgh_local_port == our_message_port) -// OBSOLETE { -// OBSOLETE /* A message coming to our_message_port. Check validity */ -// OBSOLETE switch (InP->msgh_id) -// OBSOLETE { -// OBSOLETE -// OBSOLETE case GDB_MESSAGE_ID_STOP: -// OBSOLETE ret = task_suspend (inferior_task); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE warning ("Could not suspend task for stop message: %s", -// OBSOLETE mach_error_string (ret)); -// OBSOLETE -// OBSOLETE /* QUIT in mach_really_wait() loop. */ -// OBSOLETE request_quit (0); -// OBSOLETE break; -// OBSOLETE -// OBSOLETE default: -// OBSOLETE warning ("Invalid message id %d received, ignored.", -// OBSOLETE InP->msgh_id); -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE -// OBSOLETE return 1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Message not handled by this server */ -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* NOTE: This is not an RPC call. It is a simpleroutine. -// OBSOLETE -// OBSOLETE * This is not called from this gdb code. -// OBSOLETE * -// OBSOLETE * It may be called by another debugger to cause this -// OBSOLETE * debugger to enter command level: -// OBSOLETE * -// OBSOLETE * (gdb) set stop_inferior_gdb () -// OBSOLETE * (gdb) continue -// OBSOLETE * -// OBSOLETE * External program "stop-gdb" implements this also. -// OBSOLETE */ -// OBSOLETE void -// OBSOLETE stop_inferior_gdb (void) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE /* Code generated by mig, with minor cleanups :-) -// OBSOLETE -// OBSOLETE * simpleroutine stop_inferior_gdb (our_message_port : mach_port_t); -// OBSOLETE */ -// OBSOLETE -// OBSOLETE typedef struct -// OBSOLETE { -// OBSOLETE mach_msg_header_t Head; -// OBSOLETE } -// OBSOLETE Request; -// OBSOLETE -// OBSOLETE Request Mess; -// OBSOLETE -// OBSOLETE register Request *InP = &Mess; -// OBSOLETE -// OBSOLETE InP->Head.msgh_bits = MACH_MSGH_BITS (MACH_MSG_TYPE_COPY_SEND, 0); -// OBSOLETE -// OBSOLETE /* msgh_size passed as argument */ -// OBSOLETE InP->Head.msgh_remote_port = our_message_port; -// OBSOLETE InP->Head.msgh_local_port = MACH_PORT_NULL; -// OBSOLETE InP->Head.msgh_seqno = 0; -// OBSOLETE InP->Head.msgh_id = GDB_MESSAGE_ID_STOP; -// OBSOLETE -// OBSOLETE ret = mach_msg (&InP->Head, -// OBSOLETE MACH_SEND_MSG | MACH_MSG_OPTION_NONE, -// OBSOLETE sizeof (Request), -// OBSOLETE 0, -// OBSOLETE MACH_PORT_NULL, -// OBSOLETE MACH_MSG_TIMEOUT_NONE, -// OBSOLETE MACH_PORT_NULL); -// OBSOLETE } -// OBSOLETE -// OBSOLETE #ifdef THREAD_ALLOWED_TO_BREAK -// OBSOLETE /* -// OBSOLETE * Return 1 if the MID specifies the thread that caused the -// OBSOLETE * last exception. -// OBSOLETE * Since catch_exception_raise() selects the thread causing -// OBSOLETE * the last exception to current_thread, we just check that -// OBSOLETE * it is selected and the last exception was a breakpoint. -// OBSOLETE */ -// OBSOLETE int -// OBSOLETE mach_thread_for_breakpoint (int mid) -// OBSOLETE { -// OBSOLETE int cmid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); -// OBSOLETE -// OBSOLETE if (mid < 0) -// OBSOLETE { -// OBSOLETE mid = map_slot_to_mid (-(mid + 1), 0, 0); -// OBSOLETE if (mid < 0) -// OBSOLETE return 0; /* Don't stop, no such slot */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (!mid || cmid == -1) -// OBSOLETE return 1; /* stop */ -// OBSOLETE -// OBSOLETE return cmid == mid && stop_exception == EXC_BREAKPOINT; -// OBSOLETE } -// OBSOLETE #endif /* THREAD_ALLOWED_TO_BREAK */ -// OBSOLETE -// OBSOLETE #ifdef THREAD_PARSE_ID -// OBSOLETE /* -// OBSOLETE * Map a thread id string (MID or a @SLOTNUMBER) -// OBSOLETE * to a thread-id. -// OBSOLETE * -// OBSOLETE * 0 matches all threads. -// OBSOLETE * Otherwise the meaning is defined only in this file. -// OBSOLETE * (mach_thread_for_breakpoint uses it) -// OBSOLETE * -// OBSOLETE * @@ This allows non-existent MIDs to be specified. -// OBSOLETE * It now also allows non-existent slots to be -// OBSOLETE * specified. (Slot numbers stored are negative, -// OBSOLETE * and the magnitude is one greater than the actual -// OBSOLETE * slot index. (Since 0 is reserved)) -// OBSOLETE */ -// OBSOLETE int -// OBSOLETE mach_thread_parse_id (char *arg) -// OBSOLETE { -// OBSOLETE int mid; -// OBSOLETE if (arg == 0) -// OBSOLETE error ("thread id expected"); -// OBSOLETE mid = parse_thread_id (arg, 0, 1); -// OBSOLETE -// OBSOLETE return mid; -// OBSOLETE } -// OBSOLETE #endif /* THREAD_PARSE_ID */ -// OBSOLETE -// OBSOLETE #ifdef THREAD_OUTPUT_ID -// OBSOLETE char * -// OBSOLETE mach_thread_output_id (int mid) -// OBSOLETE { -// OBSOLETE static char foobar[20]; -// OBSOLETE -// OBSOLETE if (mid > 0) -// OBSOLETE sprintf (foobar, "mid %d", mid); -// OBSOLETE else if (mid < 0) -// OBSOLETE sprintf (foobar, "@%d", -(mid + 1)); -// OBSOLETE else -// OBSOLETE sprintf (foobar, "*any thread*"); -// OBSOLETE -// OBSOLETE return foobar; -// OBSOLETE } -// OBSOLETE #endif /* THREAD_OUTPUT_ID */ -// OBSOLETE -// OBSOLETE /* Called with hook PREPARE_TO_PROCEED() from infrun.c. -// OBSOLETE -// OBSOLETE * If we have switched threads and stopped at breakpoint return 1 otherwise 0. -// OBSOLETE * -// OBSOLETE * if SELECT_IT is nonzero, reselect the thread that was active when -// OBSOLETE * we stopped at a breakpoint. -// OBSOLETE * -// OBSOLETE * Note that this implementation is potentially redundant now that -// OBSOLETE * default_prepare_to_proceed() has been added. -// OBSOLETE * -// OBSOLETE * FIXME This may not support switching threads after Ctrl-C -// OBSOLETE * correctly. The default implementation does support this. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE mach3_prepare_to_proceed (int select_it) -// OBSOLETE { -// OBSOLETE if (stop_thread && -// OBSOLETE stop_thread != current_thread && -// OBSOLETE stop_exception == EXC_BREAKPOINT) -// OBSOLETE { -// OBSOLETE int mid; -// OBSOLETE -// OBSOLETE if (!select_it) -// OBSOLETE return 1; -// OBSOLETE -// OBSOLETE mid = switch_to_thread (stop_thread); -// OBSOLETE -// OBSOLETE return 1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* this stuff here is an upcall via libmach/excServer.c -// OBSOLETE and mach_really_wait which does the actual upcall. -// OBSOLETE -// OBSOLETE The code will pass the exception to the inferior if: -// OBSOLETE -// OBSOLETE - The task that signaled is not the inferior task -// OBSOLETE (e.g. when debugging another debugger) -// OBSOLETE -// OBSOLETE - The user has explicitely requested to pass on the exceptions. -// OBSOLETE (e.g to the default unix exception handler, which maps -// OBSOLETE exceptions to signals, or the user has her own exception handler) -// OBSOLETE -// OBSOLETE - If the thread that signaled is being single-stepped and it -// OBSOLETE has set it's own exception port and the exception is not -// OBSOLETE EXC_BREAKPOINT. (Maybe this is not desirable?) -// OBSOLETE */ -// OBSOLETE -// OBSOLETE kern_return_t -// OBSOLETE catch_exception_raise (mach_port_t port, thread_t thread, task_t task, -// OBSOLETE int exception, int code, int subcode) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE boolean_t signal_thread; -// OBSOLETE int mid = map_port_name_to_mid (thread, MACH_TYPE_THREAD); -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (thread)) -// OBSOLETE { -// OBSOLETE /* If the exception was sent and thread dies before we -// OBSOLETE receive it, THREAD will be MACH_PORT_DEAD -// OBSOLETE */ -// OBSOLETE -// OBSOLETE current_thread = thread = MACH_PORT_NULL; -// OBSOLETE error ("Received exception from nonexistent thread"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Check if the task died in transit. -// OBSOLETE * @@ Isn't the thread also invalid in such case? -// OBSOLETE */ -// OBSOLETE if (!MACH_PORT_VALID (task)) -// OBSOLETE { -// OBSOLETE current_thread = thread = MACH_PORT_NULL; -// OBSOLETE error ("Received exception from nonexistent task"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (exception < 0 || exception > MAX_EXCEPTION) -// OBSOLETE internal_error (__FILE__, __LINE__, -// OBSOLETE "catch_exception_raise: unknown exception code %d thread %d", -// OBSOLETE exception, -// OBSOLETE mid); -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (inferior_task)) -// OBSOLETE error ("got an exception, but inferior_task is null or dead"); -// OBSOLETE -// OBSOLETE stop_exception = exception; -// OBSOLETE stop_code = code; -// OBSOLETE stop_subcode = subcode; -// OBSOLETE stop_thread = thread; -// OBSOLETE -// OBSOLETE signal_thread = exception != EXC_BREAKPOINT && -// OBSOLETE port == singlestepped_thread_port && -// OBSOLETE MACH_PORT_VALID (thread_saved_exception_port); -// OBSOLETE -// OBSOLETE /* If it was not our inferior or if we want to forward -// OBSOLETE * the exception to the inferior's handler, do it here -// OBSOLETE * -// OBSOLETE * Note: If you have forwarded EXC_BREAKPOINT I trust you know why. -// OBSOLETE */ -// OBSOLETE if (task != inferior_task || -// OBSOLETE signal_thread || -// OBSOLETE exception_map[exception].forward) -// OBSOLETE { -// OBSOLETE mach_port_t eport = inferior_old_exception_port; -// OBSOLETE -// OBSOLETE if (signal_thread) -// OBSOLETE { -// OBSOLETE /* -// OBSOLETE GDB now forwards the exeption to thread's original handler, -// OBSOLETE since the user propably knows what he is doing. -// OBSOLETE Give a message, though. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE mach3_exception_actions ((WAITTYPE *) NULL, TRUE, "Thread"); -// OBSOLETE eport = thread_saved_exception_port; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Send the exception to the original handler */ -// OBSOLETE ret = exception_raise (eport, -// OBSOLETE thread, -// OBSOLETE task, -// OBSOLETE exception, -// OBSOLETE code, -// OBSOLETE subcode); -// OBSOLETE -// OBSOLETE (void) mach_port_deallocate (mach_task_self (), task); -// OBSOLETE (void) mach_port_deallocate (mach_task_self (), thread); -// OBSOLETE -// OBSOLETE /* If we come here, we don't want to trace any more, since we -// OBSOLETE * will never stop for tracing anyway. -// OBSOLETE */ -// OBSOLETE discard_single_step (thread); -// OBSOLETE -// OBSOLETE /* Do not stop the inferior */ -// OBSOLETE return ret; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Now gdb handles the exception */ -// OBSOLETE stopped_in_exception = TRUE; -// OBSOLETE -// OBSOLETE ret = task_suspend (task); -// OBSOLETE CHK ("Error suspending inferior after exception", ret); -// OBSOLETE -// OBSOLETE must_suspend_thread = 0; -// OBSOLETE -// OBSOLETE if (current_thread != thread) -// OBSOLETE { -// OBSOLETE if (MACH_PORT_VALID (singlestepped_thread_port)) -// OBSOLETE /* Cleanup discards single stepping */ -// OBSOLETE error ("Exception from thread %d while singlestepping thread %d", -// OBSOLETE mid, -// OBSOLETE map_port_name_to_mid (current_thread, MACH_TYPE_THREAD)); -// OBSOLETE -// OBSOLETE /* Then select the thread that caused the exception */ -// OBSOLETE if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) -// OBSOLETE error ("Could not select thread %d causing exception", mid); -// OBSOLETE else -// OBSOLETE warning ("Gdb selected thread %d", mid); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* If we receive an exception that is not breakpoint -// OBSOLETE * exception, we interrupt the single step and return to -// OBSOLETE * debugger. Trace condition is cleared. -// OBSOLETE */ -// OBSOLETE if (MACH_PORT_VALID (singlestepped_thread_port)) -// OBSOLETE { -// OBSOLETE if (stop_exception != EXC_BREAKPOINT) -// OBSOLETE warning ("Single step interrupted by exception"); -// OBSOLETE else if (port == singlestepped_thread_port) -// OBSOLETE { -// OBSOLETE /* Single step exception occurred, remove trace bit -// OBSOLETE * and return to gdb. -// OBSOLETE */ -// OBSOLETE if (!MACH_PORT_VALID (current_thread)) -// OBSOLETE error ("Single stepped thread is not valid"); -// OBSOLETE -// OBSOLETE /* Resume threads, but leave the task suspended */ -// OBSOLETE resume_all_threads (0); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE warning ("Breakpoint while single stepping?"); -// OBSOLETE -// OBSOLETE discard_single_step (current_thread); -// OBSOLETE } -// OBSOLETE -// OBSOLETE (void) mach_port_deallocate (mach_task_self (), task); -// OBSOLETE (void) mach_port_deallocate (mach_task_self (), thread); -// OBSOLETE -// OBSOLETE return KERN_SUCCESS; -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE port_valid (mach_port_t port, int mask) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE mach_port_type_t type; -// OBSOLETE -// OBSOLETE ret = mach_port_type (mach_task_self (), -// OBSOLETE port, -// OBSOLETE &type); -// OBSOLETE if (ret != KERN_SUCCESS || (type & mask) != mask) -// OBSOLETE return 0; -// OBSOLETE return 1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* @@ No vm read cache implemented yet */ -// OBSOLETE boolean_t vm_read_cache_valid = FALSE; -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Read inferior task's LEN bytes from ADDR and copy it to MYADDR -// OBSOLETE * in gdb's address space. -// OBSOLETE * -// OBSOLETE * Return 0 on failure; number of bytes read otherwise. -// OBSOLETE */ -// OBSOLETE int -// OBSOLETE mach3_read_inferior (CORE_ADDR addr, char *myaddr, int length) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE vm_address_t low_address = (vm_address_t) trunc_page (addr); -// OBSOLETE vm_size_t aligned_length = -// OBSOLETE (vm_size_t) round_page (addr + length) - low_address; -// OBSOLETE pointer_t copied_memory; -// OBSOLETE int copy_count; -// OBSOLETE -// OBSOLETE /* Get memory from inferior with page aligned addresses */ -// OBSOLETE ret = vm_read (inferior_task, -// OBSOLETE low_address, -// OBSOLETE aligned_length, -// OBSOLETE &copied_memory, -// OBSOLETE ©_count); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE /* the problem is that the inferior might be killed for whatever reason -// OBSOLETE * before we go to mach_really_wait. This is one place that ought to -// OBSOLETE * catch many of those errors. -// OBSOLETE * @@ A better fix would be to make all external events to GDB -// OBSOLETE * to arrive via a SINGLE port set. (Including user input!) -// OBSOLETE */ -// OBSOLETE -// OBSOLETE if (!port_valid (inferior_task, MACH_PORT_TYPE_SEND)) -// OBSOLETE { -// OBSOLETE m3_kill_inferior (); -// OBSOLETE error ("Inferior killed (task port invalid)"); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE #ifdef OSF -// OBSOLETE extern int errno; -// OBSOLETE /* valprint.c gives nicer format if this does not -// OBSOLETE screw it. Eamonn seems to like this, so I enable -// OBSOLETE it if OSF is defined... -// OBSOLETE */ -// OBSOLETE warning ("[read inferior %x failed: %s]", -// OBSOLETE addr, mach_error_string (ret)); -// OBSOLETE errno = 0; -// OBSOLETE #endif -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE memcpy (myaddr, (char *) addr - low_address + copied_memory, length); -// OBSOLETE -// OBSOLETE ret = vm_deallocate (mach_task_self (), -// OBSOLETE copied_memory, -// OBSOLETE copy_count); -// OBSOLETE CHK ("mach3_read_inferior vm_deallocate failed", ret); -// OBSOLETE -// OBSOLETE return length; -// OBSOLETE } -// OBSOLETE -// OBSOLETE #define CHK_GOTO_OUT(str,ret) \ -// OBSOLETE do if (ret != KERN_SUCCESS) { errstr = #str; goto out; } while(0) -// OBSOLETE -// OBSOLETE struct vm_region_list -// OBSOLETE { -// OBSOLETE struct vm_region_list *next; -// OBSOLETE vm_prot_t protection; -// OBSOLETE vm_address_t start; -// OBSOLETE vm_size_t length; -// OBSOLETE }; -// OBSOLETE -// OBSOLETE struct obstack region_obstack; -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Write inferior task's LEN bytes from ADDR and copy it to MYADDR -// OBSOLETE * in gdb's address space. -// OBSOLETE */ -// OBSOLETE int -// OBSOLETE mach3_write_inferior (CORE_ADDR addr, char *myaddr, int length) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE vm_address_t low_address = (vm_address_t) trunc_page (addr); -// OBSOLETE vm_size_t aligned_length = -// OBSOLETE (vm_size_t) round_page (addr + length) - low_address; -// OBSOLETE pointer_t copied_memory; -// OBSOLETE int copy_count; -// OBSOLETE int deallocate = 0; -// OBSOLETE -// OBSOLETE char *errstr = "Bug in mach3_write_inferior"; -// OBSOLETE -// OBSOLETE struct vm_region_list *region_element; -// OBSOLETE struct vm_region_list *region_head = (struct vm_region_list *) NULL; -// OBSOLETE -// OBSOLETE /* Get memory from inferior with page aligned addresses */ -// OBSOLETE ret = vm_read (inferior_task, -// OBSOLETE low_address, -// OBSOLETE aligned_length, -// OBSOLETE &copied_memory, -// OBSOLETE ©_count); -// OBSOLETE CHK_GOTO_OUT ("mach3_write_inferior vm_read failed", ret); -// OBSOLETE -// OBSOLETE deallocate++; -// OBSOLETE -// OBSOLETE memcpy ((char *) addr - low_address + copied_memory, myaddr, length); -// OBSOLETE -// OBSOLETE obstack_init (®ion_obstack); -// OBSOLETE -// OBSOLETE /* Do writes atomically. -// OBSOLETE * First check for holes and unwritable memory. -// OBSOLETE */ -// OBSOLETE { -// OBSOLETE vm_size_t remaining_length = aligned_length; -// OBSOLETE vm_address_t region_address = low_address; -// OBSOLETE -// OBSOLETE struct vm_region_list *scan; -// OBSOLETE -// OBSOLETE while (region_address < low_address + aligned_length) -// OBSOLETE { -// OBSOLETE vm_prot_t protection; -// OBSOLETE vm_prot_t max_protection; -// OBSOLETE vm_inherit_t inheritance; -// OBSOLETE boolean_t shared; -// OBSOLETE mach_port_t object_name; -// OBSOLETE vm_offset_t offset; -// OBSOLETE vm_size_t region_length = remaining_length; -// OBSOLETE vm_address_t old_address = region_address; -// OBSOLETE -// OBSOLETE ret = vm_region (inferior_task, -// OBSOLETE ®ion_address, -// OBSOLETE ®ion_length, -// OBSOLETE &protection, -// OBSOLETE &max_protection, -// OBSOLETE &inheritance, -// OBSOLETE &shared, -// OBSOLETE &object_name, -// OBSOLETE &offset); -// OBSOLETE CHK_GOTO_OUT ("vm_region failed", ret); -// OBSOLETE -// OBSOLETE /* Check for holes in memory */ -// OBSOLETE if (old_address != region_address) -// OBSOLETE { -// OBSOLETE warning ("No memory at 0x%x. Nothing written", -// OBSOLETE old_address); -// OBSOLETE ret = KERN_SUCCESS; -// OBSOLETE length = 0; -// OBSOLETE goto out; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (!(max_protection & VM_PROT_WRITE)) -// OBSOLETE { -// OBSOLETE warning ("Memory at address 0x%x is unwritable. Nothing written", -// OBSOLETE old_address); -// OBSOLETE ret = KERN_SUCCESS; -// OBSOLETE length = 0; -// OBSOLETE goto out; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Chain the regions for later use */ -// OBSOLETE region_element = -// OBSOLETE (struct vm_region_list *) -// OBSOLETE obstack_alloc (®ion_obstack, sizeof (struct vm_region_list)); -// OBSOLETE -// OBSOLETE region_element->protection = protection; -// OBSOLETE region_element->start = region_address; -// OBSOLETE region_element->length = region_length; -// OBSOLETE -// OBSOLETE /* Chain the regions along with protections */ -// OBSOLETE region_element->next = region_head; -// OBSOLETE region_head = region_element; -// OBSOLETE -// OBSOLETE region_address += region_length; -// OBSOLETE remaining_length = remaining_length - region_length; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* If things fail after this, we give up. -// OBSOLETE * Somebody is messing up inferior_task's mappings. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE /* Enable writes to the chained vm regions */ -// OBSOLETE for (scan = region_head; scan; scan = scan->next) -// OBSOLETE { -// OBSOLETE boolean_t protection_changed = FALSE; -// OBSOLETE -// OBSOLETE if (!(scan->protection & VM_PROT_WRITE)) -// OBSOLETE { -// OBSOLETE ret = vm_protect (inferior_task, -// OBSOLETE scan->start, -// OBSOLETE scan->length, -// OBSOLETE FALSE, -// OBSOLETE scan->protection | VM_PROT_WRITE); -// OBSOLETE CHK_GOTO_OUT ("vm_protect: enable write failed", ret); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE ret = vm_write (inferior_task, -// OBSOLETE low_address, -// OBSOLETE copied_memory, -// OBSOLETE aligned_length); -// OBSOLETE CHK_GOTO_OUT ("vm_write failed", ret); -// OBSOLETE -// OBSOLETE /* Set up the original region protections, if they were changed */ -// OBSOLETE for (scan = region_head; scan; scan = scan->next) -// OBSOLETE { -// OBSOLETE boolean_t protection_changed = FALSE; -// OBSOLETE -// OBSOLETE if (!(scan->protection & VM_PROT_WRITE)) -// OBSOLETE { -// OBSOLETE ret = vm_protect (inferior_task, -// OBSOLETE scan->start, -// OBSOLETE scan->length, -// OBSOLETE FALSE, -// OBSOLETE scan->protection); -// OBSOLETE CHK_GOTO_OUT ("vm_protect: enable write failed", ret); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE out: -// OBSOLETE if (deallocate) -// OBSOLETE { -// OBSOLETE obstack_free (®ion_obstack, 0); -// OBSOLETE -// OBSOLETE (void) vm_deallocate (mach_task_self (), -// OBSOLETE copied_memory, -// OBSOLETE copy_count); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE warning ("%s %s", errstr, mach_error_string (ret)); -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE return length; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Return 0 on failure, number of bytes handled otherwise. TARGET is -// OBSOLETE ignored. */ -// OBSOLETE static int -// OBSOLETE m3_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, -// OBSOLETE struct target_ops *target) -// OBSOLETE { -// OBSOLETE int result; -// OBSOLETE -// OBSOLETE if (write) -// OBSOLETE result = mach3_write_inferior (memaddr, myaddr, len); -// OBSOLETE else -// OBSOLETE result = mach3_read_inferior (memaddr, myaddr, len); -// OBSOLETE -// OBSOLETE return result; -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE static char * -// OBSOLETE translate_state (int state) -// OBSOLETE { -// OBSOLETE switch (state) -// OBSOLETE { -// OBSOLETE case TH_STATE_RUNNING: -// OBSOLETE return ("R"); -// OBSOLETE case TH_STATE_STOPPED: -// OBSOLETE return ("S"); -// OBSOLETE case TH_STATE_WAITING: -// OBSOLETE return ("W"); -// OBSOLETE case TH_STATE_UNINTERRUPTIBLE: -// OBSOLETE return ("U"); -// OBSOLETE case TH_STATE_HALTED: -// OBSOLETE return ("H"); -// OBSOLETE default: -// OBSOLETE return ("?"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static char * -// OBSOLETE translate_cstate (int state) -// OBSOLETE { -// OBSOLETE switch (state) -// OBSOLETE { -// OBSOLETE case CPROC_RUNNING: -// OBSOLETE return "R"; -// OBSOLETE case CPROC_SWITCHING: -// OBSOLETE return "S"; -// OBSOLETE case CPROC_BLOCKED: -// OBSOLETE return "B"; -// OBSOLETE case CPROC_CONDWAIT: -// OBSOLETE return "C"; -// OBSOLETE case CPROC_CONDWAIT | CPROC_SWITCHING: -// OBSOLETE return "CS"; -// OBSOLETE default: -// OBSOLETE return "?"; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* type == MACH_MSG_TYPE_COPY_SEND || type == MACH_MSG_TYPE_MAKE_SEND */ -// OBSOLETE -// OBSOLETE mach_port_t /* no mach_port_name_t found in include files. */ -// OBSOLETE map_inferior_port_name (mach_port_t inferior_name, mach_msg_type_name_t type) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE mach_msg_type_name_t acquired; -// OBSOLETE mach_port_t iport; -// OBSOLETE -// OBSOLETE ret = mach_port_extract_right (inferior_task, -// OBSOLETE inferior_name, -// OBSOLETE type, -// OBSOLETE &iport, -// OBSOLETE &acquired); -// OBSOLETE CHK ("mach_port_extract_right (map_inferior_port_name)", ret); -// OBSOLETE -// OBSOLETE if (acquired != MACH_MSG_TYPE_PORT_SEND) -// OBSOLETE error ("Incorrect right extracted, (map_inferior_port_name)"); -// OBSOLETE -// OBSOLETE ret = mach_port_deallocate (mach_task_self (), -// OBSOLETE iport); -// OBSOLETE CHK ("Deallocating mapped port (map_inferior_port_name)", ret); -// OBSOLETE -// OBSOLETE return iport; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Naming convention: -// OBSOLETE * Always return user defined name if found. -// OBSOLETE * _K == A kernel thread with no matching CPROC -// OBSOLETE * _C == A cproc with no current cthread -// OBSOLETE * _t == A cthread with no user defined name -// OBSOLETE * -// OBSOLETE * The digits that follow the _names are the SLOT number of the -// OBSOLETE * kernel thread if there is such a thing, otherwise just a negation -// OBSOLETE * of the sequential number of such cprocs. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE static char buf[7]; -// OBSOLETE -// OBSOLETE static char * -// OBSOLETE get_thread_name (gdb_thread_t one_cproc, int id) -// OBSOLETE { -// OBSOLETE if (one_cproc) -// OBSOLETE if (one_cproc->cthread == NULL) -// OBSOLETE { -// OBSOLETE /* cproc not mapped to any cthread */ -// OBSOLETE sprintf (buf, "_C%d", id); -// OBSOLETE } -// OBSOLETE else if (!one_cproc->cthread->name) -// OBSOLETE { -// OBSOLETE /* cproc and cthread, but no name */ -// OBSOLETE sprintf (buf, "_t%d", id); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE return (char *) (one_cproc->cthread->name); -// OBSOLETE else -// OBSOLETE { -// OBSOLETE if (id < 0) -// OBSOLETE warning ("Inconsistency in thread name id %d", id); -// OBSOLETE -// OBSOLETE /* Kernel thread without cproc */ -// OBSOLETE sprintf (buf, "_K%d", id); -// OBSOLETE } -// OBSOLETE -// OBSOLETE return buf; -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE fetch_thread_info (mach_port_t task, gdb_thread_t *mthreads_out) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE thread_array_t th_table; -// OBSOLETE int th_count; -// OBSOLETE gdb_thread_t mthreads = NULL; -// OBSOLETE int index; -// OBSOLETE -// OBSOLETE ret = task_threads (task, &th_table, &th_count); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE warning ("Error getting inferior's thread list:%s", -// OBSOLETE mach_error_string (ret)); -// OBSOLETE m3_kill_inferior (); -// OBSOLETE return -1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE mthreads = (gdb_thread_t) -// OBSOLETE obstack_alloc -// OBSOLETE (cproc_obstack, -// OBSOLETE th_count * sizeof (struct gdb_thread)); -// OBSOLETE -// OBSOLETE for (index = 0; index < th_count; index++) -// OBSOLETE { -// OBSOLETE thread_t saved_thread = MACH_PORT_NULL; -// OBSOLETE int mid; -// OBSOLETE -// OBSOLETE if (must_suspend_thread) -// OBSOLETE setup_thread (th_table[index], 1); -// OBSOLETE -// OBSOLETE if (th_table[index] != current_thread) -// OBSOLETE { -// OBSOLETE saved_thread = current_thread; -// OBSOLETE -// OBSOLETE mid = switch_to_thread (th_table[index]); -// OBSOLETE } -// OBSOLETE -// OBSOLETE mthreads[index].name = th_table[index]; -// OBSOLETE mthreads[index].cproc = NULL; /* map_cprocs_to_kernel_threads() */ -// OBSOLETE mthreads[index].in_emulator = FALSE; -// OBSOLETE mthreads[index].slotid = index; -// OBSOLETE -// OBSOLETE mthreads[index].sp = read_register (SP_REGNUM); -// OBSOLETE mthreads[index].fp = read_register (FP_REGNUM); -// OBSOLETE mthreads[index].pc = read_pc (); -// OBSOLETE -// OBSOLETE if (MACH_PORT_VALID (saved_thread)) -// OBSOLETE mid = switch_to_thread (saved_thread); -// OBSOLETE -// OBSOLETE if (must_suspend_thread) -// OBSOLETE setup_thread (th_table[index], 0); -// OBSOLETE } -// OBSOLETE -// OBSOLETE consume_send_rights (th_table, th_count); -// OBSOLETE ret = vm_deallocate (mach_task_self (), (vm_address_t) th_table, -// OBSOLETE (th_count * sizeof (mach_port_t))); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE warning ("Error trying to deallocate thread list : %s", -// OBSOLETE mach_error_string (ret)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE *mthreads_out = mthreads; -// OBSOLETE -// OBSOLETE return th_count; -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Current emulator always saves the USP on top of -// OBSOLETE * emulator stack below struct emul_stack_top stuff. -// OBSOLETE */ -// OBSOLETE CORE_ADDR -// OBSOLETE fetch_usp_from_emulator_stack (CORE_ADDR sp) -// OBSOLETE { -// OBSOLETE CORE_ADDR stack_pointer; -// OBSOLETE -// OBSOLETE sp = (sp & ~(EMULATOR_STACK_SIZE - 1)) + -// OBSOLETE EMULATOR_STACK_SIZE - sizeof (struct emul_stack_top); -// OBSOLETE -// OBSOLETE if (mach3_read_inferior (sp, -// OBSOLETE &stack_pointer, -// OBSOLETE sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) -// OBSOLETE { -// OBSOLETE warning ("Can't read user sp from emulator stack address 0x%x", sp); -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE return stack_pointer; -// OBSOLETE } -// OBSOLETE -// OBSOLETE #ifdef MK67 -// OBSOLETE -// OBSOLETE /* get_emulation_vector() interface was changed after mk67 */ -// OBSOLETE #define EMUL_VECTOR_COUNT 400 /* Value does not matter too much */ -// OBSOLETE -// OBSOLETE #endif /* MK67 */ -// OBSOLETE -// OBSOLETE /* Check if the emulator exists at task's address space. -// OBSOLETE */ -// OBSOLETE boolean_t -// OBSOLETE have_emulator_p (task_t task) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE #ifndef EMUL_VECTOR_COUNT -// OBSOLETE vm_offset_t *emulation_vector; -// OBSOLETE int n; -// OBSOLETE #else -// OBSOLETE vm_offset_t emulation_vector[EMUL_VECTOR_COUNT]; -// OBSOLETE int n = EMUL_VECTOR_COUNT; -// OBSOLETE #endif -// OBSOLETE int i; -// OBSOLETE int vector_start; -// OBSOLETE -// OBSOLETE ret = task_get_emulation_vector (task, -// OBSOLETE &vector_start, -// OBSOLETE #ifndef EMUL_VECTOR_COUNT -// OBSOLETE &emulation_vector, -// OBSOLETE #else -// OBSOLETE emulation_vector, -// OBSOLETE #endif -// OBSOLETE &n); -// OBSOLETE CHK ("task_get_emulation_vector", ret); -// OBSOLETE xx_debug ("%d vectors from %d at 0x%08x\n", -// OBSOLETE n, vector_start, emulation_vector); -// OBSOLETE -// OBSOLETE for (i = 0; i < n; i++) -// OBSOLETE { -// OBSOLETE vm_offset_t entry = emulation_vector[i]; -// OBSOLETE -// OBSOLETE if (EMULATOR_BASE <= entry && entry <= EMULATOR_END) -// OBSOLETE return TRUE; -// OBSOLETE else if (entry) -// OBSOLETE { -// OBSOLETE static boolean_t informed = FALSE; -// OBSOLETE if (!informed) -// OBSOLETE { -// OBSOLETE warning ("Emulation vector address 0x08%x outside emulator space", -// OBSOLETE entry); -// OBSOLETE informed = TRUE; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE return FALSE; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Map cprocs to kernel threads and vice versa. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE map_cprocs_to_kernel_threads (gdb_thread_t cprocs, gdb_thread_t mthreads, -// OBSOLETE int thread_count) -// OBSOLETE { -// OBSOLETE int index; -// OBSOLETE gdb_thread_t scan; -// OBSOLETE boolean_t all_mapped = TRUE; -// OBSOLETE LONGEST stack_base; -// OBSOLETE LONGEST stack_size; -// OBSOLETE -// OBSOLETE for (scan = cprocs; scan; scan = scan->next) -// OBSOLETE { -// OBSOLETE /* Default to: no kernel thread for this cproc */ -// OBSOLETE scan->reverse_map = -1; -// OBSOLETE -// OBSOLETE /* Check if the cproc is found by its stack */ -// OBSOLETE for (index = 0; index < thread_count; index++) -// OBSOLETE { -// OBSOLETE stack_base = -// OBSOLETE extract_signed_integer (scan->raw_cproc + CPROC_BASE_OFFSET, -// OBSOLETE CPROC_BASE_SIZE); -// OBSOLETE stack_size = -// OBSOLETE extract_signed_integer (scan->raw_cproc + CPROC_SIZE_OFFSET, -// OBSOLETE CPROC_SIZE_SIZE); -// OBSOLETE if ((mthreads + index)->sp > stack_base && -// OBSOLETE (mthreads + index)->sp <= stack_base + stack_size) -// OBSOLETE { -// OBSOLETE (mthreads + index)->cproc = scan; -// OBSOLETE scan->reverse_map = index; -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE all_mapped &= (scan->reverse_map != -1); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Check for threads that are currently in the emulator. -// OBSOLETE * If so, they have a different stack, and the still unmapped -// OBSOLETE * cprocs may well get mapped to these threads. -// OBSOLETE * -// OBSOLETE * If: -// OBSOLETE * - cproc stack does not match any kernel thread stack pointer -// OBSOLETE * - there is at least one extra kernel thread -// OBSOLETE * that has no cproc mapped above. -// OBSOLETE * - some kernel thread stack pointer points to emulator space -// OBSOLETE * then we find the user stack pointer saved in the emulator -// OBSOLETE * stack, and try to map that to the cprocs. -// OBSOLETE * -// OBSOLETE * Also set in_emulator for kernel threads. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE if (emulator_present) -// OBSOLETE { -// OBSOLETE for (index = 0; index < thread_count; index++) -// OBSOLETE { -// OBSOLETE CORE_ADDR emul_sp; -// OBSOLETE CORE_ADDR usp; -// OBSOLETE -// OBSOLETE gdb_thread_t mthread = (mthreads + index); -// OBSOLETE emul_sp = mthread->sp; -// OBSOLETE -// OBSOLETE if (mthread->cproc == NULL && -// OBSOLETE EMULATOR_BASE <= emul_sp && emul_sp <= EMULATOR_END) -// OBSOLETE { -// OBSOLETE mthread->in_emulator = emulator_present; -// OBSOLETE -// OBSOLETE if (!all_mapped && cprocs) -// OBSOLETE { -// OBSOLETE usp = fetch_usp_from_emulator_stack (emul_sp); -// OBSOLETE -// OBSOLETE /* @@ Could be more accurate */ -// OBSOLETE if (!usp) -// OBSOLETE error ("Zero stack pointer read from emulator?"); -// OBSOLETE -// OBSOLETE /* Try to match this stack pointer to the cprocs that -// OBSOLETE * don't yet have a kernel thread. -// OBSOLETE */ -// OBSOLETE for (scan = cprocs; scan; scan = scan->next) -// OBSOLETE { -// OBSOLETE -// OBSOLETE /* Check is this unmapped CPROC stack contains -// OBSOLETE * the user stack pointer saved in the -// OBSOLETE * emulator. -// OBSOLETE */ -// OBSOLETE if (scan->reverse_map == -1) -// OBSOLETE { -// OBSOLETE stack_base = -// OBSOLETE extract_signed_integer -// OBSOLETE (scan->raw_cproc + CPROC_BASE_OFFSET, -// OBSOLETE CPROC_BASE_SIZE); -// OBSOLETE stack_size = -// OBSOLETE extract_signed_integer -// OBSOLETE (scan->raw_cproc + CPROC_SIZE_OFFSET, -// OBSOLETE CPROC_SIZE_SIZE); -// OBSOLETE if (usp > stack_base && -// OBSOLETE usp <= stack_base + stack_size) -// OBSOLETE { -// OBSOLETE mthread->cproc = scan; -// OBSOLETE scan->reverse_map = index; -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Format of the thread_list command -// OBSOLETE * -// OBSOLETE * slot mid sel name emul ks susp cstate wired address -// OBSOLETE */ -// OBSOLETE #define TL_FORMAT "%-2.2s %5d%c %-10.10s %1.1s%s%-5.5s %-2.2s %-5.5s " -// OBSOLETE -// OBSOLETE #define TL_HEADER "\n@ MID Name KState CState Where\n" -// OBSOLETE -// OBSOLETE void -// OBSOLETE print_tl_address (struct ui_file *stream, CORE_ADDR pc) -// OBSOLETE { -// OBSOLETE if (!lookup_minimal_symbol_by_pc (pc)) -// OBSOLETE fprintf_filtered (stream, local_hex_format (), pc); -// OBSOLETE else -// OBSOLETE { -// OBSOLETE extern int addressprint; -// OBSOLETE extern int asm_demangle; -// OBSOLETE -// OBSOLETE int store = addressprint; -// OBSOLETE addressprint = 0; -// OBSOLETE print_address_symbolic (pc, stream, asm_demangle, ""); -// OBSOLETE addressprint = store; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* For thread names, but also for gdb_message_port external name */ -// OBSOLETE #define MAX_NAME_LEN 50 -// OBSOLETE -// OBSOLETE /* Returns the address of variable NAME or 0 if not found */ -// OBSOLETE CORE_ADDR -// OBSOLETE lookup_address_of_variable (char *name) -// OBSOLETE { -// OBSOLETE struct symbol *sym; -// OBSOLETE CORE_ADDR symaddr = 0; -// OBSOLETE struct minimal_symbol *msymbol; -// OBSOLETE -// OBSOLETE sym = lookup_symbol (name, -// OBSOLETE (struct block *) NULL, -// OBSOLETE VAR_DOMAIN, -// OBSOLETE (int *) NULL, -// OBSOLETE (struct symtab **) NULL); -// OBSOLETE -// OBSOLETE if (sym) -// OBSOLETE symaddr = SYMBOL_VALUE (sym); -// OBSOLETE -// OBSOLETE if (!symaddr) -// OBSOLETE { -// OBSOLETE msymbol = lookup_minimal_symbol (name, NULL, NULL); -// OBSOLETE -// OBSOLETE if (msymbol && msymbol->type == mst_data) -// OBSOLETE symaddr = SYMBOL_VALUE_ADDRESS (msymbol); -// OBSOLETE } -// OBSOLETE -// OBSOLETE return symaddr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static gdb_thread_t -// OBSOLETE get_cprocs (void) -// OBSOLETE { -// OBSOLETE gdb_thread_t cproc_head; -// OBSOLETE gdb_thread_t cproc_copy; -// OBSOLETE CORE_ADDR their_cprocs; -// OBSOLETE char *buf; -// OBSOLETE char *name; -// OBSOLETE cthread_t cthread; -// OBSOLETE CORE_ADDR symaddr; -// OBSOLETE -// OBSOLETE buf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT); -// OBSOLETE symaddr = lookup_address_of_variable ("cproc_list"); -// OBSOLETE -// OBSOLETE if (!symaddr) -// OBSOLETE { -// OBSOLETE /* cproc_list is not in a file compiled with debugging -// OBSOLETE symbols, but don't give up yet */ -// OBSOLETE -// OBSOLETE symaddr = lookup_address_of_variable ("cprocs"); -// OBSOLETE -// OBSOLETE if (symaddr) -// OBSOLETE { -// OBSOLETE static int informed = 0; -// OBSOLETE if (!informed) -// OBSOLETE { -// OBSOLETE informed++; -// OBSOLETE warning ("Your program is loaded with an old threads library."); -// OBSOLETE warning ("GDB does not know the old form of threads"); -// OBSOLETE warning ("so things may not work."); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Stripped or no -lthreads loaded or "cproc_list" is in wrong segment. */ -// OBSOLETE if (!symaddr) -// OBSOLETE return NULL; -// OBSOLETE -// OBSOLETE /* Get the address of the first cproc in the task */ -// OBSOLETE if (!mach3_read_inferior (symaddr, -// OBSOLETE buf, -// OBSOLETE TARGET_PTR_BIT / HOST_CHAR_BIT)) -// OBSOLETE error ("Can't read cproc master list at address (0x%x).", symaddr); -// OBSOLETE their_cprocs = extract_address (buf, TARGET_PTR_BIT / HOST_CHAR_BIT); -// OBSOLETE -// OBSOLETE /* Scan the CPROCs in the task. -// OBSOLETE CPROCs are chained with LIST field, not NEXT field, which -// OBSOLETE chains mutexes, condition variables and queues */ -// OBSOLETE -// OBSOLETE cproc_head = NULL; -// OBSOLETE -// OBSOLETE while (their_cprocs != (CORE_ADDR) 0) -// OBSOLETE { -// OBSOLETE CORE_ADDR cproc_copy_incarnation; -// OBSOLETE cproc_copy = (gdb_thread_t) obstack_alloc (cproc_obstack, -// OBSOLETE sizeof (struct gdb_thread)); -// OBSOLETE -// OBSOLETE if (!mach3_read_inferior (their_cprocs, -// OBSOLETE &cproc_copy->raw_cproc[0], -// OBSOLETE CPROC_SIZE)) -// OBSOLETE error ("Can't read next cproc at 0x%x.", their_cprocs); -// OBSOLETE -// OBSOLETE their_cprocs = -// OBSOLETE extract_address (cproc_copy->raw_cproc + CPROC_LIST_OFFSET, -// OBSOLETE CPROC_LIST_SIZE); -// OBSOLETE cproc_copy_incarnation = -// OBSOLETE extract_address (cproc_copy->raw_cproc + CPROC_INCARNATION_OFFSET, -// OBSOLETE CPROC_INCARNATION_SIZE); -// OBSOLETE -// OBSOLETE if (cproc_copy_incarnation == (CORE_ADDR) 0) -// OBSOLETE cproc_copy->cthread = NULL; -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* This CPROC has an attached CTHREAD. Get its name */ -// OBSOLETE cthread = (cthread_t) obstack_alloc (cproc_obstack, -// OBSOLETE sizeof (struct cthread)); -// OBSOLETE -// OBSOLETE if (!mach3_read_inferior (cproc_copy_incarnation, -// OBSOLETE cthread, -// OBSOLETE sizeof (struct cthread))) -// OBSOLETE error ("Can't read next thread at 0x%x.", -// OBSOLETE cproc_copy_incarnation); -// OBSOLETE -// OBSOLETE cproc_copy->cthread = cthread; -// OBSOLETE -// OBSOLETE if (cthread->name) -// OBSOLETE { -// OBSOLETE name = (char *) obstack_alloc (cproc_obstack, MAX_NAME_LEN); -// OBSOLETE -// OBSOLETE if (!mach3_read_inferior (cthread->name, name, MAX_NAME_LEN)) -// OBSOLETE error ("Can't read next thread's name at 0x%x.", cthread->name); -// OBSOLETE -// OBSOLETE cthread->name = name; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* insert in front */ -// OBSOLETE cproc_copy->next = cproc_head; -// OBSOLETE cproc_head = cproc_copy; -// OBSOLETE } -// OBSOLETE return cproc_head; -// OBSOLETE } -// OBSOLETE -// OBSOLETE #ifndef FETCH_CPROC_STATE -// OBSOLETE /* -// OBSOLETE * Check if your machine does not grok the way this routine -// OBSOLETE * fetches the FP,PC and SP of a cproc that is not -// OBSOLETE * currently attached to any kernel thread (e.g. its cproc.context -// OBSOLETE * field points to the place in stack where the context -// OBSOLETE * is saved). -// OBSOLETE * -// OBSOLETE * If it doesn't, define your own routine. -// OBSOLETE */ -// OBSOLETE #define FETCH_CPROC_STATE(mth) mach3_cproc_state (mth) -// OBSOLETE -// OBSOLETE int -// OBSOLETE mach3_cproc_state (gdb_thread_t mthread) -// OBSOLETE { -// OBSOLETE int context; -// OBSOLETE -// OBSOLETE if (!mthread || !mthread->cproc) -// OBSOLETE return -1; -// OBSOLETE -// OBSOLETE context = extract_signed_integer -// OBSOLETE (mthread->cproc->raw_cproc + CPROC_CONTEXT_OFFSET, -// OBSOLETE CPROC_CONTEXT_SIZE); -// OBSOLETE if (context == 0) -// OBSOLETE return -1; -// OBSOLETE -// OBSOLETE mthread->sp = context + MACHINE_CPROC_SP_OFFSET; -// OBSOLETE -// OBSOLETE if (mach3_read_inferior (context + MACHINE_CPROC_PC_OFFSET, -// OBSOLETE &mthread->pc, -// OBSOLETE sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) -// OBSOLETE { -// OBSOLETE warning ("Can't read cproc pc from inferior"); -// OBSOLETE return -1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (mach3_read_inferior (context + MACHINE_CPROC_FP_OFFSET, -// OBSOLETE &mthread->fp, -// OBSOLETE sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) -// OBSOLETE { -// OBSOLETE warning ("Can't read cproc fp from inferior"); -// OBSOLETE return -1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE #endif /* FETCH_CPROC_STATE */ -// OBSOLETE -// OBSOLETE -// OBSOLETE void -// OBSOLETE thread_list_command (void) -// OBSOLETE { -// OBSOLETE thread_basic_info_data_t ths; -// OBSOLETE int thread_count; -// OBSOLETE gdb_thread_t cprocs; -// OBSOLETE gdb_thread_t scan; -// OBSOLETE int index; -// OBSOLETE char *name; -// OBSOLETE char selected; -// OBSOLETE char *wired; -// OBSOLETE int infoCnt; -// OBSOLETE kern_return_t ret; -// OBSOLETE mach_port_t mid_or_port; -// OBSOLETE gdb_thread_t their_threads; -// OBSOLETE gdb_thread_t kthread; -// OBSOLETE -// OBSOLETE int neworder = 1; -// OBSOLETE -// OBSOLETE char *fmt = "There are %d kernel threads in task %d.\n"; -// OBSOLETE -// OBSOLETE int tmid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK); -// OBSOLETE -// OBSOLETE MACH_ERROR_NO_INFERIOR; -// OBSOLETE -// OBSOLETE thread_count = fetch_thread_info (inferior_task, -// OBSOLETE &their_threads); -// OBSOLETE if (thread_count == -1) -// OBSOLETE return; -// OBSOLETE -// OBSOLETE if (thread_count == 1) -// OBSOLETE fmt = "There is %d kernel thread in task %d.\n"; -// OBSOLETE -// OBSOLETE printf_filtered (fmt, thread_count, tmid); -// OBSOLETE -// OBSOLETE puts_filtered (TL_HEADER); -// OBSOLETE -// OBSOLETE cprocs = get_cprocs (); -// OBSOLETE -// OBSOLETE map_cprocs_to_kernel_threads (cprocs, their_threads, thread_count); -// OBSOLETE -// OBSOLETE for (scan = cprocs; scan; scan = scan->next) -// OBSOLETE { -// OBSOLETE int mid; -// OBSOLETE char buf[10]; -// OBSOLETE char slot[3]; -// OBSOLETE int cproc_state = -// OBSOLETE extract_signed_integer -// OBSOLETE (scan->raw_cproc + CPROC_STATE_OFFSET, CPROC_STATE_SIZE); -// OBSOLETE -// OBSOLETE selected = ' '; -// OBSOLETE -// OBSOLETE /* a wired cproc? */ -// OBSOLETE wired = (extract_address (scan->raw_cproc + CPROC_WIRED_OFFSET, -// OBSOLETE CPROC_WIRED_SIZE) -// OBSOLETE ? "wired" : ""); -// OBSOLETE -// OBSOLETE if (scan->reverse_map != -1) -// OBSOLETE kthread = (their_threads + scan->reverse_map); -// OBSOLETE else -// OBSOLETE kthread = NULL; -// OBSOLETE -// OBSOLETE if (kthread) -// OBSOLETE { -// OBSOLETE /* These cprocs have a kernel thread */ -// OBSOLETE -// OBSOLETE mid = map_port_name_to_mid (kthread->name, MACH_TYPE_THREAD); -// OBSOLETE -// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT; -// OBSOLETE -// OBSOLETE ret = thread_info (kthread->name, -// OBSOLETE THREAD_BASIC_INFO, -// OBSOLETE (thread_info_t) & ths, -// OBSOLETE &infoCnt); -// OBSOLETE -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE warning ("Unable to get basic info on thread %d : %s", -// OBSOLETE mid, -// OBSOLETE mach_error_string (ret)); -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Who is the first to have more than 100 threads */ -// OBSOLETE sprintf (slot, "%d", kthread->slotid % 100); -// OBSOLETE -// OBSOLETE if (kthread->name == current_thread) -// OBSOLETE selected = '*'; -// OBSOLETE -// OBSOLETE if (ths.suspend_count) -// OBSOLETE sprintf (buf, "%d", ths.suspend_count); -// OBSOLETE else -// OBSOLETE buf[0] = '\000'; -// OBSOLETE -// OBSOLETE #if 0 -// OBSOLETE if (ths.flags & TH_FLAGS_SWAPPED) -// OBSOLETE strcat (buf, "S"); -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE if (ths.flags & TH_FLAGS_IDLE) -// OBSOLETE strcat (buf, "I"); -// OBSOLETE -// OBSOLETE printf_filtered (TL_FORMAT, -// OBSOLETE slot, -// OBSOLETE mid, -// OBSOLETE selected, -// OBSOLETE get_thread_name (scan, kthread->slotid), -// OBSOLETE kthread->in_emulator ? "E" : "", -// OBSOLETE translate_state (ths.run_state), -// OBSOLETE buf, -// OBSOLETE translate_cstate (cproc_state), -// OBSOLETE wired); -// OBSOLETE print_tl_address (gdb_stdout, kthread->pc); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* These cprocs don't have a kernel thread. -// OBSOLETE * find out the calling frame with -// OBSOLETE * FETCH_CPROC_STATE. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE struct gdb_thread state; -// OBSOLETE -// OBSOLETE #if 0 -// OBSOLETE /* jtv -> emcmanus: why do you want this here? */ -// OBSOLETE if (scan->incarnation == NULL) -// OBSOLETE continue; /* EMcM */ -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE printf_filtered (TL_FORMAT, -// OBSOLETE "-", -// OBSOLETE -neworder, /* Pseudo MID */ -// OBSOLETE selected, -// OBSOLETE get_thread_name (scan, -neworder), -// OBSOLETE "", -// OBSOLETE "-", /* kernel state */ -// OBSOLETE "", -// OBSOLETE translate_cstate (cproc_state), -// OBSOLETE ""); -// OBSOLETE state.cproc = scan; -// OBSOLETE -// OBSOLETE if (FETCH_CPROC_STATE (&state) == -1) -// OBSOLETE puts_filtered ("???"); -// OBSOLETE else -// OBSOLETE print_tl_address (gdb_stdout, state.pc); -// OBSOLETE -// OBSOLETE neworder++; -// OBSOLETE } -// OBSOLETE puts_filtered ("\n"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Scan for kernel threads without cprocs */ -// OBSOLETE for (index = 0; index < thread_count; index++) -// OBSOLETE { -// OBSOLETE if (!their_threads[index].cproc) -// OBSOLETE { -// OBSOLETE int mid; -// OBSOLETE -// OBSOLETE char buf[10]; -// OBSOLETE char slot[3]; -// OBSOLETE -// OBSOLETE mach_port_t name = their_threads[index].name; -// OBSOLETE -// OBSOLETE mid = map_port_name_to_mid (name, MACH_TYPE_THREAD); -// OBSOLETE -// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT; -// OBSOLETE -// OBSOLETE ret = thread_info (name, -// OBSOLETE THREAD_BASIC_INFO, -// OBSOLETE (thread_info_t) & ths, -// OBSOLETE &infoCnt); -// OBSOLETE -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE warning ("Unable to get basic info on thread %d : %s", -// OBSOLETE mid, -// OBSOLETE mach_error_string (ret)); -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE sprintf (slot, "%d", index % 100); -// OBSOLETE -// OBSOLETE if (name == current_thread) -// OBSOLETE selected = '*'; -// OBSOLETE else -// OBSOLETE selected = ' '; -// OBSOLETE -// OBSOLETE if (ths.suspend_count) -// OBSOLETE sprintf (buf, "%d", ths.suspend_count); -// OBSOLETE else -// OBSOLETE buf[0] = '\000'; -// OBSOLETE -// OBSOLETE #if 0 -// OBSOLETE if (ths.flags & TH_FLAGS_SWAPPED) -// OBSOLETE strcat (buf, "S"); -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE if (ths.flags & TH_FLAGS_IDLE) -// OBSOLETE strcat (buf, "I"); -// OBSOLETE -// OBSOLETE printf_filtered (TL_FORMAT, -// OBSOLETE slot, -// OBSOLETE mid, -// OBSOLETE selected, -// OBSOLETE get_thread_name (NULL, index), -// OBSOLETE their_threads[index].in_emulator ? "E" : "", -// OBSOLETE translate_state (ths.run_state), -// OBSOLETE buf, -// OBSOLETE "", /* No cproc state */ -// OBSOLETE ""); /* Can't be wired */ -// OBSOLETE print_tl_address (gdb_stdout, their_threads[index].pc); -// OBSOLETE puts_filtered ("\n"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE obstack_free (cproc_obstack, 0); -// OBSOLETE obstack_init (cproc_obstack); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE thread_select_command (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE int mid; -// OBSOLETE thread_array_t thread_list; -// OBSOLETE int thread_count; -// OBSOLETE kern_return_t ret; -// OBSOLETE int is_slot = 0; -// OBSOLETE -// OBSOLETE MACH_ERROR_NO_INFERIOR; -// OBSOLETE -// OBSOLETE if (!args) -// OBSOLETE error_no_arg ("MID or @SLOTNUMBER to specify a thread to select"); -// OBSOLETE -// OBSOLETE while (*args == ' ' || *args == '\t') -// OBSOLETE args++; -// OBSOLETE -// OBSOLETE if (*args == '@') -// OBSOLETE { -// OBSOLETE is_slot++; -// OBSOLETE args++; -// OBSOLETE } -// OBSOLETE -// OBSOLETE mid = atoi (args); -// OBSOLETE -// OBSOLETE if (mid == 0) -// OBSOLETE if (!is_slot || *args != '0') /* Rudimentary checks */ -// OBSOLETE error ("You must select threads by MID or @SLOTNUMBER"); -// OBSOLETE -// OBSOLETE if (select_thread (inferior_task, mid, is_slot ? 2 : 1) != KERN_SUCCESS) -// OBSOLETE return; -// OBSOLETE -// OBSOLETE if (from_tty) -// OBSOLETE printf_filtered ("Thread %d selected\n", -// OBSOLETE is_slot ? map_port_name_to_mid (current_thread, -// OBSOLETE MACH_TYPE_THREAD) : mid); -// OBSOLETE } -// OBSOLETE -// OBSOLETE thread_trace (mach_port_t thread, boolean_t set) -// OBSOLETE { -// OBSOLETE int flavor = TRACE_FLAVOR; -// OBSOLETE unsigned int stateCnt = TRACE_FLAVOR_SIZE; -// OBSOLETE kern_return_t ret; -// OBSOLETE thread_state_data_t state; -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (thread)) -// OBSOLETE { -// OBSOLETE warning ("thread_trace: invalid thread"); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (must_suspend_thread) -// OBSOLETE setup_thread (thread, 1); -// OBSOLETE -// OBSOLETE ret = thread_get_state (thread, flavor, state, &stateCnt); -// OBSOLETE CHK ("thread_trace: error reading thread state", ret); -// OBSOLETE -// OBSOLETE if (set) -// OBSOLETE { -// OBSOLETE TRACE_SET (thread, state); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE if (!TRACE_CLEAR (thread, state)) -// OBSOLETE { -// OBSOLETE if (must_suspend_thread) -// OBSOLETE setup_thread (thread, 0); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE ret = thread_set_state (thread, flavor, state, stateCnt); -// OBSOLETE CHK ("thread_trace: error writing thread state", ret); -// OBSOLETE if (must_suspend_thread) -// OBSOLETE setup_thread (thread, 0); -// OBSOLETE } -// OBSOLETE -// OBSOLETE #ifdef FLUSH_INFERIOR_CACHE -// OBSOLETE -// OBSOLETE /* When over-writing code on some machines the I-Cache must be flushed -// OBSOLETE explicitly, because it is not kept coherent by the lazy hardware. -// OBSOLETE This definitely includes breakpoints, for instance, or else we -// OBSOLETE end up looping in mysterious Bpt traps */ -// OBSOLETE -// OBSOLETE flush_inferior_icache (CORE_ADDR pc, int amount) -// OBSOLETE { -// OBSOLETE vm_machine_attribute_val_t flush = MATTR_VAL_ICACHE_FLUSH; -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE ret = vm_machine_attribute (inferior_task, -// OBSOLETE pc, -// OBSOLETE amount, -// OBSOLETE MATTR_CACHE, -// OBSOLETE &flush); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE warning ("Error flushing inferior's cache : %s", -// OBSOLETE mach_error_string (ret)); -// OBSOLETE } -// OBSOLETE #endif /* FLUSH_INFERIOR_CACHE */ -// OBSOLETE -// OBSOLETE -// OBSOLETE static -// OBSOLETE suspend_all_threads (int from_tty) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE thread_array_t thread_list; -// OBSOLETE int thread_count, index; -// OBSOLETE int infoCnt; -// OBSOLETE thread_basic_info_data_t th_info; -// OBSOLETE -// OBSOLETE -// OBSOLETE ret = task_threads (inferior_task, &thread_list, &thread_count); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE warning ("Could not suspend inferior threads."); -// OBSOLETE m3_kill_inferior (); -// OBSOLETE throw_exception (RETURN_ERROR); -// OBSOLETE } -// OBSOLETE -// OBSOLETE for (index = 0; index < thread_count; index++) -// OBSOLETE { -// OBSOLETE int mid; -// OBSOLETE -// OBSOLETE mid = map_port_name_to_mid (thread_list[index], -// OBSOLETE MACH_TYPE_THREAD); -// OBSOLETE -// OBSOLETE ret = thread_suspend (thread_list[index]); -// OBSOLETE -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE warning ("Error trying to suspend thread %d : %s", -// OBSOLETE mid, mach_error_string (ret)); -// OBSOLETE -// OBSOLETE if (from_tty) -// OBSOLETE { -// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT; -// OBSOLETE ret = thread_info (thread_list[index], -// OBSOLETE THREAD_BASIC_INFO, -// OBSOLETE (thread_info_t) & th_info, -// OBSOLETE &infoCnt); -// OBSOLETE CHK ("suspend can't get thread info", ret); -// OBSOLETE -// OBSOLETE warning ("Thread %d suspend count is %d", -// OBSOLETE mid, th_info.suspend_count); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE consume_send_rights (thread_list, thread_count); -// OBSOLETE ret = vm_deallocate (mach_task_self (), -// OBSOLETE (vm_address_t) thread_list, -// OBSOLETE (thread_count * sizeof (int))); -// OBSOLETE CHK ("Error trying to deallocate thread list", ret); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE thread_suspend_command (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE int mid; -// OBSOLETE mach_port_t saved_thread; -// OBSOLETE int infoCnt; -// OBSOLETE thread_basic_info_data_t th_info; -// OBSOLETE -// OBSOLETE MACH_ERROR_NO_INFERIOR; -// OBSOLETE -// OBSOLETE if (!strcasecmp (args, "all")) -// OBSOLETE { -// OBSOLETE suspend_all_threads (from_tty); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE saved_thread = current_thread; -// OBSOLETE -// OBSOLETE mid = parse_thread_id (args, 0, 0); -// OBSOLETE -// OBSOLETE if (mid < 0) -// OBSOLETE error ("You can suspend only existing kernel threads with MID or @SLOTNUMBER"); -// OBSOLETE -// OBSOLETE if (mid == 0) -// OBSOLETE mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); -// OBSOLETE else if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE if (current_thread) -// OBSOLETE current_thread = saved_thread; -// OBSOLETE error ("Could not select thread %d", mid); -// OBSOLETE } -// OBSOLETE -// OBSOLETE ret = thread_suspend (current_thread); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE warning ("thread_suspend failed : %s", -// OBSOLETE mach_error_string (ret)); -// OBSOLETE -// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT; -// OBSOLETE ret = thread_info (current_thread, -// OBSOLETE THREAD_BASIC_INFO, -// OBSOLETE (thread_info_t) & th_info, -// OBSOLETE &infoCnt); -// OBSOLETE CHK ("suspend can't get thread info", ret); -// OBSOLETE -// OBSOLETE warning ("Thread %d suspend count is %d", mid, th_info.suspend_count); -// OBSOLETE -// OBSOLETE current_thread = saved_thread; -// OBSOLETE } -// OBSOLETE -// OBSOLETE resume_all_threads (int from_tty) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE thread_array_t thread_list; -// OBSOLETE int thread_count, index; -// OBSOLETE int mid; -// OBSOLETE int infoCnt; -// OBSOLETE thread_basic_info_data_t th_info; -// OBSOLETE -// OBSOLETE ret = task_threads (inferior_task, &thread_list, &thread_count); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE m3_kill_inferior (); -// OBSOLETE error ("task_threads", mach_error_string (ret)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE for (index = 0; index < thread_count; index++) -// OBSOLETE { -// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT; -// OBSOLETE ret = thread_info (thread_list[index], -// OBSOLETE THREAD_BASIC_INFO, -// OBSOLETE (thread_info_t) & th_info, -// OBSOLETE &infoCnt); -// OBSOLETE CHK ("resume_all can't get thread info", ret); -// OBSOLETE -// OBSOLETE mid = map_port_name_to_mid (thread_list[index], -// OBSOLETE MACH_TYPE_THREAD); -// OBSOLETE -// OBSOLETE if (!th_info.suspend_count) -// OBSOLETE { -// OBSOLETE if (mid != -1 && from_tty) -// OBSOLETE warning ("Thread %d is not suspended", mid); -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE ret = thread_resume (thread_list[index]); -// OBSOLETE -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE warning ("Error trying to resume thread %d : %s", -// OBSOLETE mid, mach_error_string (ret)); -// OBSOLETE else if (mid != -1 && from_tty) -// OBSOLETE warning ("Thread %d suspend count is %d", -// OBSOLETE mid, --th_info.suspend_count); -// OBSOLETE } -// OBSOLETE -// OBSOLETE consume_send_rights (thread_list, thread_count); -// OBSOLETE ret = vm_deallocate (mach_task_self (), -// OBSOLETE (vm_address_t) thread_list, -// OBSOLETE (thread_count * sizeof (int))); -// OBSOLETE CHK ("Error trying to deallocate thread list", ret); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE thread_resume_command (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE int mid; -// OBSOLETE mach_port_t saved_thread; -// OBSOLETE kern_return_t ret; -// OBSOLETE thread_basic_info_data_t th_info; -// OBSOLETE int infoCnt = THREAD_BASIC_INFO_COUNT; -// OBSOLETE -// OBSOLETE MACH_ERROR_NO_INFERIOR; -// OBSOLETE -// OBSOLETE if (!strcasecmp (args, "all")) -// OBSOLETE { -// OBSOLETE resume_all_threads (from_tty); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE saved_thread = current_thread; -// OBSOLETE -// OBSOLETE mid = parse_thread_id (args, 0, 0); -// OBSOLETE -// OBSOLETE if (mid < 0) -// OBSOLETE error ("You can resume only existing kernel threads with MID or @SLOTNUMBER"); -// OBSOLETE -// OBSOLETE if (mid == 0) -// OBSOLETE mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); -// OBSOLETE else if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE if (current_thread) -// OBSOLETE current_thread = saved_thread; -// OBSOLETE throw_exception (RETURN_ERROR); -// OBSOLETE } -// OBSOLETE -// OBSOLETE ret = thread_info (current_thread, -// OBSOLETE THREAD_BASIC_INFO, -// OBSOLETE (thread_info_t) & th_info, -// OBSOLETE &infoCnt); -// OBSOLETE CHK ("resume can't get thread info", ret); -// OBSOLETE -// OBSOLETE if (!th_info.suspend_count) -// OBSOLETE { -// OBSOLETE warning ("Thread %d is not suspended", mid); -// OBSOLETE goto out; -// OBSOLETE } -// OBSOLETE -// OBSOLETE ret = thread_resume (current_thread); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE warning ("thread_resume failed : %s", -// OBSOLETE mach_error_string (ret)); -// OBSOLETE else -// OBSOLETE { -// OBSOLETE th_info.suspend_count--; -// OBSOLETE warning ("Thread %d suspend count is %d", mid, th_info.suspend_count); -// OBSOLETE } -// OBSOLETE -// OBSOLETE out: -// OBSOLETE current_thread = saved_thread; -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE thread_kill_command (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE int mid; -// OBSOLETE kern_return_t ret; -// OBSOLETE int thread_count; -// OBSOLETE thread_array_t thread_table; -// OBSOLETE int index; -// OBSOLETE mach_port_t thread_to_kill = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE -// OBSOLETE MACH_ERROR_NO_INFERIOR; -// OBSOLETE -// OBSOLETE if (!args) -// OBSOLETE error_no_arg ("thread mid to kill from the inferior task"); -// OBSOLETE -// OBSOLETE mid = parse_thread_id (args, 0, 0); -// OBSOLETE -// OBSOLETE if (mid < 0) -// OBSOLETE error ("You can kill only existing kernel threads with MID or @SLOTNUMBER"); -// OBSOLETE -// OBSOLETE if (mid) -// OBSOLETE { -// OBSOLETE ret = machid_mach_port (mid_server, mid_auth, mid, &thread_to_kill); -// OBSOLETE CHK ("thread_kill_command: machid_mach_port map failed", ret); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); -// OBSOLETE -// OBSOLETE /* Don't allow gdb to kill *any* thread in the system. Use mkill program for that */ -// OBSOLETE ret = task_threads (inferior_task, &thread_table, &thread_count); -// OBSOLETE CHK ("Error getting inferior's thread list", ret); -// OBSOLETE -// OBSOLETE if (thread_to_kill == current_thread) -// OBSOLETE { -// OBSOLETE ret = thread_terminate (thread_to_kill); -// OBSOLETE CHK ("Thread could not be terminated", ret); -// OBSOLETE -// OBSOLETE if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS) -// OBSOLETE warning ("Last thread was killed, use \"kill\" command to kill task"); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE for (index = 0; index < thread_count; index++) -// OBSOLETE if (thread_table[index] == thread_to_kill) -// OBSOLETE { -// OBSOLETE ret = thread_terminate (thread_to_kill); -// OBSOLETE CHK ("Thread could not be terminated", ret); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (thread_count > 1) -// OBSOLETE consume_send_rights (thread_table, thread_count); -// OBSOLETE -// OBSOLETE ret = vm_deallocate (mach_task_self (), (vm_address_t) thread_table, -// OBSOLETE (thread_count * sizeof (mach_port_t))); -// OBSOLETE CHK ("Error trying to deallocate thread list", ret); -// OBSOLETE -// OBSOLETE warning ("Thread %d killed", mid); -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE /* Task specific commands; add more if you like */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE task_resume_command (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE task_basic_info_data_t ta_info; -// OBSOLETE int infoCnt = TASK_BASIC_INFO_COUNT; -// OBSOLETE int mid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK); -// OBSOLETE -// OBSOLETE MACH_ERROR_NO_INFERIOR; -// OBSOLETE -// OBSOLETE /* Would be trivial to change, but is it desirable? */ -// OBSOLETE if (args) -// OBSOLETE error ("Currently gdb can resume only it's inferior task"); -// OBSOLETE -// OBSOLETE ret = task_info (inferior_task, -// OBSOLETE TASK_BASIC_INFO, -// OBSOLETE (task_info_t) & ta_info, -// OBSOLETE &infoCnt); -// OBSOLETE CHK ("task_resume_command: task_info failed", ret); -// OBSOLETE -// OBSOLETE if (ta_info.suspend_count == 0) -// OBSOLETE error ("Inferior task %d is not suspended", mid); -// OBSOLETE else if (ta_info.suspend_count == 1 && -// OBSOLETE from_tty && -// OBSOLETE !query ("Suspend count is now 1. Do you know what you are doing? ")) -// OBSOLETE error ("Task not resumed"); -// OBSOLETE -// OBSOLETE ret = task_resume (inferior_task); -// OBSOLETE CHK ("task_resume_command: task_resume", ret); -// OBSOLETE -// OBSOLETE if (ta_info.suspend_count == 1) -// OBSOLETE { -// OBSOLETE warning ("Inferior task %d is no longer suspended", mid); -// OBSOLETE must_suspend_thread = 1; -// OBSOLETE /* @@ This is not complete: Registers change all the time when not -// OBSOLETE suspended! */ -// OBSOLETE registers_changed (); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE warning ("Inferior task %d suspend count is now %d", -// OBSOLETE mid, ta_info.suspend_count - 1); -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE void -// OBSOLETE task_suspend_command (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE task_basic_info_data_t ta_info; -// OBSOLETE int infoCnt = TASK_BASIC_INFO_COUNT; -// OBSOLETE int mid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK); -// OBSOLETE -// OBSOLETE MACH_ERROR_NO_INFERIOR; -// OBSOLETE -// OBSOLETE /* Would be trivial to change, but is it desirable? */ -// OBSOLETE if (args) -// OBSOLETE error ("Currently gdb can suspend only it's inferior task"); -// OBSOLETE -// OBSOLETE ret = task_suspend (inferior_task); -// OBSOLETE CHK ("task_suspend_command: task_suspend", ret); -// OBSOLETE -// OBSOLETE must_suspend_thread = 0; -// OBSOLETE -// OBSOLETE ret = task_info (inferior_task, -// OBSOLETE TASK_BASIC_INFO, -// OBSOLETE (task_info_t) & ta_info, -// OBSOLETE &infoCnt); -// OBSOLETE CHK ("task_suspend_command: task_info failed", ret); -// OBSOLETE -// OBSOLETE warning ("Inferior task %d suspend count is now %d", -// OBSOLETE mid, ta_info.suspend_count); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static char * -// OBSOLETE get_size (int bytes) -// OBSOLETE { -// OBSOLETE static char size[30]; -// OBSOLETE int zz = bytes / 1024; -// OBSOLETE -// OBSOLETE if (zz / 1024) -// OBSOLETE sprintf (size, "%-2.1f M", ((float) bytes) / (1024.0 * 1024.0)); -// OBSOLETE else -// OBSOLETE sprintf (size, "%d K", zz); -// OBSOLETE -// OBSOLETE return size; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Does this require the target task to be suspended?? I don't think so. */ -// OBSOLETE void -// OBSOLETE task_info_command (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE int mid = -5; -// OBSOLETE mach_port_t task; -// OBSOLETE kern_return_t ret; -// OBSOLETE task_basic_info_data_t ta_info; -// OBSOLETE int infoCnt = TASK_BASIC_INFO_COUNT; -// OBSOLETE int page_size = round_page (1); -// OBSOLETE int thread_count = 0; -// OBSOLETE -// OBSOLETE if (MACH_PORT_VALID (inferior_task)) -// OBSOLETE mid = map_port_name_to_mid (inferior_task, -// OBSOLETE MACH_TYPE_TASK); -// OBSOLETE -// OBSOLETE task = inferior_task; -// OBSOLETE -// OBSOLETE if (args) -// OBSOLETE { -// OBSOLETE int tmid = atoi (args); -// OBSOLETE -// OBSOLETE if (tmid <= 0) -// OBSOLETE error ("Invalid mid %d for task info", tmid); -// OBSOLETE -// OBSOLETE if (tmid != mid) -// OBSOLETE { -// OBSOLETE mid = tmid; -// OBSOLETE ret = machid_mach_port (mid_server, mid_auth, tmid, &task); -// OBSOLETE CHK ("task_info_command: machid_mach_port map failed", ret); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (mid < 0) -// OBSOLETE error ("You have to give the task MID as an argument"); -// OBSOLETE -// OBSOLETE ret = task_info (task, -// OBSOLETE TASK_BASIC_INFO, -// OBSOLETE (task_info_t) & ta_info, -// OBSOLETE &infoCnt); -// OBSOLETE CHK ("task_info_command: task_info failed", ret); -// OBSOLETE -// OBSOLETE printf_filtered ("\nTask info for task %d:\n\n", mid); -// OBSOLETE printf_filtered (" Suspend count : %d\n", ta_info.suspend_count); -// OBSOLETE printf_filtered (" Base priority : %d\n", ta_info.base_priority); -// OBSOLETE printf_filtered (" Virtual size : %s\n", get_size (ta_info.virtual_size)); -// OBSOLETE printf_filtered (" Resident size : %s\n", get_size (ta_info.resident_size)); -// OBSOLETE -// OBSOLETE { -// OBSOLETE thread_array_t thread_list; -// OBSOLETE -// OBSOLETE ret = task_threads (task, &thread_list, &thread_count); -// OBSOLETE CHK ("task_info_command: task_threads", ret); -// OBSOLETE -// OBSOLETE printf_filtered (" Thread count : %d\n", thread_count); -// OBSOLETE -// OBSOLETE consume_send_rights (thread_list, thread_count); -// OBSOLETE ret = vm_deallocate (mach_task_self (), -// OBSOLETE (vm_address_t) thread_list, -// OBSOLETE (thread_count * sizeof (int))); -// OBSOLETE CHK ("Error trying to deallocate thread list", ret); -// OBSOLETE } -// OBSOLETE if (have_emulator_p (task)) -// OBSOLETE printf_filtered (" Emulator at : 0x%x..0x%x\n", -// OBSOLETE EMULATOR_BASE, EMULATOR_END); -// OBSOLETE else -// OBSOLETE printf_filtered (" No emulator.\n"); -// OBSOLETE -// OBSOLETE if (thread_count && task == inferior_task) -// OBSOLETE printf_filtered ("\nUse the \"thread list\" command to see the threads\n"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* You may either FORWARD the exception to the inferior, or KEEP -// OBSOLETE * it and return to GDB command level. -// OBSOLETE * -// OBSOLETE * exception mid [ forward | keep ] -// OBSOLETE */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE exception_command (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE char *scan = args; -// OBSOLETE int exception; -// OBSOLETE int len; -// OBSOLETE -// OBSOLETE if (!args) -// OBSOLETE error_no_arg ("exception number action"); -// OBSOLETE -// OBSOLETE while (*scan == ' ' || *scan == '\t') -// OBSOLETE scan++; -// OBSOLETE -// OBSOLETE if ('0' <= *scan && *scan <= '9') -// OBSOLETE while ('0' <= *scan && *scan <= '9') -// OBSOLETE scan++; -// OBSOLETE else -// OBSOLETE error ("exception number action"); -// OBSOLETE -// OBSOLETE exception = atoi (args); -// OBSOLETE if (exception <= 0 || exception > MAX_EXCEPTION) -// OBSOLETE error ("Allowed exception numbers are in range 1..%d", -// OBSOLETE MAX_EXCEPTION); -// OBSOLETE -// OBSOLETE if (*scan != ' ' && *scan != '\t') -// OBSOLETE error ("exception number must be followed by a space"); -// OBSOLETE else -// OBSOLETE while (*scan == ' ' || *scan == '\t') -// OBSOLETE scan++; -// OBSOLETE -// OBSOLETE args = scan; -// OBSOLETE len = 0; -// OBSOLETE while (*scan) -// OBSOLETE { -// OBSOLETE len++; -// OBSOLETE scan++; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (!len) -// OBSOLETE error ("exception number action"); -// OBSOLETE -// OBSOLETE if (!strncasecmp (args, "forward", len)) -// OBSOLETE exception_map[exception].forward = TRUE; -// OBSOLETE else if (!strncasecmp (args, "keep", len)) -// OBSOLETE exception_map[exception].forward = FALSE; -// OBSOLETE else -// OBSOLETE error ("exception action is either \"keep\" or \"forward\""); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE print_exception_info (int exception) -// OBSOLETE { -// OBSOLETE boolean_t forward = exception_map[exception].forward; -// OBSOLETE -// OBSOLETE printf_filtered ("%s\t(%d): ", exception_map[exception].name, -// OBSOLETE exception); -// OBSOLETE if (!forward) -// OBSOLETE if (exception_map[exception].sigmap != SIG_UNKNOWN) -// OBSOLETE printf_filtered ("keep and handle as signal %d\n", -// OBSOLETE exception_map[exception].sigmap); -// OBSOLETE else -// OBSOLETE printf_filtered ("keep and handle as unknown signal %d\n", -// OBSOLETE exception_map[exception].sigmap); -// OBSOLETE else -// OBSOLETE printf_filtered ("forward exception to inferior\n"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE exception_info (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE int exception; -// OBSOLETE -// OBSOLETE if (!args) -// OBSOLETE for (exception = 1; exception <= MAX_EXCEPTION; exception++) -// OBSOLETE print_exception_info (exception); -// OBSOLETE else -// OBSOLETE { -// OBSOLETE exception = atoi (args); -// OBSOLETE -// OBSOLETE if (exception <= 0 || exception > MAX_EXCEPTION) -// OBSOLETE error ("Invalid exception number, values from 1 to %d allowed", -// OBSOLETE MAX_EXCEPTION); -// OBSOLETE print_exception_info (exception); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Check for actions for mach exceptions. -// OBSOLETE */ -// OBSOLETE mach3_exception_actions (WAITTYPE *w, boolean_t force_print_only, char *who) -// OBSOLETE { -// OBSOLETE boolean_t force_print = FALSE; -// OBSOLETE -// OBSOLETE -// OBSOLETE if (force_print_only || -// OBSOLETE exception_map[stop_exception].sigmap == SIG_UNKNOWN) -// OBSOLETE force_print = TRUE; -// OBSOLETE else -// OBSOLETE WSETSTOP (*w, exception_map[stop_exception].sigmap); -// OBSOLETE -// OBSOLETE if (exception_map[stop_exception].print || force_print) -// OBSOLETE { -// OBSOLETE target_terminal_ours (); -// OBSOLETE -// OBSOLETE printf_filtered ("\n%s received %s exception : ", -// OBSOLETE who, -// OBSOLETE exception_map[stop_exception].name); -// OBSOLETE -// OBSOLETE wrap_here (" "); -// OBSOLETE -// OBSOLETE switch (stop_exception) -// OBSOLETE { -// OBSOLETE case EXC_BAD_ACCESS: -// OBSOLETE printf_filtered ("referencing address 0x%x : %s\n", -// OBSOLETE stop_subcode, -// OBSOLETE mach_error_string (stop_code)); -// OBSOLETE break; -// OBSOLETE case EXC_BAD_INSTRUCTION: -// OBSOLETE printf_filtered -// OBSOLETE ("illegal or undefined instruction. code %d subcode %d\n", -// OBSOLETE stop_code, stop_subcode); -// OBSOLETE break; -// OBSOLETE case EXC_ARITHMETIC: -// OBSOLETE printf_filtered ("code %d\n", stop_code); -// OBSOLETE break; -// OBSOLETE case EXC_EMULATION: -// OBSOLETE printf_filtered ("code %d subcode %d\n", stop_code, stop_subcode); -// OBSOLETE break; -// OBSOLETE case EXC_SOFTWARE: -// OBSOLETE printf_filtered ("%s specific, code 0x%x\n", -// OBSOLETE stop_code < 0xffff ? "hardware" : "os emulation", -// OBSOLETE stop_code); -// OBSOLETE break; -// OBSOLETE case EXC_BREAKPOINT: -// OBSOLETE printf_filtered ("type %d (machine dependent)\n", -// OBSOLETE stop_code); -// OBSOLETE break; -// OBSOLETE default: -// OBSOLETE internal_error (__FILE__, __LINE__, -// OBSOLETE "Unknown exception"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE setup_notify_port (int create_new) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE if (MACH_PORT_VALID (our_notify_port)) -// OBSOLETE { -// OBSOLETE ret = mach_port_destroy (mach_task_self (), our_notify_port); -// OBSOLETE CHK ("Could not destroy our_notify_port", ret); -// OBSOLETE } -// OBSOLETE -// OBSOLETE our_notify_port = MACH_PORT_NULL; -// OBSOLETE notify_chain = (port_chain_t) NULL; -// OBSOLETE port_chain_destroy (port_chain_obstack); -// OBSOLETE -// OBSOLETE if (create_new) -// OBSOLETE { -// OBSOLETE ret = mach_port_allocate (mach_task_self (), -// OBSOLETE MACH_PORT_RIGHT_RECEIVE, -// OBSOLETE &our_notify_port); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE internal_error (__FILE__, __LINE__, -// OBSOLETE "Creating notify port %s", mach_error_string (ret)); -// OBSOLETE -// OBSOLETE ret = mach_port_move_member (mach_task_self (), -// OBSOLETE our_notify_port, -// OBSOLETE inferior_wait_port_set); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE internal_error (__FILE__, __LINE__, -// OBSOLETE "initial move member %s", mach_error_string (ret)); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Register our message port to the net name server -// OBSOLETE * -// OBSOLETE * Currently used only by the external stop-gdb program -// OBSOLETE * since ^C does not work if you would like to enter -// OBSOLETE * gdb command level while debugging your program. -// OBSOLETE * -// OBSOLETE * NOTE: If the message port is sometimes used for other -// OBSOLETE * purposes also, the NAME must not be a guessable one. -// OBSOLETE * Then, there should be a way to change it. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE char registered_name[MAX_NAME_LEN]; -// OBSOLETE -// OBSOLETE void -// OBSOLETE message_port_info (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE if (registered_name[0]) -// OBSOLETE printf_filtered ("gdb's message port name: '%s'\n", -// OBSOLETE registered_name); -// OBSOLETE else -// OBSOLETE printf_filtered ("gdb's message port is not currently registered\n"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE gdb_register_port (char *name, mach_port_t port) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE static int already_signed = 0; -// OBSOLETE int len; -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (port) || !name || !*name) -// OBSOLETE { -// OBSOLETE warning ("Invalid registration request"); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (!already_signed) -// OBSOLETE { -// OBSOLETE ret = mach_port_insert_right (mach_task_self (), -// OBSOLETE our_message_port, -// OBSOLETE our_message_port, -// OBSOLETE MACH_MSG_TYPE_MAKE_SEND); -// OBSOLETE CHK ("Failed to create a signature to our_message_port", ret); -// OBSOLETE already_signed = 1; -// OBSOLETE } -// OBSOLETE else if (already_signed > 1) -// OBSOLETE { -// OBSOLETE ret = netname_check_out (name_server_port, -// OBSOLETE registered_name, -// OBSOLETE our_message_port); -// OBSOLETE CHK ("Failed to check out gdb's message port", ret); -// OBSOLETE registered_name[0] = '\000'; -// OBSOLETE already_signed = 1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE ret = netname_check_in (name_server_port, /* Name server port */ -// OBSOLETE name, /* Name of service */ -// OBSOLETE our_message_port, /* Signature */ -// OBSOLETE port); /* Creates a new send right */ -// OBSOLETE CHK ("Failed to check in the port", ret); -// OBSOLETE -// OBSOLETE len = 0; -// OBSOLETE while (len < MAX_NAME_LEN && *(name + len)) -// OBSOLETE { -// OBSOLETE registered_name[len] = *(name + len); -// OBSOLETE len++; -// OBSOLETE } -// OBSOLETE registered_name[len] = '\000'; -// OBSOLETE already_signed = 2; -// OBSOLETE } -// OBSOLETE -// OBSOLETE struct cmd_list_element *cmd_thread_list; -// OBSOLETE struct cmd_list_element *cmd_task_list; -// OBSOLETE -// OBSOLETE /*ARGSUSED */ -// OBSOLETE static void -// OBSOLETE thread_command (char *arg, int from_tty) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("\"thread\" must be followed by the name of a thread command.\n"); -// OBSOLETE help_list (cmd_thread_list, "thread ", -1, gdb_stdout); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /*ARGSUSED */ -// OBSOLETE static void -// OBSOLETE task_command (char *arg, int from_tty) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("\"task\" must be followed by the name of a task command.\n"); -// OBSOLETE help_list (cmd_task_list, "task ", -1, gdb_stdout); -// OBSOLETE } -// OBSOLETE -// OBSOLETE add_mach_specific_commands (void) -// OBSOLETE { -// OBSOLETE /* Thread handling commands */ -// OBSOLETE -// OBSOLETE /* FIXME: Move our thread support into the generic thread.c stuff so we -// OBSOLETE can share that code. */ -// OBSOLETE add_prefix_cmd ("mthread", class_stack, thread_command, -// OBSOLETE "Generic command for handling Mach threads in the debugged task.", -// OBSOLETE &cmd_thread_list, "thread ", 0, &cmdlist); -// OBSOLETE -// OBSOLETE add_com_alias ("th", "mthread", class_stack, 1); -// OBSOLETE -// OBSOLETE add_cmd ("select", class_stack, thread_select_command, -// OBSOLETE "Select and print MID of the selected thread", -// OBSOLETE &cmd_thread_list); -// OBSOLETE add_cmd ("list", class_stack, thread_list_command, -// OBSOLETE "List info of task's threads. Selected thread is marked with '*'", -// OBSOLETE &cmd_thread_list); -// OBSOLETE add_cmd ("suspend", class_run, thread_suspend_command, -// OBSOLETE "Suspend one or all of the threads in the selected task.", -// OBSOLETE &cmd_thread_list); -// OBSOLETE add_cmd ("resume", class_run, thread_resume_command, -// OBSOLETE "Resume one or all of the threads in the selected task.", -// OBSOLETE &cmd_thread_list); -// OBSOLETE add_cmd ("kill", class_run, thread_kill_command, -// OBSOLETE "Kill the specified thread MID from inferior task.", -// OBSOLETE &cmd_thread_list); -// OBSOLETE #if 0 -// OBSOLETE /* The rest of this support (condition_thread) was not merged. It probably -// OBSOLETE should not be merged in this form, but instead added to the generic GDB -// OBSOLETE thread support. */ -// OBSOLETE add_cmd ("break", class_breakpoint, condition_thread, -// OBSOLETE "Breakpoint N will only be effective for thread MID or @SLOT\n\ -// OBSOLETE If MID/@SLOT is omitted allow all threads to break at breakpoint", -// OBSOLETE &cmd_thread_list); -// OBSOLETE #endif -// OBSOLETE /* Thread command shorthands (for backward compatibility) */ -// OBSOLETE add_alias_cmd ("ts", "mthread select", 0, 0, &cmdlist); -// OBSOLETE add_alias_cmd ("tl", "mthread list", 0, 0, &cmdlist); -// OBSOLETE -// OBSOLETE /* task handling commands */ -// OBSOLETE -// OBSOLETE add_prefix_cmd ("task", class_stack, task_command, -// OBSOLETE "Generic command for handling debugged task.", -// OBSOLETE &cmd_task_list, "task ", 0, &cmdlist); -// OBSOLETE -// OBSOLETE add_com_alias ("ta", "task", class_stack, 1); -// OBSOLETE -// OBSOLETE add_cmd ("suspend", class_run, task_suspend_command, -// OBSOLETE "Suspend the inferior task.", -// OBSOLETE &cmd_task_list); -// OBSOLETE add_cmd ("resume", class_run, task_resume_command, -// OBSOLETE "Resume the inferior task.", -// OBSOLETE &cmd_task_list); -// OBSOLETE add_cmd ("info", no_class, task_info_command, -// OBSOLETE "Print information about the specified task.", -// OBSOLETE &cmd_task_list); -// OBSOLETE -// OBSOLETE /* Print my message port name */ -// OBSOLETE -// OBSOLETE add_info ("message-port", message_port_info, -// OBSOLETE "Returns the name of gdb's message port in the netnameserver"); -// OBSOLETE -// OBSOLETE /* Exception commands */ -// OBSOLETE -// OBSOLETE add_info ("exceptions", exception_info, -// OBSOLETE "What debugger does when program gets various exceptions.\n\ -// OBSOLETE Specify an exception number as argument to print info on that\n\ -// OBSOLETE exception only."); -// OBSOLETE -// OBSOLETE add_com ("exception", class_run, exception_command, -// OBSOLETE "Specify how to handle an exception.\n\ -// OBSOLETE Args are exception number followed by \"forward\" or \"keep\".\n\ -// OBSOLETE `Forward' means forward the exception to the program's normal exception\n\ -// OBSOLETE handler.\n\ -// OBSOLETE `Keep' means reenter debugger if this exception happens, and GDB maps\n\ -// OBSOLETE the exception to some signal (see info exception)\n\ -// OBSOLETE Normally \"keep\" is used to return to GDB on exception."); -// OBSOLETE } -// OBSOLETE -// OBSOLETE kern_return_t -// OBSOLETE do_mach_notify_dead_name (mach_port_t notify, mach_port_t name) -// OBSOLETE { -// OBSOLETE kern_return_t kr = KERN_SUCCESS; -// OBSOLETE -// OBSOLETE /* Find the thing that notified */ -// OBSOLETE port_chain_t element = port_chain_member (notify_chain, name); -// OBSOLETE -// OBSOLETE /* Take name of from unreceived dead name notification list */ -// OBSOLETE notify_chain = port_chain_delete (notify_chain, name); -// OBSOLETE -// OBSOLETE if (!element) -// OBSOLETE error ("Received a dead name notify from unchained port (0x%x)", name); -// OBSOLETE -// OBSOLETE switch (element->type) -// OBSOLETE { -// OBSOLETE -// OBSOLETE case MACH_TYPE_THREAD: -// OBSOLETE target_terminal_ours_for_output (); -// OBSOLETE if (name == current_thread) -// OBSOLETE { -// OBSOLETE printf_filtered ("\nCurrent thread %d died", element->mid); -// OBSOLETE current_thread = MACH_PORT_NULL; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE printf_filtered ("\nThread %d died", element->mid); -// OBSOLETE -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case MACH_TYPE_TASK: -// OBSOLETE target_terminal_ours_for_output (); -// OBSOLETE if (name != inferior_task) -// OBSOLETE printf_filtered ("Task %d died, but it was not the selected task", -// OBSOLETE element->mid); -// OBSOLETE else -// OBSOLETE { -// OBSOLETE printf_filtered ("Current task %d died", element->mid); -// OBSOLETE -// OBSOLETE mach_port_destroy (mach_task_self (), name); -// OBSOLETE inferior_task = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE if (notify_chain) -// OBSOLETE warning ("There were still unreceived dead_name_notifications???"); -// OBSOLETE -// OBSOLETE /* Destroy the old notifications */ -// OBSOLETE setup_notify_port (0); -// OBSOLETE -// OBSOLETE } -// OBSOLETE break; -// OBSOLETE -// OBSOLETE default: -// OBSOLETE error ("Unregistered dead_name 0x%x notification received. Type is %d, mid is 0x%x", -// OBSOLETE name, element->type, element->mid); -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE -// OBSOLETE return KERN_SUCCESS; -// OBSOLETE } -// OBSOLETE -// OBSOLETE kern_return_t -// OBSOLETE do_mach_notify_msg_accepted (mach_port_t notify, mach_port_t name) -// OBSOLETE { -// OBSOLETE warning ("do_mach_notify_msg_accepted : notify %x, name %x", -// OBSOLETE notify, name); -// OBSOLETE return KERN_SUCCESS; -// OBSOLETE } -// OBSOLETE -// OBSOLETE kern_return_t -// OBSOLETE do_mach_notify_no_senders (mach_port_t notify, mach_port_mscount_t mscount) -// OBSOLETE { -// OBSOLETE warning ("do_mach_notify_no_senders : notify %x, mscount %x", -// OBSOLETE notify, mscount); -// OBSOLETE return KERN_SUCCESS; -// OBSOLETE } -// OBSOLETE -// OBSOLETE kern_return_t -// OBSOLETE do_mach_notify_port_deleted (mach_port_t notify, mach_port_t name) -// OBSOLETE { -// OBSOLETE warning ("do_mach_notify_port_deleted : notify %x, name %x", -// OBSOLETE notify, name); -// OBSOLETE return KERN_SUCCESS; -// OBSOLETE } -// OBSOLETE -// OBSOLETE kern_return_t -// OBSOLETE do_mach_notify_port_destroyed (mach_port_t notify, mach_port_t rights) -// OBSOLETE { -// OBSOLETE warning ("do_mach_notify_port_destroyed : notify %x, rights %x", -// OBSOLETE notify, rights); -// OBSOLETE return KERN_SUCCESS; -// OBSOLETE } -// OBSOLETE -// OBSOLETE kern_return_t -// OBSOLETE do_mach_notify_send_once (mach_port_t notify) -// OBSOLETE { -// OBSOLETE #ifdef DUMP_SYSCALL -// OBSOLETE /* MANY of these are generated. */ -// OBSOLETE warning ("do_mach_notify_send_once : notify %x", -// OBSOLETE notify); -// OBSOLETE #endif -// OBSOLETE return KERN_SUCCESS; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Kills the inferior. It's gone when you call this */ -// OBSOLETE static void -// OBSOLETE kill_inferior_fast (void) -// OBSOLETE { -// OBSOLETE WAITTYPE w; -// OBSOLETE -// OBSOLETE if (PIDGET (inferior_ptid) == 0 || PIDGET (inferior_ptid) == 1) -// OBSOLETE return; -// OBSOLETE -// OBSOLETE /* kill() it, since the Unix server does not otherwise notice when -// OBSOLETE * killed with task_terminate(). -// OBSOLETE */ -// OBSOLETE if (PIDGET (inferior_ptid) > 0) -// OBSOLETE kill (PIDGET (inferior_ptid), SIGKILL); -// OBSOLETE -// OBSOLETE /* It's propably terminate already */ -// OBSOLETE (void) task_terminate (inferior_task); -// OBSOLETE -// OBSOLETE inferior_task = MACH_PORT_NULL; -// OBSOLETE current_thread = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE wait3 (&w, WNOHANG, 0); -// OBSOLETE -// OBSOLETE setup_notify_port (0); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE m3_kill_inferior (void) -// OBSOLETE { -// OBSOLETE kill_inferior_fast (); -// OBSOLETE target_mourn_inferior (); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Clean up after the inferior dies. */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE m3_mourn_inferior (void) -// OBSOLETE { -// OBSOLETE unpush_target (&m3_ops); -// OBSOLETE generic_mourn_inferior (); -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE /* Fork an inferior process, and start debugging it. */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE m3_create_inferior (char *exec_file, char *allargs, char **env) -// OBSOLETE { -// OBSOLETE fork_inferior (exec_file, allargs, env, m3_trace_me, m3_trace_him, NULL, NULL); -// OBSOLETE /* We are at the first instruction we care about. */ -// OBSOLETE /* Pedal to the metal... */ -// OBSOLETE proceed ((CORE_ADDR) -1, 0, 0); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Mark our target-struct as eligible for stray "run" and "attach" -// OBSOLETE commands. */ -// OBSOLETE static int -// OBSOLETE m3_can_run (void) -// OBSOLETE { -// OBSOLETE return 1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Mach 3.0 does not need ptrace for anything -// OBSOLETE * Make sure nobody uses it on mach. -// OBSOLETE */ -// OBSOLETE ptrace (int a, int b, int c, int d) -// OBSOLETE { -// OBSOLETE error ("Lose, Lose! Somebody called ptrace\n"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Resume execution of the inferior process. -// OBSOLETE If STEP is nonzero, single-step it. -// OBSOLETE If SIGNAL is nonzero, give it that signal. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE m3_resume (ptid_t ptid, int step, enum target_signal signal) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE if (step) -// OBSOLETE { -// OBSOLETE thread_basic_info_data_t th_info; -// OBSOLETE unsigned int infoCnt = THREAD_BASIC_INFO_COUNT; -// OBSOLETE -// OBSOLETE /* There is no point in single stepping when current_thread -// OBSOLETE * is dead. -// OBSOLETE */ -// OBSOLETE if (!MACH_PORT_VALID (current_thread)) -// OBSOLETE error ("No thread selected; can not single step"); -// OBSOLETE -// OBSOLETE /* If current_thread is suspended, tracing it would never return. -// OBSOLETE */ -// OBSOLETE ret = thread_info (current_thread, -// OBSOLETE THREAD_BASIC_INFO, -// OBSOLETE (thread_info_t) & th_info, -// OBSOLETE &infoCnt); -// OBSOLETE CHK ("child_resume: can't get thread info", ret); -// OBSOLETE -// OBSOLETE if (th_info.suspend_count) -// OBSOLETE error ("Can't trace a suspended thread. Use \"thread resume\" command to resume it"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE vm_read_cache_valid = FALSE; -// OBSOLETE -// OBSOLETE if (signal && PIDGET (inferior_ptid) > 0) /* Do not signal, if attached by MID */ -// OBSOLETE kill (PIDGET (inferior_ptid), target_signal_to_host (signal)); -// OBSOLETE -// OBSOLETE if (step) -// OBSOLETE { -// OBSOLETE suspend_all_threads (0); -// OBSOLETE -// OBSOLETE setup_single_step (current_thread, TRUE); -// OBSOLETE -// OBSOLETE ret = thread_resume (current_thread); -// OBSOLETE CHK ("thread_resume", ret); -// OBSOLETE } -// OBSOLETE -// OBSOLETE ret = task_resume (inferior_task); -// OBSOLETE if (ret == KERN_FAILURE) -// OBSOLETE warning ("Task was not suspended"); -// OBSOLETE else -// OBSOLETE CHK ("Resuming task", ret); -// OBSOLETE -// OBSOLETE /* HACK HACK This is needed by the multiserver system HACK HACK */ -// OBSOLETE while ((ret = task_resume (inferior_task)) == KERN_SUCCESS) -// OBSOLETE /* make sure it really runs */ ; -// OBSOLETE /* HACK HACK This is needed by the multiserver system HACK HACK */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE #ifdef ATTACH_DETACH -// OBSOLETE -// OBSOLETE /* Start debugging the process with the given task */ -// OBSOLETE void -// OBSOLETE task_attach (task_t tid) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE inferior_task = tid; -// OBSOLETE -// OBSOLETE ret = task_suspend (inferior_task); -// OBSOLETE CHK ("task_attach: task_suspend", ret); -// OBSOLETE -// OBSOLETE must_suspend_thread = 0; -// OBSOLETE -// OBSOLETE setup_notify_port (1); -// OBSOLETE -// OBSOLETE request_notify (inferior_task, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_TASK); -// OBSOLETE -// OBSOLETE setup_exception_port (); -// OBSOLETE -// OBSOLETE emulator_present = have_emulator_p (inferior_task); -// OBSOLETE -// OBSOLETE attach_flag = 1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Well, we can call error also here and leave the -// OBSOLETE * target stack inconsistent. Sigh. -// OBSOLETE * Fix this sometime (the only way to fail here is that -// OBSOLETE * the task has no threads at all, which is rare, but -// OBSOLETE * possible; or if the target task has died, which is also -// OBSOLETE * possible, but unlikely, since it has been suspended. -// OBSOLETE * (Someone must have killed it)) -// OBSOLETE */ -// OBSOLETE void -// OBSOLETE attach_to_thread (void) -// OBSOLETE { -// OBSOLETE if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS) -// OBSOLETE error ("Could not select any threads to attach to"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE mid_attach (int mid) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE ret = machid_mach_port (mid_server, mid_auth, mid, &inferior_task); -// OBSOLETE CHK ("mid_attach: machid_mach_port", ret); -// OBSOLETE -// OBSOLETE task_attach (inferior_task); -// OBSOLETE -// OBSOLETE return mid; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Start debugging the process whose unix process-id is PID. -// OBSOLETE * A negative "pid" value is legal and signifies a mach_id not a unix pid. -// OBSOLETE * -// OBSOLETE * Prevent (possible unwanted) dangerous operations by enabled users -// OBSOLETE * like "atta 0" or "atta foo" (equal to the previous :-) and -// OBSOLETE * "atta pidself". Anyway, the latter is allowed by specifying a MID. -// OBSOLETE */ -// OBSOLETE static int -// OBSOLETE m3_do_attach (int pid) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE if (pid == 0) -// OBSOLETE error ("MID=0, Debugging the master unix server does not compute"); -// OBSOLETE -// OBSOLETE /* Foo. This assumes gdb has a unix pid */ -// OBSOLETE if (pid == getpid ()) -// OBSOLETE error ("I will debug myself only by mid. (Gdb would suspend itself!)"); -// OBSOLETE -// OBSOLETE if (pid < 0) -// OBSOLETE { -// OBSOLETE mid_attach (-(pid)); -// OBSOLETE -// OBSOLETE /* inferior_ptid will be NEGATIVE! */ -// OBSOLETE inferior_ptid = pid_to_ptid (pid); -// OBSOLETE -// OBSOLETE return PIDGET (inferior_ptid); -// OBSOLETE } -// OBSOLETE -// OBSOLETE inferior_task = task_by_pid (pid); -// OBSOLETE if (!MACH_PORT_VALID (inferior_task)) -// OBSOLETE error ("Cannot map Unix pid %d to Mach task port", pid); -// OBSOLETE -// OBSOLETE task_attach (inferior_task); -// OBSOLETE -// OBSOLETE inferior_ptid = pid_to_ptid (pid); -// OBSOLETE -// OBSOLETE return PIDGET (inferior_ptid); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Attach to process PID, then initialize for debugging it -// OBSOLETE and wait for the trace-trap that results from attaching. */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE m3_attach (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE char *exec_file; -// OBSOLETE int pid; -// OBSOLETE -// OBSOLETE if (!args) -// OBSOLETE error_no_arg ("process-id to attach"); -// OBSOLETE -// OBSOLETE pid = atoi (args); -// OBSOLETE -// OBSOLETE if (pid == getpid ()) /* Trying to masturbate? */ -// OBSOLETE error ("I refuse to debug myself!"); -// OBSOLETE -// OBSOLETE if (from_tty) -// OBSOLETE { -// OBSOLETE exec_file = (char *) get_exec_file (0); -// OBSOLETE -// OBSOLETE if (exec_file) -// OBSOLETE printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, -// OBSOLETE target_pid_to_str (pid_to_ptid (pid))); -// OBSOLETE else -// OBSOLETE printf_unfiltered ("Attaching to %s\n", -// OBSOLETE target_pid_to_str (pid_to_ptid (pid))); -// OBSOLETE -// OBSOLETE gdb_flush (gdb_stdout); -// OBSOLETE } -// OBSOLETE -// OBSOLETE m3_do_attach (pid_to_ptid (pid)); -// OBSOLETE inferior_ptid = pid_to_ptid (pid); -// OBSOLETE push_target (&m3_ops); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE deallocate_inferior_ports (void) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE thread_array_t thread_list; -// OBSOLETE int thread_count, index; -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (inferior_task)) -// OBSOLETE return; -// OBSOLETE -// OBSOLETE ret = task_threads (inferior_task, &thread_list, &thread_count); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE warning ("deallocate_inferior_ports: task_threads", -// OBSOLETE mach_error_string (ret)); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Get rid of send rights to task threads */ -// OBSOLETE for (index = 0; index < thread_count; index++) -// OBSOLETE { -// OBSOLETE int rights; -// OBSOLETE ret = mach_port_get_refs (mach_task_self (), -// OBSOLETE thread_list[index], -// OBSOLETE MACH_PORT_RIGHT_SEND, -// OBSOLETE &rights); -// OBSOLETE CHK ("deallocate_inferior_ports: get refs", ret); -// OBSOLETE -// OBSOLETE if (rights > 0) -// OBSOLETE { -// OBSOLETE ret = mach_port_mod_refs (mach_task_self (), -// OBSOLETE thread_list[index], -// OBSOLETE MACH_PORT_RIGHT_SEND, -// OBSOLETE -rights); -// OBSOLETE CHK ("deallocate_inferior_ports: mod refs", ret); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE ret = mach_port_mod_refs (mach_task_self (), -// OBSOLETE inferior_exception_port, -// OBSOLETE MACH_PORT_RIGHT_RECEIVE, -// OBSOLETE -1); -// OBSOLETE CHK ("deallocate_inferior_ports: cannot get rid of exception port", ret); -// OBSOLETE -// OBSOLETE ret = mach_port_deallocate (mach_task_self (), -// OBSOLETE inferior_task); -// OBSOLETE CHK ("deallocate_task_port: deallocating inferior_task", ret); -// OBSOLETE -// OBSOLETE current_thread = MACH_PORT_NULL; -// OBSOLETE inferior_task = MACH_PORT_NULL; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Stop debugging the process whose number is PID -// OBSOLETE and continue it with signal number SIGNAL. -// OBSOLETE SIGNAL = 0 means just continue it. */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE m3_do_detach (int signal) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE MACH_ERROR_NO_INFERIOR; -// OBSOLETE -// OBSOLETE if (current_thread != MACH_PORT_NULL) -// OBSOLETE { -// OBSOLETE /* Store the gdb's view of the thread we are deselecting -// OBSOLETE * before we detach. -// OBSOLETE * @@ I am really not sure if this is ever needeed. -// OBSOLETE */ -// OBSOLETE target_prepare_to_store (); -// OBSOLETE target_store_registers (-1); -// OBSOLETE } -// OBSOLETE -// OBSOLETE ret = task_set_special_port (inferior_task, -// OBSOLETE TASK_EXCEPTION_PORT, -// OBSOLETE inferior_old_exception_port); -// OBSOLETE CHK ("task_set_special_port", ret); -// OBSOLETE -// OBSOLETE /* Discard all requested notifications */ -// OBSOLETE setup_notify_port (0); -// OBSOLETE -// OBSOLETE if (remove_breakpoints ()) -// OBSOLETE warning ("Could not remove breakpoints when detaching"); -// OBSOLETE -// OBSOLETE if (signal && PIDGET (inferior_ptid) > 0) -// OBSOLETE kill (PIDGET (inferior_ptid), signal); -// OBSOLETE -// OBSOLETE /* the task might be dead by now */ -// OBSOLETE (void) task_resume (inferior_task); -// OBSOLETE -// OBSOLETE deallocate_inferior_ports (); -// OBSOLETE -// OBSOLETE attach_flag = 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Take a program previously attached to and detaches it. -// OBSOLETE The program resumes execution and will no longer stop -// OBSOLETE on signals, etc. We'd better not have left any breakpoints -// OBSOLETE in the program or it'll die when it hits one. For this -// OBSOLETE to work, it may be necessary for the process to have been -// OBSOLETE previously attached. It *might* work if the program was -// OBSOLETE started via fork. */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE m3_detach (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE int siggnal = 0; -// OBSOLETE -// OBSOLETE if (from_tty) -// OBSOLETE { -// OBSOLETE char *exec_file = get_exec_file (0); -// OBSOLETE if (exec_file == 0) -// OBSOLETE exec_file = ""; -// OBSOLETE printf_unfiltered ("Detaching from program: %s %s\n", -// OBSOLETE exec_file, target_pid_to_str (inferior_ptid)); -// OBSOLETE gdb_flush (gdb_stdout); -// OBSOLETE } -// OBSOLETE if (args) -// OBSOLETE siggnal = atoi (args); -// OBSOLETE -// OBSOLETE m3_do_detach (siggnal); -// OBSOLETE inferior_ptid = null_ptid; -// OBSOLETE unpush_target (&m3_ops); /* Pop out of handling an inferior */ -// OBSOLETE } -// OBSOLETE #endif /* ATTACH_DETACH */ -// OBSOLETE -// OBSOLETE /* Get ready to modify the registers array. On machines which store -// OBSOLETE individual registers, this doesn't need to do anything. On machines -// OBSOLETE which store all the registers in one fell swoop, this makes sure -// OBSOLETE that registers contains all the registers from the program being -// OBSOLETE debugged. */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE m3_prepare_to_store (void) -// OBSOLETE { -// OBSOLETE #ifdef CHILD_PREPARE_TO_STORE -// OBSOLETE CHILD_PREPARE_TO_STORE (); -// OBSOLETE #endif -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Print status information about what we're accessing. */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE m3_files_info (struct target_ops *ignore) -// OBSOLETE { -// OBSOLETE /* FIXME: should print MID and all that crap. */ -// OBSOLETE printf_unfiltered ("\tUsing the running image of %s %s.\n", -// OBSOLETE attach_flag ? "attached" : "child", target_pid_to_str (inferior_ptid)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE m3_open (char *arg, int from_tty) -// OBSOLETE { -// OBSOLETE error ("Use the \"run\" command to start a Unix child process."); -// OBSOLETE } -// OBSOLETE -// OBSOLETE #ifdef DUMP_SYSCALL -// OBSOLETE #define STR(x) #x -// OBSOLETE -// OBSOLETE char *bsd1_names[] = -// OBSOLETE { -// OBSOLETE "execve", -// OBSOLETE "fork", -// OBSOLETE "take_signal", -// OBSOLETE "sigreturn", -// OBSOLETE "getrusage", -// OBSOLETE "chdir", -// OBSOLETE "chroot", -// OBSOLETE "open", -// OBSOLETE "creat", -// OBSOLETE "mknod", -// OBSOLETE "link", -// OBSOLETE "symlink", -// OBSOLETE "unlink", -// OBSOLETE "access", -// OBSOLETE "stat", -// OBSOLETE "readlink", -// OBSOLETE "chmod", -// OBSOLETE "chown", -// OBSOLETE "utimes", -// OBSOLETE "truncate", -// OBSOLETE "rename", -// OBSOLETE "mkdir", -// OBSOLETE "rmdir", -// OBSOLETE "xutimes", -// OBSOLETE "mount", -// OBSOLETE "umount", -// OBSOLETE "acct", -// OBSOLETE "setquota", -// OBSOLETE "write_short", -// OBSOLETE "write_long", -// OBSOLETE "send_short", -// OBSOLETE "send_long", -// OBSOLETE "sendto_short", -// OBSOLETE "sendto_long", -// OBSOLETE "select", -// OBSOLETE "task_by_pid", -// OBSOLETE "recvfrom_short", -// OBSOLETE "recvfrom_long", -// OBSOLETE "setgroups", -// OBSOLETE "setrlimit", -// OBSOLETE "sigvec", -// OBSOLETE "sigstack", -// OBSOLETE "settimeofday", -// OBSOLETE "adjtime", -// OBSOLETE "setitimer", -// OBSOLETE "sethostname", -// OBSOLETE "bind", -// OBSOLETE "accept", -// OBSOLETE "connect", -// OBSOLETE "setsockopt", -// OBSOLETE "getsockopt", -// OBSOLETE "getsockname", -// OBSOLETE "getpeername", -// OBSOLETE "init_process", -// OBSOLETE "table_set", -// OBSOLETE "table_get", -// OBSOLETE "pioctl", -// OBSOLETE "emulator_error", -// OBSOLETE "readwrite", -// OBSOLETE "share_wakeup", -// OBSOLETE 0, -// OBSOLETE "maprw_request_it", -// OBSOLETE "maprw_release_it", -// OBSOLETE "maprw_remap", -// OBSOLETE "pid_by_task", -// OBSOLETE }; -// OBSOLETE -// OBSOLETE int bsd1_nnames = sizeof (bsd1_names) / sizeof (bsd1_names[0]); -// OBSOLETE -// OBSOLETE char * -// OBSOLETE name_str (int name, char *buf) -// OBSOLETE { -// OBSOLETE switch (name) -// OBSOLETE { -// OBSOLETE case MACH_MSG_TYPE_BOOLEAN: -// OBSOLETE return "boolean"; -// OBSOLETE case MACH_MSG_TYPE_INTEGER_16: -// OBSOLETE return "short"; -// OBSOLETE case MACH_MSG_TYPE_INTEGER_32: -// OBSOLETE return "long"; -// OBSOLETE case MACH_MSG_TYPE_CHAR: -// OBSOLETE return "char"; -// OBSOLETE case MACH_MSG_TYPE_BYTE: -// OBSOLETE return "byte"; -// OBSOLETE case MACH_MSG_TYPE_REAL: -// OBSOLETE return "real"; -// OBSOLETE case MACH_MSG_TYPE_STRING: -// OBSOLETE return "string"; -// OBSOLETE default: -// OBSOLETE sprintf (buf, "%d", name); -// OBSOLETE return buf; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE char * -// OBSOLETE id_str (int id, char *buf) -// OBSOLETE { -// OBSOLETE char *p; -// OBSOLETE if (id >= 101000 && id < 101000 + bsd1_nnames) -// OBSOLETE { -// OBSOLETE if (p = bsd1_names[id - 101000]) -// OBSOLETE return p; -// OBSOLETE } -// OBSOLETE if (id == 102000) -// OBSOLETE return "psignal_retry"; -// OBSOLETE if (id == 100000) -// OBSOLETE return "syscall"; -// OBSOLETE sprintf (buf, "%d", id); -// OBSOLETE return buf; -// OBSOLETE } -// OBSOLETE -// OBSOLETE print_msg (mach_msg_header_t *mp) -// OBSOLETE { -// OBSOLETE char *fmt_x = "%20s : 0x%08x\n"; -// OBSOLETE char *fmt_d = "%20s : %10d\n"; -// OBSOLETE char *fmt_s = "%20s : %s\n"; -// OBSOLETE char buf[100]; -// OBSOLETE -// OBSOLETE puts_filtered ("\n"); -// OBSOLETE #define pr(fmt,h,x) printf_filtered(fmt,STR(x),(h).x) -// OBSOLETE pr (fmt_x, (*mp), msgh_bits); -// OBSOLETE pr (fmt_d, (*mp), msgh_size); -// OBSOLETE pr (fmt_x, (*mp), msgh_remote_port); -// OBSOLETE pr (fmt_x, (*mp), msgh_local_port); -// OBSOLETE pr (fmt_d, (*mp), msgh_kind); -// OBSOLETE printf_filtered (fmt_s, STR (msgh_id), id_str (mp->msgh_id, buf)); -// OBSOLETE -// OBSOLETE if (debug_level > 1) -// OBSOLETE { -// OBSOLETE char *p, *ep, *dp; -// OBSOLETE int plen; -// OBSOLETE p = (char *) mp; -// OBSOLETE ep = p + mp->msgh_size; -// OBSOLETE p += sizeof (*mp); -// OBSOLETE for (; p < ep; p += plen) -// OBSOLETE { -// OBSOLETE mach_msg_type_t *tp; -// OBSOLETE mach_msg_type_long_t *tlp; -// OBSOLETE int name, size, number; -// OBSOLETE tp = (mach_msg_type_t *) p; -// OBSOLETE if (tp->msgt_longform) -// OBSOLETE { -// OBSOLETE tlp = (mach_msg_type_long_t *) tp; -// OBSOLETE name = tlp->msgtl_name; -// OBSOLETE size = tlp->msgtl_size; -// OBSOLETE number = tlp->msgtl_number; -// OBSOLETE plen = sizeof (*tlp); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE name = tp->msgt_name; -// OBSOLETE size = tp->msgt_size; -// OBSOLETE number = tp->msgt_number; -// OBSOLETE plen = sizeof (*tp); -// OBSOLETE } -// OBSOLETE printf_filtered ("name=%-16s size=%2d number=%7d inline=%d long=%d deal=%d\n", -// OBSOLETE name_str (name, buf), size, number, tp->msgt_inline, -// OBSOLETE tp->msgt_longform, tp->msgt_deallocate); -// OBSOLETE dp = p + plen; -// OBSOLETE if (tp->msgt_inline) -// OBSOLETE { -// OBSOLETE int l; -// OBSOLETE l = size * number / 8; -// OBSOLETE l = (l + sizeof (long) - 1) & ~((sizeof (long)) - 1); -// OBSOLETE plen += l; -// OBSOLETE print_data (dp, size, number); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE plen += sizeof (int *); -// OBSOLETE } -// OBSOLETE printf_filtered ("plen=%d\n", plen); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE print_data (char *p, int size, int number) -// OBSOLETE { -// OBSOLETE int *ip; -// OBSOLETE short *sp; -// OBSOLETE int i; -// OBSOLETE -// OBSOLETE switch (size) -// OBSOLETE { -// OBSOLETE case 8: -// OBSOLETE for (i = 0; i < number; i++) -// OBSOLETE { -// OBSOLETE printf_filtered (" %02x", p[i]); -// OBSOLETE } -// OBSOLETE break; -// OBSOLETE case 16: -// OBSOLETE sp = (short *) p; -// OBSOLETE for (i = 0; i < number; i++) -// OBSOLETE { -// OBSOLETE printf_filtered (" %04x", sp[i]); -// OBSOLETE } -// OBSOLETE break; -// OBSOLETE case 32: -// OBSOLETE ip = (int *) p; -// OBSOLETE for (i = 0; i < number; i++) -// OBSOLETE { -// OBSOLETE printf_filtered (" %08x", ip[i]); -// OBSOLETE } -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE puts_filtered ("\n"); -// OBSOLETE } -// OBSOLETE #endif /* DUMP_SYSCALL */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE m3_stop (void) -// OBSOLETE { -// OBSOLETE error ("to_stop target function not implemented"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static char * -// OBSOLETE m3_pid_to_exec_file (int pid) -// OBSOLETE { -// OBSOLETE error ("to_pid_to_exec_file target function not implemented"); -// OBSOLETE return NULL; /* To keep all compilers happy. */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE init_m3_ops (void) -// OBSOLETE { -// OBSOLETE m3_ops.to_shortname = "mach"; -// OBSOLETE m3_ops.to_longname = "Mach child process"; -// OBSOLETE m3_ops.to_doc = "Mach child process (started by the \"run\" command)."; -// OBSOLETE m3_ops.to_open = m3_open; -// OBSOLETE m3_ops.to_attach = m3_attach; -// OBSOLETE m3_ops.to_detach = m3_detach; -// OBSOLETE m3_ops.to_resume = m3_resume; -// OBSOLETE m3_ops.to_wait = mach_really_wait; -// OBSOLETE m3_ops.to_fetch_registers = fetch_inferior_registers; -// OBSOLETE m3_ops.to_store_registers = store_inferior_registers; -// OBSOLETE m3_ops.to_prepare_to_store = m3_prepare_to_store; -// OBSOLETE m3_ops.to_xfer_memory = m3_xfer_memory; -// OBSOLETE m3_ops.to_files_info = m3_files_info; -// OBSOLETE m3_ops.to_insert_breakpoint = memory_insert_breakpoint; -// OBSOLETE m3_ops.to_remove_breakpoint = memory_remove_breakpoint; -// OBSOLETE m3_ops.to_terminal_init = terminal_init_inferior; -// OBSOLETE m3_ops.to_terminal_inferior = terminal_inferior; -// OBSOLETE m3_ops.to_terminal_ours_for_output = terminal_ours_for_output; -// OBSOLETE m3_ops.to_terminal_save_ours = terminal_save_ours; -// OBSOLETE m3_ops.to_terminal_ours = terminal_ours; -// OBSOLETE m3_ops.to_terminal_info = child_terminal_info; -// OBSOLETE m3_ops.to_kill = m3_kill_inferior; -// OBSOLETE m3_ops.to_create_inferior = m3_create_inferior; -// OBSOLETE m3_ops.to_mourn_inferior = m3_mourn_inferior; -// OBSOLETE m3_ops.to_can_run = m3_can_run; -// OBSOLETE m3_ops.to_stop = m3_stop; -// OBSOLETE m3_ops.to_pid_to_exec_file = m3_pid_to_exec_file; -// OBSOLETE m3_ops.to_stratum = process_stratum; -// OBSOLETE m3_ops.to_has_all_memory = 1; -// OBSOLETE m3_ops.to_has_memory = 1; -// OBSOLETE m3_ops.to_has_stack = 1; -// OBSOLETE m3_ops.to_has_registers = 1; -// OBSOLETE m3_ops.to_has_execution = 1; -// OBSOLETE m3_ops.to_magic = OPS_MAGIC; -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE _initialize_m3_nat (void) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE init_m3_ops (); -// OBSOLETE add_target (&m3_ops); -// OBSOLETE -// OBSOLETE ret = mach_port_allocate (mach_task_self (), -// OBSOLETE MACH_PORT_RIGHT_PORT_SET, -// OBSOLETE &inferior_wait_port_set); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE internal_error (__FILE__, __LINE__, -// OBSOLETE "initial port set %s", mach_error_string (ret)); -// OBSOLETE -// OBSOLETE /* mach_really_wait now waits for this */ -// OBSOLETE currently_waiting_for = inferior_wait_port_set; -// OBSOLETE -// OBSOLETE ret = netname_look_up (name_server_port, hostname, "MachID", &mid_server); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE { -// OBSOLETE mid_server = MACH_PORT_NULL; -// OBSOLETE -// OBSOLETE warning ("initialize machid: netname_lookup_up(MachID) : %s", -// OBSOLETE mach_error_string (ret)); -// OBSOLETE warning ("Some (most?) features disabled..."); -// OBSOLETE } -// OBSOLETE -// OBSOLETE mid_auth = mach_privileged_host_port (); -// OBSOLETE if (mid_auth == MACH_PORT_NULL) -// OBSOLETE mid_auth = mach_task_self (); -// OBSOLETE -// OBSOLETE obstack_init (port_chain_obstack); -// OBSOLETE -// OBSOLETE ret = mach_port_allocate (mach_task_self (), -// OBSOLETE MACH_PORT_RIGHT_RECEIVE, -// OBSOLETE &thread_exception_port); -// OBSOLETE CHK ("Creating thread_exception_port for single stepping", ret); -// OBSOLETE -// OBSOLETE ret = mach_port_insert_right (mach_task_self (), -// OBSOLETE thread_exception_port, -// OBSOLETE thread_exception_port, -// OBSOLETE MACH_MSG_TYPE_MAKE_SEND); -// OBSOLETE CHK ("Inserting send right to thread_exception_port", ret); -// OBSOLETE -// OBSOLETE /* Allocate message port */ -// OBSOLETE ret = mach_port_allocate (mach_task_self (), -// OBSOLETE MACH_PORT_RIGHT_RECEIVE, -// OBSOLETE &our_message_port); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE warning ("Creating message port %s", mach_error_string (ret)); -// OBSOLETE else -// OBSOLETE { -// OBSOLETE char buf[MAX_NAME_LEN]; -// OBSOLETE ret = mach_port_move_member (mach_task_self (), -// OBSOLETE our_message_port, -// OBSOLETE inferior_wait_port_set); -// OBSOLETE if (ret != KERN_SUCCESS) -// OBSOLETE warning ("message move member %s", mach_error_string (ret)); -// OBSOLETE -// OBSOLETE -// OBSOLETE /* @@@@ No way to change message port name currently */ -// OBSOLETE /* Foo. This assumes gdb has a unix pid */ -// OBSOLETE sprintf (buf, "gdb-%d", getpid ()); -// OBSOLETE gdb_register_port (buf, our_message_port); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Heap for thread commands */ -// OBSOLETE obstack_init (cproc_obstack); -// OBSOLETE -// OBSOLETE add_mach_specific_commands (); -// OBSOLETE } diff --git a/gdb/mipsm3-nat.c b/gdb/mipsm3-nat.c deleted file mode 100644 index f1fd859..0000000 --- a/gdb/mipsm3-nat.c +++ /dev/null @@ -1,386 +0,0 @@ -// OBSOLETE /* Definitions to make GDB run on a mips box under Mach 3.0 -// OBSOLETE Copyright 1992, 1993, 1998, 2000, 2001 Free Software Foundation, Inc. -// OBSOLETE -// OBSOLETE This file is part of GDB. -// OBSOLETE -// OBSOLETE This program is free software; you can redistribute it and/or modify -// OBSOLETE it under the terms of the GNU General Public License as published by -// OBSOLETE the Free Software Foundation; either version 2 of the License, or -// OBSOLETE (at your option) any later version. -// OBSOLETE -// OBSOLETE This program is distributed in the hope that it will be useful, -// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of -// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// OBSOLETE GNU General Public License for more details. -// OBSOLETE -// OBSOLETE You should have received a copy of the GNU General Public License -// OBSOLETE along with this program; if not, write to the Free Software -// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, -// OBSOLETE Boston, MA 02111-1307, USA. */ -// OBSOLETE -// OBSOLETE /* Mach specific routines for little endian mips (e.g. pmax) -// OBSOLETE * running Mach 3.0 -// OBSOLETE * -// OBSOLETE * Author: Jukka Virtanen -// OBSOLETE */ -// OBSOLETE -// OBSOLETE #include "defs.h" -// OBSOLETE #include "inferior.h" -// OBSOLETE #include "regcache.h" -// OBSOLETE -// OBSOLETE #include -// OBSOLETE -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE -// OBSOLETE /* Find offsets to thread states at compile time. -// OBSOLETE * If your compiler does not grok this, check the hand coded -// OBSOLETE * offsets and use them. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE #if 1 -// OBSOLETE -// OBSOLETE #define REG_OFFSET(reg) (int)(&((struct mips_thread_state *)0)->reg) -// OBSOLETE #define CREG_OFFSET(reg) (int)(&((struct mips_float_state *)0)->reg) -// OBSOLETE #define EREG_OFFSET(reg) (int)(&((struct mips_exc_state *)0)->reg) -// OBSOLETE -// OBSOLETE /* at reg_offset[i] is the offset to the mips_thread_state -// OBSOLETE * location where the gdb registers[i] is stored. -// OBSOLETE * -// OBSOLETE * -1 means mach does not save it anywhere. -// OBSOLETE */ -// OBSOLETE static int reg_offset[] = -// OBSOLETE { -// OBSOLETE /* zero at v0 v1 */ -// OBSOLETE -1, REG_OFFSET (r1), REG_OFFSET (r2), REG_OFFSET (r3), -// OBSOLETE -// OBSOLETE /* a0 a1 a2 a3 */ -// OBSOLETE REG_OFFSET (r4), REG_OFFSET (r5), REG_OFFSET (r6), REG_OFFSET (r7), -// OBSOLETE -// OBSOLETE /* t0 t1 t2 t3 */ -// OBSOLETE REG_OFFSET (r8), REG_OFFSET (r9), REG_OFFSET (r10), REG_OFFSET (r11), -// OBSOLETE -// OBSOLETE /* t4 t5 t6 t7 */ -// OBSOLETE REG_OFFSET (r12), REG_OFFSET (r13), REG_OFFSET (r14), REG_OFFSET (r15), -// OBSOLETE -// OBSOLETE /* s0 s1 s2 s3 */ -// OBSOLETE REG_OFFSET (r16), REG_OFFSET (r17), REG_OFFSET (r18), REG_OFFSET (r19), -// OBSOLETE -// OBSOLETE /* s4 s5 s6 s7 */ -// OBSOLETE REG_OFFSET (r20), REG_OFFSET (r21), REG_OFFSET (r22), REG_OFFSET (r23), -// OBSOLETE -// OBSOLETE /* t8 t9 k0 k1 */ -// OBSOLETE REG_OFFSET (r24), REG_OFFSET (r25), REG_OFFSET (r26), REG_OFFSET (r27), -// OBSOLETE -// OBSOLETE /* gp sp s8(30) == fp(72) ra */ -// OBSOLETE REG_OFFSET (r28), REG_OFFSET (r29), REG_OFFSET (r30), REG_OFFSET (r31), -// OBSOLETE -// OBSOLETE /* sr(32) PS_REGNUM */ -// OBSOLETE EREG_OFFSET (coproc_state), -// OBSOLETE -// OBSOLETE /* lo(33) hi(34) */ -// OBSOLETE REG_OFFSET (mdlo), REG_OFFSET (mdhi), -// OBSOLETE -// OBSOLETE /* bad(35) cause(36) pc(37) */ -// OBSOLETE EREG_OFFSET (address), EREG_OFFSET (cause), REG_OFFSET (pc), -// OBSOLETE -// OBSOLETE /* f0(38) f1(39) f2(40) f3(41) */ -// OBSOLETE CREG_OFFSET (r0), CREG_OFFSET (r1), CREG_OFFSET (r2), CREG_OFFSET (r3), -// OBSOLETE CREG_OFFSET (r4), CREG_OFFSET (r5), CREG_OFFSET (r6), CREG_OFFSET (r7), -// OBSOLETE CREG_OFFSET (r8), CREG_OFFSET (r9), CREG_OFFSET (r10), CREG_OFFSET (r11), -// OBSOLETE CREG_OFFSET (r12), CREG_OFFSET (r13), CREG_OFFSET (r14), CREG_OFFSET (r15), -// OBSOLETE CREG_OFFSET (r16), CREG_OFFSET (r17), CREG_OFFSET (r18), CREG_OFFSET (r19), -// OBSOLETE CREG_OFFSET (r20), CREG_OFFSET (r21), CREG_OFFSET (r22), CREG_OFFSET (r23), -// OBSOLETE CREG_OFFSET (r24), CREG_OFFSET (r25), CREG_OFFSET (r26), CREG_OFFSET (r27), -// OBSOLETE CREG_OFFSET (r28), CREG_OFFSET (r29), CREG_OFFSET (r30), CREG_OFFSET (r31), -// OBSOLETE -// OBSOLETE /* fsr(70) fir(71) fp(72) == s8(30) */ -// OBSOLETE CREG_OFFSET (csr), CREG_OFFSET (esr), REG_OFFSET (r30) -// OBSOLETE }; -// OBSOLETE #else -// OBSOLETE /* If the compiler does not grok the above defines */ -// OBSOLETE static int reg_offset[] = -// OBSOLETE { -// OBSOLETE /* mach_thread_state offsets: */ -// OBSOLETE -1, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, -// OBSOLETE 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, -// OBSOLETE /*sr, lo, hi,addr,cause,pc */ -// OBSOLETE 8, 124, 128, 4, 0, 132, -// OBSOLETE /* mach_float_state offsets: */ -// OBSOLETE 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, -// OBSOLETE 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, -// OBSOLETE /*fsr,fir */ -// OBSOLETE 128, 132, -// OBSOLETE /* FP_REGNUM pseudo maps to s8==r30 in mach_thread_state */ -// OBSOLETE 116 -// OBSOLETE }; -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE /* Fetch COUNT contiguous registers from thread STATE starting from REGNUM -// OBSOLETE * Caller knows that the regs handled in one transaction are of same size. -// OBSOLETE */ -// OBSOLETE #define FETCH_REGS(state, regnum, count) \ -// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (regnum)], \ -// OBSOLETE (char *)state+reg_offset[ regnum ], \ -// OBSOLETE count*REGISTER_SIZE) -// OBSOLETE -// OBSOLETE /* Store COUNT contiguous registers to thread STATE starting from REGNUM */ -// OBSOLETE #define STORE_REGS(state, regnum, count) \ -// OBSOLETE memcpy ((char *)state+reg_offset[ regnum ], \ -// OBSOLETE &deprecated_registers[REGISTER_BYTE (regnum)], \ -// OBSOLETE count*REGISTER_SIZE) -// OBSOLETE -// OBSOLETE #define REGS_ALL -1 -// OBSOLETE #define REGS_NORMAL 1 -// OBSOLETE #define REGS_EXC 2 -// OBSOLETE #define REGS_COP1 4 -// OBSOLETE -// OBSOLETE /* Hardware regs that matches FP_REGNUM */ -// OBSOLETE #define MACH_FP_REGNUM 30 -// OBSOLETE -// OBSOLETE /* Fech thread's registers. if regno == -1, fetch all regs */ -// OBSOLETE void -// OBSOLETE fetch_inferior_registers (int regno) -// OBSOLETE { -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE thread_state_data_t state; -// OBSOLETE struct mips_exc_state exc_state; -// OBSOLETE -// OBSOLETE int stateCnt = MIPS_THREAD_STATE_COUNT; -// OBSOLETE -// OBSOLETE int which_regs = 0; /* A bit mask */ -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (current_thread)) -// OBSOLETE error ("fetch inferior registers: Invalid thread"); -// OBSOLETE -// OBSOLETE if (regno < -1 || regno >= NUM_REGS) -// OBSOLETE error ("invalid register %d supplied to fetch_inferior_registers", regno); -// OBSOLETE -// OBSOLETE if (regno == -1) -// OBSOLETE which_regs = REGS_ALL; -// OBSOLETE else if (regno == ZERO_REGNUM) -// OBSOLETE { -// OBSOLETE int zero = 0; -// OBSOLETE supply_register (ZERO_REGNUM, &zero); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE else if ((ZERO_REGNUM < regno && regno < PS_REGNUM) -// OBSOLETE || regno == FP_REGNUM -// OBSOLETE || regno == LO_REGNUM -// OBSOLETE || regno == HI_REGNUM -// OBSOLETE || regno == PC_REGNUM) -// OBSOLETE which_regs = REGS_NORMAL; -// OBSOLETE else if (FP0_REGNUM <= regno && regno <= FCRIR_REGNUM) -// OBSOLETE which_regs = REGS_COP1 | REGS_EXC; -// OBSOLETE else -// OBSOLETE which_regs = REGS_EXC; -// OBSOLETE -// OBSOLETE /* fetch regs saved to mips_thread_state */ -// OBSOLETE if (which_regs & REGS_NORMAL) -// OBSOLETE { -// OBSOLETE ret = thread_get_state (current_thread, -// OBSOLETE MIPS_THREAD_STATE, -// OBSOLETE state, -// OBSOLETE &stateCnt); -// OBSOLETE CHK ("fetch inferior registers: thread_get_state", ret); -// OBSOLETE -// OBSOLETE if (which_regs == REGS_NORMAL) -// OBSOLETE { -// OBSOLETE /* Fetch also FP_REGNUM if fetching MACH_FP_REGNUM and vice versa */ -// OBSOLETE if (regno == MACH_FP_REGNUM || regno == FP_REGNUM) -// OBSOLETE { -// OBSOLETE supply_register (FP_REGNUM, -// OBSOLETE (char *) state + reg_offset[MACH_FP_REGNUM]); -// OBSOLETE supply_register (MACH_FP_REGNUM, -// OBSOLETE (char *) state + reg_offset[MACH_FP_REGNUM]); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE supply_register (regno, -// OBSOLETE (char *) state + reg_offset[regno]); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* ZERO_REGNUM is always zero */ -// OBSOLETE *(int *) deprecated_registers = 0; -// OBSOLETE -// OBSOLETE /* Copy thread saved regs 1..31 to gdb's reg value array -// OBSOLETE * Luckily, they are contiquous -// OBSOLETE */ -// OBSOLETE FETCH_REGS (state, 1, 31); -// OBSOLETE -// OBSOLETE /* Copy mdlo and mdhi */ -// OBSOLETE FETCH_REGS (state, LO_REGNUM, 2); -// OBSOLETE -// OBSOLETE /* Copy PC */ -// OBSOLETE FETCH_REGS (state, PC_REGNUM, 1); -// OBSOLETE -// OBSOLETE /* Mach 3.0 saves FP to MACH_FP_REGNUM. -// OBSOLETE * For some reason gdb wants to assign a pseudo register for it. -// OBSOLETE */ -// OBSOLETE FETCH_REGS (state, FP_REGNUM, 1); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Read exc state. Also read if need to fetch floats */ -// OBSOLETE if (which_regs & REGS_EXC) -// OBSOLETE { -// OBSOLETE stateCnt = MIPS_EXC_STATE_COUNT; -// OBSOLETE ret = thread_get_state (current_thread, -// OBSOLETE MIPS_EXC_STATE, -// OBSOLETE (thread_state_t) & exc_state, -// OBSOLETE &stateCnt); -// OBSOLETE CHK ("fetch inferior regs (exc): thread_get_state", ret); -// OBSOLETE -// OBSOLETE /* We need to fetch exc_state to see if the floating -// OBSOLETE * state is valid for the thread. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE /* cproc_state: Which coprocessors the thread uses */ -// OBSOLETE supply_register (PS_REGNUM, -// OBSOLETE (char *) &exc_state + reg_offset[PS_REGNUM]); -// OBSOLETE -// OBSOLETE if (which_regs == REGS_EXC || which_regs == REGS_ALL) -// OBSOLETE { -// OBSOLETE supply_register (BADVADDR_REGNUM, -// OBSOLETE (char *) &exc_state + reg_offset[BADVADDR_REGNUM]); -// OBSOLETE -// OBSOLETE supply_register (CAUSE_REGNUM, -// OBSOLETE (char *) &exc_state + reg_offset[CAUSE_REGNUM]); -// OBSOLETE if (which_regs == REGS_EXC) -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE if (which_regs & REGS_COP1) -// OBSOLETE { -// OBSOLETE /* If the thread does not have saved COPROC1, set regs to zero */ -// OBSOLETE -// OBSOLETE if (!(exc_state.coproc_state & MIPS_STATUS_USE_COP1)) -// OBSOLETE bzero (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], -// OBSOLETE sizeof (struct mips_float_state)); -// OBSOLETE else -// OBSOLETE { -// OBSOLETE stateCnt = MIPS_FLOAT_STATE_COUNT; -// OBSOLETE ret = thread_get_state (current_thread, -// OBSOLETE MIPS_FLOAT_STATE, -// OBSOLETE state, -// OBSOLETE &stateCnt); -// OBSOLETE CHK ("fetch inferior regs (floats): thread_get_state", ret); -// OBSOLETE -// OBSOLETE if (regno != -1) -// OBSOLETE { -// OBSOLETE supply_register (regno, -// OBSOLETE (char *) state + reg_offset[regno]); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE FETCH_REGS (state, FP0_REGNUM, 34); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* All registers are valid, if not returned yet */ -// OBSOLETE deprecated_registers_fetched (); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Store gdb's view of registers to the thread. -// OBSOLETE * All registers are always valid when entering here. -// OBSOLETE * @@ ahem, maybe that is too strict, we could validate the necessary ones -// OBSOLETE * here. -// OBSOLETE * -// OBSOLETE * Hmm. It seems that gdb set $reg=value command first reads everything, -// OBSOLETE * then sets the reg and then stores everything. -> we must make sure -// OBSOLETE * that the immutable registers are not changed by reading them first. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE store_inferior_registers (register int regno) -// OBSOLETE { -// OBSOLETE thread_state_data_t state; -// OBSOLETE kern_return_t ret; -// OBSOLETE -// OBSOLETE if (!MACH_PORT_VALID (current_thread)) -// OBSOLETE error ("store inferior registers: Invalid thread"); -// OBSOLETE -// OBSOLETE /* Check for read only regs. -// OBSOLETE * @@ If some of these is can be changed, fix this -// OBSOLETE */ -// OBSOLETE if (regno == ZERO_REGNUM || -// OBSOLETE regno == PS_REGNUM || -// OBSOLETE regno == BADVADDR_REGNUM || -// OBSOLETE regno == CAUSE_REGNUM || -// OBSOLETE regno == FCRIR_REGNUM) -// OBSOLETE { -// OBSOLETE message ("You can not alter read-only register `%s'", -// OBSOLETE REGISTER_NAME (regno)); -// OBSOLETE fetch_inferior_registers (regno); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (regno == -1) -// OBSOLETE { -// OBSOLETE /* Don't allow these to change */ -// OBSOLETE -// OBSOLETE /* ZERO_REGNUM */ -// OBSOLETE *(int *) deprecated_registers = 0; -// OBSOLETE -// OBSOLETE fetch_inferior_registers (PS_REGNUM); -// OBSOLETE fetch_inferior_registers (BADVADDR_REGNUM); -// OBSOLETE fetch_inferior_registers (CAUSE_REGNUM); -// OBSOLETE fetch_inferior_registers (FCRIR_REGNUM); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (regno == -1 || (ZERO_REGNUM < regno && regno <= PC_REGNUM)) -// OBSOLETE { -// OBSOLETE #if 1 -// OBSOLETE /* Mach 3.0 saves thread's FP to MACH_FP_REGNUM. -// OBSOLETE * GDB wants assigns a pseudo register FP_REGNUM for frame pointer. -// OBSOLETE * -// OBSOLETE * @@@ Here I assume (!) that gdb's FP has the value that -// OBSOLETE * should go to threads frame pointer. If not true, this -// OBSOLETE * fails badly!!!!! -// OBSOLETE */ -// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (MACH_FP_REGNUM)], -// OBSOLETE &deprecated_registers[REGISTER_BYTE (FP_REGNUM)], -// OBSOLETE REGISTER_RAW_SIZE (FP_REGNUM)); -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE /* Save gdb's regs 1..31 to thread saved regs 1..31 -// OBSOLETE * Luckily, they are contiquous -// OBSOLETE */ -// OBSOLETE STORE_REGS (state, 1, 31); -// OBSOLETE -// OBSOLETE /* Save mdlo, mdhi */ -// OBSOLETE STORE_REGS (state, LO_REGNUM, 2); -// OBSOLETE -// OBSOLETE /* Save PC */ -// OBSOLETE STORE_REGS (state, PC_REGNUM, 1); -// OBSOLETE -// OBSOLETE ret = thread_set_state (current_thread, -// OBSOLETE MIPS_THREAD_STATE, -// OBSOLETE state, -// OBSOLETE MIPS_FLOAT_STATE_COUNT); -// OBSOLETE CHK ("store inferior regs : thread_set_state", ret); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (regno == -1 || regno >= FP0_REGNUM) -// OBSOLETE { -// OBSOLETE /* If thread has floating state, save it */ -// OBSOLETE if (read_register (PS_REGNUM) & MIPS_STATUS_USE_COP1) -// OBSOLETE { -// OBSOLETE /* Do NOT save FCRIR_REGNUM */ -// OBSOLETE STORE_REGS (state, FP0_REGNUM, 33); -// OBSOLETE -// OBSOLETE ret = thread_set_state (current_thread, -// OBSOLETE MIPS_FLOAT_STATE, -// OBSOLETE state, -// OBSOLETE MIPS_FLOAT_STATE_COUNT); -// OBSOLETE CHK ("store inferior registers (floats): thread_set_state", ret); -// OBSOLETE } -// OBSOLETE else if (regno != -1) -// OBSOLETE message -// OBSOLETE ("Thread does not use floating point unit, floating regs not saved"); -// OBSOLETE } -// OBSOLETE } diff --git a/gdb/mn10200-tdep.c b/gdb/mn10200-tdep.c deleted file mode 100644 index a484f02a..0000000 --- a/gdb/mn10200-tdep.c +++ /dev/null @@ -1,899 +0,0 @@ -// OBSOLETE /* Target-dependent code for the Matsushita MN10200 for GDB, the GNU debugger. -// OBSOLETE -// OBSOLETE Copyright 1997, 1998, 1999, 2000, 2001, 2003 Free Software -// OBSOLETE Foundation, Inc. -// OBSOLETE -// OBSOLETE This file is part of GDB. -// OBSOLETE -// OBSOLETE This program is free software; you can redistribute it and/or modify -// OBSOLETE it under the terms of the GNU General Public License as published by -// OBSOLETE the Free Software Foundation; either version 2 of the License, or -// OBSOLETE (at your option) any later version. -// OBSOLETE -// OBSOLETE This program is distributed in the hope that it will be useful, -// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of -// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// OBSOLETE GNU General Public License for more details. -// OBSOLETE -// OBSOLETE You should have received a copy of the GNU General Public License -// OBSOLETE along with this program; if not, write to the Free Software -// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, -// OBSOLETE Boston, MA 02111-1307, USA. */ -// OBSOLETE -// OBSOLETE #include "defs.h" -// OBSOLETE #include "frame.h" -// OBSOLETE #include "inferior.h" -// OBSOLETE #include "target.h" -// OBSOLETE #include "value.h" -// OBSOLETE #include "bfd.h" -// OBSOLETE #include "gdb_string.h" -// OBSOLETE #include "gdbcore.h" -// OBSOLETE #include "symfile.h" -// OBSOLETE #include "regcache.h" -// OBSOLETE -// OBSOLETE -// OBSOLETE /* Should call_function allocate stack space for a struct return? */ -// OBSOLETE int -// OBSOLETE mn10200_use_struct_convention (int gcc_p, struct type *type) -// OBSOLETE { -// OBSOLETE return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 8); -// OBSOLETE } -// OBSOLETE /* *INDENT-OFF* */ -// OBSOLETE /* The main purpose of this file is dealing with prologues to extract -// OBSOLETE information about stack frames and saved registers. -// OBSOLETE -// OBSOLETE For reference here's how prologues look on the mn10200: -// OBSOLETE -// OBSOLETE With frame pointer: -// OBSOLETE mov fp,a0 -// OBSOLETE mov sp,fp -// OBSOLETE add ,sp -// OBSOLETE Register saves for d2, d3, a1, a2 as needed. Saves start -// OBSOLETE at fp - + and work towards higher -// OBSOLETE addresses. Note that the saves are actually done off the stack -// OBSOLETE pointer in the prologue! This makes for smaller code and easier -// OBSOLETE prologue scanning as the displacement fields will unlikely -// OBSOLETE be more than 8 bits! -// OBSOLETE -// OBSOLETE Without frame pointer: -// OBSOLETE add ,sp -// OBSOLETE Register saves for d2, d3, a1, a2 as needed. Saves start -// OBSOLETE at sp + and work towards higher addresses. -// OBSOLETE -// OBSOLETE Out of line prologue: -// OBSOLETE add ,sp -- optional -// OBSOLETE jsr __prologue -// OBSOLETE add ,sp -- optional -// OBSOLETE -// OBSOLETE The stack pointer remains constant throughout the life of most -// OBSOLETE functions. As a result the compiler will usually omit the -// OBSOLETE frame pointer, so we must handle frame pointerless functions. */ -// OBSOLETE -// OBSOLETE /* Analyze the prologue to determine where registers are saved, -// OBSOLETE the end of the prologue, etc etc. Return the end of the prologue -// OBSOLETE scanned. -// OBSOLETE -// OBSOLETE We store into FI (if non-null) several tidbits of information: -// OBSOLETE -// OBSOLETE * stack_size -- size of this stack frame. Note that if we stop in -// OBSOLETE certain parts of the prologue/epilogue we may claim the size of the -// OBSOLETE current frame is zero. This happens when the current frame has -// OBSOLETE not been allocated yet or has already been deallocated. -// OBSOLETE -// OBSOLETE * fsr -- Addresses of registers saved in the stack by this frame. -// OBSOLETE -// OBSOLETE * status -- A (relatively) generic status indicator. It's a bitmask -// OBSOLETE with the following bits: -// OBSOLETE -// OBSOLETE MY_FRAME_IN_SP: The base of the current frame is actually in -// OBSOLETE the stack pointer. This can happen for frame pointerless -// OBSOLETE functions, or cases where we're stopped in the prologue/epilogue -// OBSOLETE itself. For these cases mn10200_analyze_prologue will need up -// OBSOLETE update fi->frame before returning or analyzing the register -// OBSOLETE save instructions. -// OBSOLETE -// OBSOLETE MY_FRAME_IN_FP: The base of the current frame is in the -// OBSOLETE frame pointer register ($a2). -// OBSOLETE -// OBSOLETE CALLER_A2_IN_A0: $a2 from the caller's frame is temporarily -// OBSOLETE in $a0. This can happen if we're stopped in the prologue. -// OBSOLETE -// OBSOLETE NO_MORE_FRAMES: Set this if the current frame is "start" or -// OBSOLETE if the first instruction looks like mov ,sp. This tells -// OBSOLETE frame chain to not bother trying to unwind past this frame. */ -// OBSOLETE /* *INDENT-ON* */ -// OBSOLETE -// OBSOLETE -// OBSOLETE -// OBSOLETE -// OBSOLETE #define MY_FRAME_IN_SP 0x1 -// OBSOLETE #define MY_FRAME_IN_FP 0x2 -// OBSOLETE #define CALLER_A2_IN_A0 0x4 -// OBSOLETE #define NO_MORE_FRAMES 0x8 -// OBSOLETE -// OBSOLETE static CORE_ADDR -// OBSOLETE mn10200_analyze_prologue (struct frame_info *fi, CORE_ADDR pc) -// OBSOLETE { -// OBSOLETE CORE_ADDR func_addr, func_end, addr, stop; -// OBSOLETE CORE_ADDR stack_size = 0; -// OBSOLETE unsigned char buf[4]; -// OBSOLETE int status; -// OBSOLETE char *name; -// OBSOLETE int out_of_line_prologue = 0; -// OBSOLETE -// OBSOLETE /* Use the PC in the frame if it's provided to look up the -// OBSOLETE start of this function. */ -// OBSOLETE pc = (fi ? get_frame_pc (fi) : pc); -// OBSOLETE -// OBSOLETE /* Find the start of this function. */ -// OBSOLETE status = find_pc_partial_function (pc, &name, &func_addr, &func_end); -// OBSOLETE -// OBSOLETE /* Do nothing if we couldn't find the start of this function or if we're -// OBSOLETE stopped at the first instruction in the prologue. */ -// OBSOLETE if (status == 0) -// OBSOLETE return pc; -// OBSOLETE -// OBSOLETE /* If we're in start, then give up. */ -// OBSOLETE if (strcmp (name, "start") == 0) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE fi->status = NO_MORE_FRAMES; -// OBSOLETE return pc; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* At the start of a function our frame is in the stack pointer. */ -// OBSOLETE if (fi) -// OBSOLETE fi->status = MY_FRAME_IN_SP; -// OBSOLETE -// OBSOLETE /* If we're physically on an RTS instruction, then our frame has already -// OBSOLETE been deallocated. -// OBSOLETE -// OBSOLETE fi->frame is bogus, we need to fix it. */ -// OBSOLETE if (fi && get_frame_pc (fi) + 1 == func_end) -// OBSOLETE { -// OBSOLETE status = target_read_memory (get_frame_pc (fi), buf, 1); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return get_frame_pc (fi); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (buf[0] == 0xfe) -// OBSOLETE { -// OBSOLETE if (get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return get_frame_pc (fi); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Similarly if we're stopped on the first insn of a prologue as our -// OBSOLETE frame hasn't been allocated yet. */ -// OBSOLETE if (fi && get_frame_pc (fi) == func_addr) -// OBSOLETE { -// OBSOLETE if (get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return get_frame_pc (fi); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Figure out where to stop scanning. */ -// OBSOLETE stop = fi ? get_frame_pc (fi) : func_end; -// OBSOLETE -// OBSOLETE /* Don't walk off the end of the function. */ -// OBSOLETE stop = stop > func_end ? func_end : stop; -// OBSOLETE -// OBSOLETE /* Start scanning on the first instruction of this function. */ -// OBSOLETE addr = func_addr; -// OBSOLETE -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && fi->status & MY_FRAME_IN_SP) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* First see if this insn sets the stack pointer; if so, it's something -// OBSOLETE we won't understand, so quit now. */ -// OBSOLETE if (buf[0] == 0xdf -// OBSOLETE || (buf[0] == 0xf4 && buf[1] == 0x77)) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE fi->status = NO_MORE_FRAMES; -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Now see if we have a frame pointer. -// OBSOLETE -// OBSOLETE Search for mov a2,a0 (0xf278) -// OBSOLETE then mov a3,a2 (0xf27e). */ -// OBSOLETE -// OBSOLETE if (buf[0] == 0xf2 && buf[1] == 0x78) -// OBSOLETE { -// OBSOLETE /* Our caller's $a2 will be found in $a0 now. Note it for -// OBSOLETE our callers. */ -// OBSOLETE if (fi) -// OBSOLETE fi->status |= CALLER_A2_IN_A0; -// OBSOLETE addr += 2; -// OBSOLETE if (addr >= stop) -// OBSOLETE { -// OBSOLETE /* We still haven't allocated our local stack. Handle this -// OBSOLETE as if we stopped on the first or last insn of a function. */ -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE if (buf[0] == 0xf2 && buf[1] == 0x7e) -// OBSOLETE { -// OBSOLETE addr += 2; -// OBSOLETE -// OBSOLETE /* Our frame pointer is valid now. */ -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE fi->status |= MY_FRAME_IN_FP; -// OBSOLETE fi->status &= ~MY_FRAME_IN_SP; -// OBSOLETE } -// OBSOLETE if (addr >= stop) -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Next we should allocate the local frame. -// OBSOLETE -// OBSOLETE Search for add imm8,a3 (0xd3XX) -// OBSOLETE or add imm16,a3 (0xf70bXXXX) -// OBSOLETE or add imm24,a3 (0xf467XXXXXX). -// OBSOLETE -// OBSOLETE If none of the above was found, then this prologue has -// OBSOLETE no stack, and therefore can't have any register saves, -// OBSOLETE so quit now. */ -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE if (buf[0] == 0xd3) -// OBSOLETE { -// OBSOLETE stack_size = extract_signed_integer (&buf[1], 1); -// OBSOLETE if (fi) -// OBSOLETE fi->stack_size = stack_size; -// OBSOLETE addr += 2; -// OBSOLETE if (addr >= stop) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - stack_size); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else if (buf[0] == 0xf7 && buf[1] == 0x0b) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 2, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE stack_size = extract_signed_integer (buf, 2); -// OBSOLETE if (fi) -// OBSOLETE fi->stack_size = stack_size; -// OBSOLETE addr += 4; -// OBSOLETE if (addr >= stop) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - stack_size); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else if (buf[0] == 0xf4 && buf[1] == 0x67) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 2, buf, 3); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE stack_size = extract_signed_integer (buf, 3); -// OBSOLETE if (fi) -// OBSOLETE fi->stack_size = stack_size; -// OBSOLETE addr += 5; -// OBSOLETE if (addr >= stop) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - stack_size); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Now see if we have a call to __prologue for an out of line -// OBSOLETE prologue. */ -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE -// OBSOLETE /* First check for 16bit pc-relative call to __prologue. */ -// OBSOLETE if (buf[0] == 0xfd) -// OBSOLETE { -// OBSOLETE CORE_ADDR temp; -// OBSOLETE status = target_read_memory (addr + 1, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Get the PC this instruction will branch to. */ -// OBSOLETE temp = (extract_signed_integer (buf, 2) + addr + 3) & 0xffffff; -// OBSOLETE -// OBSOLETE /* Get the name of the function at the target address. */ -// OBSOLETE status = find_pc_partial_function (temp, &name, NULL, NULL); -// OBSOLETE if (status == 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Note if it is an out of line prologue. */ -// OBSOLETE out_of_line_prologue = (strcmp (name, "__prologue") == 0); -// OBSOLETE -// OBSOLETE /* This sucks up 3 bytes of instruction space. */ -// OBSOLETE if (out_of_line_prologue) -// OBSOLETE addr += 3; -// OBSOLETE -// OBSOLETE if (addr >= stop) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE { -// OBSOLETE fi->stack_size -= 16; -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size); -// OBSOLETE } -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE /* Now check for the 24bit pc-relative call to __prologue. */ -// OBSOLETE else if (buf[0] == 0xf4 && buf[1] == 0xe1) -// OBSOLETE { -// OBSOLETE CORE_ADDR temp; -// OBSOLETE status = target_read_memory (addr + 2, buf, 3); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Get the PC this instruction will branch to. */ -// OBSOLETE temp = (extract_signed_integer (buf, 3) + addr + 5) & 0xffffff; -// OBSOLETE -// OBSOLETE /* Get the name of the function at the target address. */ -// OBSOLETE status = find_pc_partial_function (temp, &name, NULL, NULL); -// OBSOLETE if (status == 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Note if it is an out of line prologue. */ -// OBSOLETE out_of_line_prologue = (strcmp (name, "__prologue") == 0); -// OBSOLETE -// OBSOLETE /* This sucks up 5 bytes of instruction space. */ -// OBSOLETE if (out_of_line_prologue) -// OBSOLETE addr += 5; -// OBSOLETE -// OBSOLETE if (addr >= stop) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE { -// OBSOLETE fi->stack_size -= 16; -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size); -// OBSOLETE } -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Now actually handle the out of line prologue. */ -// OBSOLETE if (out_of_line_prologue) -// OBSOLETE { -// OBSOLETE int outgoing_args_size = 0; -// OBSOLETE -// OBSOLETE /* First adjust the stack size for this function. The out of -// OBSOLETE line prologue saves 4 registers (16bytes of data). */ -// OBSOLETE if (fi) -// OBSOLETE fi->stack_size -= 16; -// OBSOLETE -// OBSOLETE /* Update fi->frame if necessary. */ -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size); -// OBSOLETE -// OBSOLETE /* After the out of line prologue, there may be another -// OBSOLETE stack adjustment for the outgoing arguments. -// OBSOLETE -// OBSOLETE Search for add imm8,a3 (0xd3XX) -// OBSOLETE or add imm16,a3 (0xf70bXXXX) -// OBSOLETE or add imm24,a3 (0xf467XXXXXX). */ -// OBSOLETE -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4; -// OBSOLETE fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8; -// OBSOLETE fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12; -// OBSOLETE fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16; -// OBSOLETE } -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (buf[0] == 0xd3) -// OBSOLETE { -// OBSOLETE outgoing_args_size = extract_signed_integer (&buf[1], 1); -// OBSOLETE addr += 2; -// OBSOLETE } -// OBSOLETE else if (buf[0] == 0xf7 && buf[1] == 0x0b) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 2, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4; -// OBSOLETE fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8; -// OBSOLETE fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12; -// OBSOLETE fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16; -// OBSOLETE } -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE outgoing_args_size = extract_signed_integer (buf, 2); -// OBSOLETE addr += 4; -// OBSOLETE } -// OBSOLETE else if (buf[0] == 0xf4 && buf[1] == 0x67) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 2, buf, 3); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE { -// OBSOLETE fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4; -// OBSOLETE fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8; -// OBSOLETE fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12; -// OBSOLETE fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16; -// OBSOLETE } -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE outgoing_args_size = extract_signed_integer (buf, 3); -// OBSOLETE addr += 5; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE outgoing_args_size = 0; -// OBSOLETE -// OBSOLETE /* Now that we know the size of the outgoing arguments, fix -// OBSOLETE fi->frame again if this is the innermost frame. */ -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, get_frame_base (fi) - outgoing_args_size); -// OBSOLETE -// OBSOLETE /* Note the register save information and update the stack -// OBSOLETE size for this frame too. */ -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4; -// OBSOLETE fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8; -// OBSOLETE fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12; -// OBSOLETE fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16; -// OBSOLETE fi->stack_size += outgoing_args_size; -// OBSOLETE } -// OBSOLETE /* There can be no more prologue insns, so return now. */ -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* At this point fi->frame needs to be correct. -// OBSOLETE -// OBSOLETE If MY_FRAME_IN_SP is set and we're the innermost frame, then we -// OBSOLETE need to fix fi->frame so that backtracing, find_frame_saved_regs, -// OBSOLETE etc work correctly. */ -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP) != 0) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size); -// OBSOLETE -// OBSOLETE /* And last we have the register saves. These are relatively -// OBSOLETE simple because they're physically done off the stack pointer, -// OBSOLETE and thus the number of different instructions we need to -// OBSOLETE check is greatly reduced because we know the displacements -// OBSOLETE will be small. -// OBSOLETE -// OBSOLETE Search for movx d2,(X,a3) (0xf55eXX) -// OBSOLETE then movx d3,(X,a3) (0xf55fXX) -// OBSOLETE then mov a1,(X,a3) (0x5dXX) No frame pointer case -// OBSOLETE then mov a2,(X,a3) (0x5eXX) No frame pointer case -// OBSOLETE or mov a0,(X,a3) (0x5cXX) Frame pointer case. */ -// OBSOLETE -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE if (buf[0] == 0xf5 && buf[1] == 0x5e) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 2, buf, 1); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE fi->fsr.regs[2] = (get_frame_base (fi) + stack_size -// OBSOLETE + extract_signed_integer (buf, 1)); -// OBSOLETE } -// OBSOLETE addr += 3; -// OBSOLETE if (addr >= stop) -// OBSOLETE return addr; -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE if (buf[0] == 0xf5 && buf[1] == 0x5f) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 2, buf, 1); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE fi->fsr.regs[3] = (get_frame_base (fi) + stack_size -// OBSOLETE + extract_signed_integer (buf, 1)); -// OBSOLETE } -// OBSOLETE addr += 3; -// OBSOLETE if (addr >= stop) -// OBSOLETE return addr; -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE if (buf[0] == 0x5d) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 1, buf, 1); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE fi->fsr.regs[5] = (get_frame_base (fi) + stack_size -// OBSOLETE + extract_signed_integer (buf, 1)); -// OBSOLETE } -// OBSOLETE addr += 2; -// OBSOLETE if (addr >= stop) -// OBSOLETE return addr; -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE if (buf[0] == 0x5e || buf[0] == 0x5c) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 1, buf, 1); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE fi->fsr.regs[6] = (get_frame_base (fi) + stack_size -// OBSOLETE + extract_signed_integer (buf, 1)); -// OBSOLETE fi->status &= ~CALLER_A2_IN_A0; -// OBSOLETE } -// OBSOLETE addr += 2; -// OBSOLETE if (addr >= stop) -// OBSOLETE return addr; -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: frame_chain -// OBSOLETE Figure out and return the caller's frame pointer given current -// OBSOLETE frame_info struct. -// OBSOLETE -// OBSOLETE We don't handle dummy frames yet but we would probably just return the -// OBSOLETE stack pointer that was in use at the time the function call was made? */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE mn10200_frame_chain (struct frame_info *fi) -// OBSOLETE { -// OBSOLETE struct frame_info *dummy_frame = deprecated_frame_xmalloc (); -// OBSOLETE struct cleanup *old_chain = make_cleanup (xfree, dummy_frame); -// OBSOLETE CORE_ADDR ret; -// OBSOLETE -// OBSOLETE /* Walk through the prologue to determine the stack size, -// OBSOLETE location of saved registers, end of the prologue, etc. */ -// OBSOLETE if (fi->status == 0) -// OBSOLETE mn10200_analyze_prologue (fi, (CORE_ADDR) 0); -// OBSOLETE -// OBSOLETE /* Quit now if mn10200_analyze_prologue set NO_MORE_FRAMES. */ -// OBSOLETE if (fi->status & NO_MORE_FRAMES) -// OBSOLETE return 0; -// OBSOLETE -// OBSOLETE /* Now that we've analyzed our prologue, determine the frame -// OBSOLETE pointer for our caller. -// OBSOLETE -// OBSOLETE If our caller has a frame pointer, then we need to -// OBSOLETE find the entry value of $a2 to our function. -// OBSOLETE -// OBSOLETE If CALLER_A2_IN_A0, then the chain is in $a0. -// OBSOLETE -// OBSOLETE If fsr.regs[6] is nonzero, then it's at the memory -// OBSOLETE location pointed to by fsr.regs[6]. -// OBSOLETE -// OBSOLETE Else it's still in $a2. -// OBSOLETE -// OBSOLETE If our caller does not have a frame pointer, then his -// OBSOLETE frame base is fi->frame + -caller's stack size + 4. */ -// OBSOLETE -// OBSOLETE /* The easiest way to get that info is to analyze our caller's frame. -// OBSOLETE -// OBSOLETE So we set up a dummy frame and call mn10200_analyze_prologue to -// OBSOLETE find stuff for us. */ -// OBSOLETE deprecated_update_frame_pc_hack (dummy_frame, FRAME_SAVED_PC (fi)); -// OBSOLETE deprecated_update_frame_base_hack (dummy_frame, get_frame_base (fi)); -// OBSOLETE memset (dummy_frame->fsr.regs, '\000', sizeof dummy_frame->fsr.regs); -// OBSOLETE dummy_frame->status = 0; -// OBSOLETE dummy_frame->stack_size = 0; -// OBSOLETE mn10200_analyze_prologue (dummy_frame, 0); -// OBSOLETE -// OBSOLETE if (dummy_frame->status & MY_FRAME_IN_FP) -// OBSOLETE { -// OBSOLETE /* Our caller has a frame pointer. So find the frame in $a2, $a0, -// OBSOLETE or in the stack. */ -// OBSOLETE if (fi->fsr.regs[6]) -// OBSOLETE ret = (read_memory_integer (fi->fsr.regs[FP_REGNUM], REGISTER_SIZE) -// OBSOLETE & 0xffffff); -// OBSOLETE else if (fi->status & CALLER_A2_IN_A0) -// OBSOLETE ret = read_register (4); -// OBSOLETE else -// OBSOLETE ret = read_register (FP_REGNUM); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* Our caller does not have a frame pointer. So his frame starts -// OBSOLETE at the base of our frame (fi->frame) + + 4 (saved pc). */ -// OBSOLETE ret = get_frame_base (fi) + -dummy_frame->stack_size + 4; -// OBSOLETE } -// OBSOLETE do_cleanups (old_chain); -// OBSOLETE return ret; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: skip_prologue -// OBSOLETE Return the address of the first inst past the prologue of the function. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE mn10200_skip_prologue (CORE_ADDR pc) -// OBSOLETE { -// OBSOLETE /* We used to check the debug symbols, but that can lose if -// OBSOLETE we have a null prologue. */ -// OBSOLETE return mn10200_analyze_prologue (NULL, pc); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: pop_frame -// OBSOLETE This routine gets called when either the user uses the `return' -// OBSOLETE command, or the call dummy breakpoint gets hit. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE mn10200_pop_frame (struct frame_info *frame) -// OBSOLETE { -// OBSOLETE int regnum; -// OBSOLETE -// OBSOLETE if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), -// OBSOLETE get_frame_base (frame), -// OBSOLETE get_frame_base (frame))) -// OBSOLETE generic_pop_dummy_frame (); -// OBSOLETE else -// OBSOLETE { -// OBSOLETE write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); -// OBSOLETE -// OBSOLETE /* Restore any saved registers. */ -// OBSOLETE for (regnum = 0; regnum < NUM_REGS; regnum++) -// OBSOLETE if (frame->fsr.regs[regnum] != 0) -// OBSOLETE { -// OBSOLETE ULONGEST value; -// OBSOLETE -// OBSOLETE value = read_memory_unsigned_integer (frame->fsr.regs[regnum], -// OBSOLETE REGISTER_RAW_SIZE (regnum)); -// OBSOLETE write_register (regnum, value); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Actually cut back the stack. */ -// OBSOLETE write_register (SP_REGNUM, get_frame_base (frame)); -// OBSOLETE -// OBSOLETE /* Don't we need to set the PC?!? XXX FIXME. */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Throw away any cached frame information. */ -// OBSOLETE flush_cached_frames (); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: push_arguments -// OBSOLETE Setup arguments for a call to the target. Arguments go in -// OBSOLETE order on the stack. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE mn10200_push_arguments (int nargs, struct value **args, CORE_ADDR sp, -// OBSOLETE unsigned char struct_return, CORE_ADDR struct_addr) -// OBSOLETE { -// OBSOLETE int argnum = 0; -// OBSOLETE int len = 0; -// OBSOLETE int stack_offset = 0; -// OBSOLETE int regsused = struct_return ? 1 : 0; -// OBSOLETE -// OBSOLETE /* This should be a nop, but align the stack just in case something -// OBSOLETE went wrong. Stacks are two byte aligned on the mn10200. */ -// OBSOLETE sp &= ~1; -// OBSOLETE -// OBSOLETE /* Now make space on the stack for the args. -// OBSOLETE -// OBSOLETE XXX This doesn't appear to handle pass-by-invisible reference -// OBSOLETE arguments. */ -// OBSOLETE for (argnum = 0; argnum < nargs; argnum++) -// OBSOLETE { -// OBSOLETE int arg_length = (TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 1) & ~1; -// OBSOLETE -// OBSOLETE /* If we've used all argument registers, then this argument is -// OBSOLETE pushed. */ -// OBSOLETE if (regsused >= 2 || arg_length > 4) -// OBSOLETE { -// OBSOLETE regsused = 2; -// OBSOLETE len += arg_length; -// OBSOLETE } -// OBSOLETE /* We know we've got some arg register space left. If this argument -// OBSOLETE will fit entirely in regs, then put it there. */ -// OBSOLETE else if (arg_length <= 2 -// OBSOLETE || TYPE_CODE (VALUE_TYPE (args[argnum])) == TYPE_CODE_PTR) -// OBSOLETE { -// OBSOLETE regsused++; -// OBSOLETE } -// OBSOLETE else if (regsused == 0) -// OBSOLETE { -// OBSOLETE regsused = 2; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE regsused = 2; -// OBSOLETE len += arg_length; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Allocate stack space. */ -// OBSOLETE sp -= len; -// OBSOLETE -// OBSOLETE regsused = struct_return ? 1 : 0; -// OBSOLETE /* Push all arguments onto the stack. */ -// OBSOLETE for (argnum = 0; argnum < nargs; argnum++) -// OBSOLETE { -// OBSOLETE int len; -// OBSOLETE char *val; -// OBSOLETE -// OBSOLETE /* XXX Check this. What about UNIONS? */ -// OBSOLETE if (TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_STRUCT -// OBSOLETE && TYPE_LENGTH (VALUE_TYPE (*args)) > 8) -// OBSOLETE { -// OBSOLETE /* XXX Wrong, we want a pointer to this argument. */ -// OBSOLETE len = TYPE_LENGTH (VALUE_TYPE (*args)); -// OBSOLETE val = (char *) VALUE_CONTENTS (*args); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE len = TYPE_LENGTH (VALUE_TYPE (*args)); -// OBSOLETE val = (char *) VALUE_CONTENTS (*args); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (regsused < 2 -// OBSOLETE && (len <= 2 -// OBSOLETE || TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_PTR)) -// OBSOLETE { -// OBSOLETE write_register (regsused, extract_unsigned_integer (val, 4)); -// OBSOLETE regsused++; -// OBSOLETE } -// OBSOLETE else if (regsused == 0 && len == 4) -// OBSOLETE { -// OBSOLETE write_register (regsused, extract_unsigned_integer (val, 2)); -// OBSOLETE write_register (regsused + 1, extract_unsigned_integer (val + 2, 2)); -// OBSOLETE regsused = 2; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE regsused = 2; -// OBSOLETE while (len > 0) -// OBSOLETE { -// OBSOLETE write_memory (sp + stack_offset, val, 2); -// OBSOLETE -// OBSOLETE len -= 2; -// OBSOLETE val += 2; -// OBSOLETE stack_offset += 2; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE args++; -// OBSOLETE } -// OBSOLETE -// OBSOLETE return sp; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: push_return_address (pc) -// OBSOLETE Set up the return address for the inferior function call. -// OBSOLETE Needed for targets where we don't actually execute a JSR/BSR instruction */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE mn10200_push_return_address (CORE_ADDR pc, CORE_ADDR sp) -// OBSOLETE { -// OBSOLETE unsigned char buf[4]; -// OBSOLETE -// OBSOLETE store_unsigned_integer (buf, 4, CALL_DUMMY_ADDRESS ()); -// OBSOLETE write_memory (sp - 4, buf, 4); -// OBSOLETE return sp - 4; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: store_struct_return (addr,sp) -// OBSOLETE Store the structure value return address for an inferior function -// OBSOLETE call. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE mn10200_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) -// OBSOLETE { -// OBSOLETE /* The structure return address is passed as the first argument. */ -// OBSOLETE write_register (0, addr); -// OBSOLETE return sp; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: frame_saved_pc -// OBSOLETE Find the caller of this frame. We do this by seeing if RP_REGNUM -// OBSOLETE is saved in the stack anywhere, otherwise we get it from the -// OBSOLETE registers. If the inner frame is a dummy frame, return its PC -// OBSOLETE instead of RP, because that's where "caller" of the dummy-frame -// OBSOLETE will be found. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE mn10200_frame_saved_pc (struct frame_info *fi) -// OBSOLETE { -// OBSOLETE /* The saved PC will always be at the base of the current frame. */ -// OBSOLETE return (read_memory_integer (get_frame_base (fi), REGISTER_SIZE) & 0xffffff); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: init_extra_frame_info -// OBSOLETE Setup the frame's frame pointer, pc, and frame addresses for saved -// OBSOLETE registers. Most of the work is done in mn10200_analyze_prologue(). -// OBSOLETE -// OBSOLETE Note that when we are called for the last frame (currently active frame), -// OBSOLETE that get_frame_pc (fi) and fi->frame will already be setup. However, fi->frame will -// OBSOLETE be valid only if this routine uses FP. For previous frames, fi-frame will -// OBSOLETE always be correct. mn10200_analyze_prologue will fix fi->frame if -// OBSOLETE it's not valid. -// OBSOLETE -// OBSOLETE We can be called with the PC in the call dummy under two circumstances. -// OBSOLETE First, during normal backtracing, second, while figuring out the frame -// OBSOLETE pointer just prior to calling the target function (see run_stack_dummy). */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE mn10200_init_extra_frame_info (struct frame_info *fi) -// OBSOLETE { -// OBSOLETE if (get_next_frame (fi)) -// OBSOLETE deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); -// OBSOLETE -// OBSOLETE memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs); -// OBSOLETE fi->status = 0; -// OBSOLETE fi->stack_size = 0; -// OBSOLETE -// OBSOLETE mn10200_analyze_prologue (fi, 0); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE _initialize_mn10200_tdep (void) -// OBSOLETE { -// OBSOLETE tm_print_insn = print_insn_mn10200; -// OBSOLETE } diff --git a/gdb/sparcl-stub.c b/gdb/sparcl-stub.c deleted file mode 100644 index 6ba55a0..0000000 --- a/gdb/sparcl-stub.c +++ /dev/null @@ -1,946 +0,0 @@ -// OBSOLETE /**************************************************************************** -// OBSOLETE -// OBSOLETE THIS SOFTWARE IS NOT COPYRIGHTED -// OBSOLETE -// OBSOLETE HP offers the following for use in the public domain. HP makes no -// OBSOLETE warranty with regard to the software or it's performance and the -// OBSOLETE user accepts the software "AS IS" with all faults. -// OBSOLETE -// OBSOLETE HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD -// OBSOLETE TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OBSOLETE OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// OBSOLETE -// OBSOLETE ****************************************************************************/ -// OBSOLETE -// OBSOLETE /**************************************************************************** -// OBSOLETE * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ -// OBSOLETE * -// OBSOLETE * Module name: remcom.c $ -// OBSOLETE * Revision: 1.34 $ -// OBSOLETE * Date: 91/03/09 12:29:49 $ -// OBSOLETE * Contributor: Lake Stevens Instrument Division$ -// OBSOLETE * -// OBSOLETE * Description: low level support for gdb debugger. $ -// OBSOLETE * -// OBSOLETE * Considerations: only works on target hardware $ -// OBSOLETE * -// OBSOLETE * Written by: Glenn Engel $ -// OBSOLETE * ModuleState: Experimental $ -// OBSOLETE * -// OBSOLETE * NOTES: See Below $ -// OBSOLETE * -// OBSOLETE * Modified for SPARC by Stu Grossman, Cygnus Support. -// OBSOLETE * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware -// OBSOLETE * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support. -// OBSOLETE * -// OBSOLETE * This code has been extensively tested on the Fujitsu SPARClite demo board. -// OBSOLETE * -// OBSOLETE * To enable debugger support, two things need to happen. One, a -// OBSOLETE * call to set_debug_traps() is necessary in order to allow any breakpoints -// OBSOLETE * or error conditions to be properly intercepted and reported to gdb. -// OBSOLETE * Two, a breakpoint needs to be generated to begin communication. This -// OBSOLETE * is most easily accomplished by a call to breakpoint(). Breakpoint() -// OBSOLETE * simulates a breakpoint by executing a trap #1. -// OBSOLETE * -// OBSOLETE ************* -// OBSOLETE * -// OBSOLETE * The following gdb commands are supported: -// OBSOLETE * -// OBSOLETE * command function Return value -// OBSOLETE * -// OBSOLETE * g return the value of the CPU registers hex data or ENN -// OBSOLETE * G set the value of the CPU registers OK or ENN -// OBSOLETE * P set the value of a single CPU register OK or ENN -// OBSOLETE * -// OBSOLETE * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN -// OBSOLETE * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN -// OBSOLETE * -// OBSOLETE * c Resume at current address SNN ( signal NN) -// OBSOLETE * cAA..AA Continue at address AA..AA SNN -// OBSOLETE * -// OBSOLETE * s Step one instruction SNN -// OBSOLETE * sAA..AA Step one instruction from AA..AA SNN -// OBSOLETE * -// OBSOLETE * k kill -// OBSOLETE * -// OBSOLETE * ? What was the last sigval ? SNN (signal NN) -// OBSOLETE * -// OBSOLETE * All commands and responses are sent with a packet which includes a -// OBSOLETE * checksum. A packet consists of -// OBSOLETE * -// OBSOLETE * $#. -// OBSOLETE * -// OBSOLETE * where -// OBSOLETE * :: -// OBSOLETE * :: < two hex digits computed as modulo 256 sum of > -// OBSOLETE * -// OBSOLETE * When a packet is received, it is first acknowledged with either '+' or '-'. -// OBSOLETE * '+' indicates a successful transfer. '-' indicates a failed transfer. -// OBSOLETE * -// OBSOLETE * Example: -// OBSOLETE * -// OBSOLETE * Host: Reply: -// OBSOLETE * $m0,10#2a +$00010203040506070809101112131415#42 -// OBSOLETE * -// OBSOLETE ****************************************************************************/ -// OBSOLETE -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE -// OBSOLETE /************************************************************************ -// OBSOLETE * -// OBSOLETE * external low-level support routines -// OBSOLETE */ -// OBSOLETE -// OBSOLETE extern void putDebugChar (int c); /* write a single character */ -// OBSOLETE extern int getDebugChar (void); /* read and return a single char */ -// OBSOLETE -// OBSOLETE /************************************************************************/ -// OBSOLETE /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ -// OBSOLETE /* at least NUMREGBYTES*2 are needed for register packets */ -// OBSOLETE #define BUFMAX 2048 -// OBSOLETE -// OBSOLETE static int initialized = 0; /* !0 means we've been initialized */ -// OBSOLETE -// OBSOLETE extern void breakinst (); -// OBSOLETE static void set_mem_fault_trap (int enable); -// OBSOLETE static void get_in_break_mode (void); -// OBSOLETE -// OBSOLETE static const char hexchars[]="0123456789abcdef"; -// OBSOLETE -// OBSOLETE #define NUMREGS 80 -// OBSOLETE -// OBSOLETE /* Number of bytes of registers. */ -// OBSOLETE #define NUMREGBYTES (NUMREGS * 4) -// OBSOLETE enum regnames {G0, G1, G2, G3, G4, G5, G6, G7, -// OBSOLETE O0, O1, O2, O3, O4, O5, SP, O7, -// OBSOLETE L0, L1, L2, L3, L4, L5, L6, L7, -// OBSOLETE I0, I1, I2, I3, I4, I5, FP, I7, -// OBSOLETE -// OBSOLETE F0, F1, F2, F3, F4, F5, F6, F7, -// OBSOLETE F8, F9, F10, F11, F12, F13, F14, F15, -// OBSOLETE F16, F17, F18, F19, F20, F21, F22, F23, -// OBSOLETE F24, F25, F26, F27, F28, F29, F30, F31, -// OBSOLETE Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR, -// OBSOLETE DIA1, DIA2, DDA1, DDA2, DDV1, DDV2, DCR, DSR }; -// OBSOLETE -// OBSOLETE /*************************** ASSEMBLY CODE MACROS *************************/ -// OBSOLETE /* */ -// OBSOLETE -// OBSOLETE extern void trap_low(); -// OBSOLETE -// OBSOLETE /* Create private copies of common functions used by the stub. This prevents -// OBSOLETE nasty interactions between app code and the stub (for instance if user steps -// OBSOLETE into strlen, etc..) */ -// OBSOLETE -// OBSOLETE static char * -// OBSOLETE strcpy (char *dst, const char *src) -// OBSOLETE { -// OBSOLETE char *retval = dst; -// OBSOLETE -// OBSOLETE while ((*dst++ = *src++) != '\000'); -// OBSOLETE -// OBSOLETE return retval; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void * -// OBSOLETE memcpy (void *vdst, const void *vsrc, int n) -// OBSOLETE { -// OBSOLETE char *dst = vdst; -// OBSOLETE const char *src = vsrc; -// OBSOLETE char *retval = dst; -// OBSOLETE -// OBSOLETE while (n-- > 0) -// OBSOLETE *dst++ = *src++; -// OBSOLETE -// OBSOLETE return retval; -// OBSOLETE } -// OBSOLETE -// OBSOLETE asm(" -// OBSOLETE .reserve trapstack, 1000 * 4, \"bss\", 8 -// OBSOLETE -// OBSOLETE .data -// OBSOLETE .align 4 -// OBSOLETE -// OBSOLETE in_trap_handler: -// OBSOLETE .word 0 -// OBSOLETE -// OBSOLETE .text -// OBSOLETE .align 4 -// OBSOLETE -// OBSOLETE ! This function is called when any SPARC trap (except window overflow or -// OBSOLETE ! underflow) occurs. It makes sure that the invalid register window is still -// OBSOLETE ! available before jumping into C code. It will also restore the world if you -// OBSOLETE ! return from handle_exception. -// OBSOLETE ! -// OBSOLETE ! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly. -// OBSOLETE ! Register usage throughout the routine is as follows: -// OBSOLETE ! -// OBSOLETE ! l0 - psr -// OBSOLETE ! l1 - pc -// OBSOLETE ! l2 - npc -// OBSOLETE ! l3 - wim -// OBSOLETE ! l4 - scratch and y reg -// OBSOLETE ! l5 - scratch and tbr -// OBSOLETE ! l6 - unused -// OBSOLETE ! l7 - unused -// OBSOLETE -// OBSOLETE .globl _trap_low -// OBSOLETE _trap_low: -// OBSOLETE mov %psr, %l0 -// OBSOLETE mov %wim, %l3 -// OBSOLETE -// OBSOLETE srl %l3, %l0, %l4 ! wim >> cwp -// OBSOLETE cmp %l4, 1 -// OBSOLETE bne window_fine ! Branch if not in the invalid window -// OBSOLETE nop -// OBSOLETE -// OBSOLETE ! Handle window overflow -// OBSOLETE -// OBSOLETE mov %g1, %l4 ! Save g1, we use it to hold the wim -// OBSOLETE srl %l3, 1, %g1 ! Rotate wim right -// OBSOLETE tst %g1 -// OBSOLETE bg good_wim ! Branch if new wim is non-zero -// OBSOLETE nop -// OBSOLETE -// OBSOLETE ! At this point, we need to bring a 1 into the high order bit of the wim. -// OBSOLETE ! Since we don't want to make any assumptions about the number of register -// OBSOLETE ! windows, we figure it out dynamically so as to setup the wim correctly. -// OBSOLETE -// OBSOLETE not %g1 ! Fill g1 with ones -// OBSOLETE mov %g1, %wim ! Fill the wim with ones -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE mov %wim, %g1 ! Read back the wim -// OBSOLETE inc %g1 ! Now g1 has 1 just to left of wim -// OBSOLETE srl %g1, 1, %g1 ! Now put 1 at top of wim -// OBSOLETE mov %g0, %wim ! Clear wim so that subsequent save -// OBSOLETE nop ! won't trap -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE -// OBSOLETE good_wim: -// OBSOLETE save %g0, %g0, %g0 ! Slip into next window -// OBSOLETE mov %g1, %wim ! Install the new wim -// OBSOLETE -// OBSOLETE std %l0, [%sp + 0 * 4] ! save L & I registers -// OBSOLETE std %l2, [%sp + 2 * 4] -// OBSOLETE std %l4, [%sp + 4 * 4] -// OBSOLETE std %l6, [%sp + 6 * 4] -// OBSOLETE -// OBSOLETE std %i0, [%sp + 8 * 4] -// OBSOLETE std %i2, [%sp + 10 * 4] -// OBSOLETE std %i4, [%sp + 12 * 4] -// OBSOLETE std %i6, [%sp + 14 * 4] -// OBSOLETE -// OBSOLETE restore ! Go back to trap window. -// OBSOLETE mov %l4, %g1 ! Restore %g1 -// OBSOLETE -// OBSOLETE window_fine: -// OBSOLETE sethi %hi(in_trap_handler), %l4 -// OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5 -// OBSOLETE tst %l5 -// OBSOLETE bg recursive_trap -// OBSOLETE inc %l5 -// OBSOLETE -// OBSOLETE set trapstack+1000*4, %sp ! Switch to trap stack -// OBSOLETE -// OBSOLETE recursive_trap: -// OBSOLETE st %l5, [%lo(in_trap_handler) + %l4] -// OBSOLETE sub %sp,(16+1+6+1+80)*4,%sp ! Make room for input & locals -// OBSOLETE ! + hidden arg + arg spill -// OBSOLETE ! + doubleword alignment -// OBSOLETE ! + registers[72] local var -// OBSOLETE -// OBSOLETE std %g0, [%sp + (24 + 0) * 4] ! registers[Gx] -// OBSOLETE std %g2, [%sp + (24 + 2) * 4] -// OBSOLETE std %g4, [%sp + (24 + 4) * 4] -// OBSOLETE std %g6, [%sp + (24 + 6) * 4] -// OBSOLETE -// OBSOLETE std %i0, [%sp + (24 + 8) * 4] ! registers[Ox] -// OBSOLETE std %i2, [%sp + (24 + 10) * 4] -// OBSOLETE std %i4, [%sp + (24 + 12) * 4] -// OBSOLETE std %i6, [%sp + (24 + 14) * 4] -// OBSOLETE -// OBSOLETE mov %y, %l4 -// OBSOLETE mov %tbr, %l5 -// OBSOLETE st %l4, [%sp + (24 + 64) * 4] ! Y -// OBSOLETE st %l0, [%sp + (24 + 65) * 4] ! PSR -// OBSOLETE st %l3, [%sp + (24 + 66) * 4] ! WIM -// OBSOLETE st %l5, [%sp + (24 + 67) * 4] ! TBR -// OBSOLETE st %l1, [%sp + (24 + 68) * 4] ! PC -// OBSOLETE st %l2, [%sp + (24 + 69) * 4] ! NPC -// OBSOLETE -// OBSOLETE or %l0, 0xf20, %l4 -// OBSOLETE mov %l4, %psr ! Turn on traps, disable interrupts -// OBSOLETE -// OBSOLETE set 0x1000, %l1 -// OBSOLETE btst %l1, %l0 ! FP enabled? -// OBSOLETE be no_fpstore -// OBSOLETE nop -// OBSOLETE -// OBSOLETE ! Must save fsr first, to flush the FQ. This may cause a deferred fp trap, so -// OBSOLETE ! traps must be enabled to allow the trap handler to clean things up. -// OBSOLETE -// OBSOLETE st %fsr, [%sp + (24 + 70) * 4] -// OBSOLETE -// OBSOLETE std %f0, [%sp + (24 + 32) * 4] -// OBSOLETE std %f2, [%sp + (24 + 34) * 4] -// OBSOLETE std %f4, [%sp + (24 + 36) * 4] -// OBSOLETE std %f6, [%sp + (24 + 38) * 4] -// OBSOLETE std %f8, [%sp + (24 + 40) * 4] -// OBSOLETE std %f10, [%sp + (24 + 42) * 4] -// OBSOLETE std %f12, [%sp + (24 + 44) * 4] -// OBSOLETE std %f14, [%sp + (24 + 46) * 4] -// OBSOLETE std %f16, [%sp + (24 + 48) * 4] -// OBSOLETE std %f18, [%sp + (24 + 50) * 4] -// OBSOLETE std %f20, [%sp + (24 + 52) * 4] -// OBSOLETE std %f22, [%sp + (24 + 54) * 4] -// OBSOLETE std %f24, [%sp + (24 + 56) * 4] -// OBSOLETE std %f26, [%sp + (24 + 58) * 4] -// OBSOLETE std %f28, [%sp + (24 + 60) * 4] -// OBSOLETE std %f30, [%sp + (24 + 62) * 4] -// OBSOLETE no_fpstore: -// OBSOLETE -// OBSOLETE call _handle_exception -// OBSOLETE add %sp, 24 * 4, %o0 ! Pass address of registers -// OBSOLETE -// OBSOLETE ! Reload all of the registers that aren't on the stack -// OBSOLETE -// OBSOLETE ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx] -// OBSOLETE ldd [%sp + (24 + 2) * 4], %g2 -// OBSOLETE ldd [%sp + (24 + 4) * 4], %g4 -// OBSOLETE ldd [%sp + (24 + 6) * 4], %g6 -// OBSOLETE -// OBSOLETE ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox] -// OBSOLETE ldd [%sp + (24 + 10) * 4], %i2 -// OBSOLETE ldd [%sp + (24 + 12) * 4], %i4 -// OBSOLETE ldd [%sp + (24 + 14) * 4], %i6 -// OBSOLETE -// OBSOLETE -// OBSOLETE ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR -// OBSOLETE ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC -// OBSOLETE -// OBSOLETE set 0x1000, %l5 -// OBSOLETE btst %l5, %l1 ! FP enabled? -// OBSOLETE be no_fpreload -// OBSOLETE nop -// OBSOLETE -// OBSOLETE ldd [%sp + (24 + 32) * 4], %f0 -// OBSOLETE ldd [%sp + (24 + 34) * 4], %f2 -// OBSOLETE ldd [%sp + (24 + 36) * 4], %f4 -// OBSOLETE ldd [%sp + (24 + 38) * 4], %f6 -// OBSOLETE ldd [%sp + (24 + 40) * 4], %f8 -// OBSOLETE ldd [%sp + (24 + 42) * 4], %f10 -// OBSOLETE ldd [%sp + (24 + 44) * 4], %f12 -// OBSOLETE ldd [%sp + (24 + 46) * 4], %f14 -// OBSOLETE ldd [%sp + (24 + 48) * 4], %f16 -// OBSOLETE ldd [%sp + (24 + 50) * 4], %f18 -// OBSOLETE ldd [%sp + (24 + 52) * 4], %f20 -// OBSOLETE ldd [%sp + (24 + 54) * 4], %f22 -// OBSOLETE ldd [%sp + (24 + 56) * 4], %f24 -// OBSOLETE ldd [%sp + (24 + 58) * 4], %f26 -// OBSOLETE ldd [%sp + (24 + 60) * 4], %f28 -// OBSOLETE ldd [%sp + (24 + 62) * 4], %f30 -// OBSOLETE -// OBSOLETE ld [%sp + (24 + 70) * 4], %fsr -// OBSOLETE no_fpreload: -// OBSOLETE -// OBSOLETE restore ! Ensure that previous window is valid -// OBSOLETE save %g0, %g0, %g0 ! by causing a window_underflow trap -// OBSOLETE -// OBSOLETE mov %l0, %y -// OBSOLETE mov %l1, %psr ! Make sure that traps are disabled -// OBSOLETE ! for rett -// OBSOLETE sethi %hi(in_trap_handler), %l4 -// OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5 -// OBSOLETE dec %l5 -// OBSOLETE st %l5, [%lo(in_trap_handler) + %l4] -// OBSOLETE -// OBSOLETE jmpl %l2, %g0 ! Restore old PC -// OBSOLETE rett %l3 ! Restore old nPC -// OBSOLETE "); -// OBSOLETE -// OBSOLETE /* Convert ch from a hex digit to an int */ -// OBSOLETE -// OBSOLETE static int -// OBSOLETE hex (unsigned char ch) -// OBSOLETE { -// OBSOLETE if (ch >= 'a' && ch <= 'f') -// OBSOLETE return ch-'a'+10; -// OBSOLETE if (ch >= '0' && ch <= '9') -// OBSOLETE return ch-'0'; -// OBSOLETE if (ch >= 'A' && ch <= 'F') -// OBSOLETE return ch-'A'+10; -// OBSOLETE return -1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static char remcomInBuffer[BUFMAX]; -// OBSOLETE static char remcomOutBuffer[BUFMAX]; -// OBSOLETE -// OBSOLETE /* scan for the sequence $# */ -// OBSOLETE -// OBSOLETE unsigned char * -// OBSOLETE getpacket (void) -// OBSOLETE { -// OBSOLETE unsigned char *buffer = &remcomInBuffer[0]; -// OBSOLETE unsigned char checksum; -// OBSOLETE unsigned char xmitcsum; -// OBSOLETE int count; -// OBSOLETE char ch; -// OBSOLETE -// OBSOLETE while (1) -// OBSOLETE { -// OBSOLETE /* wait around for the start character, ignore all other characters */ -// OBSOLETE while ((ch = getDebugChar ()) != '$') -// OBSOLETE ; -// OBSOLETE -// OBSOLETE retry: -// OBSOLETE checksum = 0; -// OBSOLETE xmitcsum = -1; -// OBSOLETE count = 0; -// OBSOLETE -// OBSOLETE /* now, read until a # or end of buffer is found */ -// OBSOLETE while (count < BUFMAX) -// OBSOLETE { -// OBSOLETE ch = getDebugChar (); -// OBSOLETE if (ch == '$') -// OBSOLETE goto retry; -// OBSOLETE if (ch == '#') -// OBSOLETE break; -// OBSOLETE checksum = checksum + ch; -// OBSOLETE buffer[count] = ch; -// OBSOLETE count = count + 1; -// OBSOLETE } -// OBSOLETE buffer[count] = 0; -// OBSOLETE -// OBSOLETE if (ch == '#') -// OBSOLETE { -// OBSOLETE ch = getDebugChar (); -// OBSOLETE xmitcsum = hex (ch) << 4; -// OBSOLETE ch = getDebugChar (); -// OBSOLETE xmitcsum += hex (ch); -// OBSOLETE -// OBSOLETE if (checksum != xmitcsum) -// OBSOLETE { -// OBSOLETE putDebugChar ('-'); /* failed checksum */ -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE putDebugChar ('+'); /* successful transfer */ -// OBSOLETE -// OBSOLETE /* if a sequence char is present, reply the sequence ID */ -// OBSOLETE if (buffer[2] == ':') -// OBSOLETE { -// OBSOLETE putDebugChar (buffer[0]); -// OBSOLETE putDebugChar (buffer[1]); -// OBSOLETE -// OBSOLETE return &buffer[3]; -// OBSOLETE } -// OBSOLETE -// OBSOLETE return &buffer[0]; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* send the packet in buffer. */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE putpacket (unsigned char *buffer) -// OBSOLETE { -// OBSOLETE unsigned char checksum; -// OBSOLETE int count; -// OBSOLETE unsigned char ch; -// OBSOLETE -// OBSOLETE /* $#. */ -// OBSOLETE do -// OBSOLETE { -// OBSOLETE putDebugChar('$'); -// OBSOLETE checksum = 0; -// OBSOLETE count = 0; -// OBSOLETE -// OBSOLETE while (ch = buffer[count]) -// OBSOLETE { -// OBSOLETE putDebugChar (ch); -// OBSOLETE checksum += ch; -// OBSOLETE count += 1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE putDebugChar('#'); -// OBSOLETE putDebugChar(hexchars[checksum >> 4]); -// OBSOLETE putDebugChar(hexchars[checksum & 0xf]); -// OBSOLETE -// OBSOLETE } -// OBSOLETE while (getDebugChar() != '+'); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Indicate to caller of mem2hex or hex2mem that there has been an -// OBSOLETE error. */ -// OBSOLETE static volatile int mem_err = 0; -// OBSOLETE -// OBSOLETE /* Convert the memory pointed to by mem into hex, placing result in buf. -// OBSOLETE * Return a pointer to the last char put in buf (null), in case of mem fault, -// OBSOLETE * return 0. -// OBSOLETE * If MAY_FAULT is non-zero, then we will handle memory faults by returning -// OBSOLETE * a 0, else treat a fault like any other fault in the stub. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE static unsigned char * -// OBSOLETE mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault) -// OBSOLETE { -// OBSOLETE unsigned char ch; -// OBSOLETE -// OBSOLETE set_mem_fault_trap(may_fault); -// OBSOLETE -// OBSOLETE while (count-- > 0) -// OBSOLETE { -// OBSOLETE ch = *mem++; -// OBSOLETE if (mem_err) -// OBSOLETE return 0; -// OBSOLETE *buf++ = hexchars[ch >> 4]; -// OBSOLETE *buf++ = hexchars[ch & 0xf]; -// OBSOLETE } -// OBSOLETE -// OBSOLETE *buf = 0; -// OBSOLETE -// OBSOLETE set_mem_fault_trap(0); -// OBSOLETE -// OBSOLETE return buf; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* convert the hex array pointed to by buf into binary to be placed in mem -// OBSOLETE * return a pointer to the character AFTER the last byte written */ -// OBSOLETE -// OBSOLETE static char * -// OBSOLETE hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault) -// OBSOLETE { -// OBSOLETE int i; -// OBSOLETE unsigned char ch; -// OBSOLETE -// OBSOLETE set_mem_fault_trap(may_fault); -// OBSOLETE -// OBSOLETE for (i=0; itt != 0 && ht->signo != 0; -// OBSOLETE ht++) -// OBSOLETE if (ht->tt != 4 || ! (read_psr () & 0x1000)) -// OBSOLETE exceptionHandler(ht->tt, trap_low); -// OBSOLETE -// OBSOLETE initialized = 1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE asm (" -// OBSOLETE ! Trap handler for memory errors. This just sets mem_err to be non-zero. It -// OBSOLETE ! assumes that %l1 is non-zero. This should be safe, as it is doubtful that -// OBSOLETE ! 0 would ever contain code that could mem fault. This routine will skip -// OBSOLETE ! past the faulting instruction after setting mem_err. -// OBSOLETE -// OBSOLETE .text -// OBSOLETE .align 4 -// OBSOLETE -// OBSOLETE _fltr_set_mem_err: -// OBSOLETE sethi %hi(_mem_err), %l0 -// OBSOLETE st %l1, [%l0 + %lo(_mem_err)] -// OBSOLETE jmpl %l2, %g0 -// OBSOLETE rett %l2+4 -// OBSOLETE "); -// OBSOLETE -// OBSOLETE static void -// OBSOLETE set_mem_fault_trap (int enable) -// OBSOLETE { -// OBSOLETE extern void fltr_set_mem_err(); -// OBSOLETE mem_err = 0; -// OBSOLETE -// OBSOLETE if (enable) -// OBSOLETE exceptionHandler(9, fltr_set_mem_err); -// OBSOLETE else -// OBSOLETE exceptionHandler(9, trap_low); -// OBSOLETE } -// OBSOLETE -// OBSOLETE asm (" -// OBSOLETE .text -// OBSOLETE .align 4 -// OBSOLETE -// OBSOLETE _dummy_hw_breakpoint: -// OBSOLETE jmpl %l2, %g0 -// OBSOLETE rett %l2+4 -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE "); -// OBSOLETE -// OBSOLETE static void -// OBSOLETE get_in_break_mode (void) -// OBSOLETE { -// OBSOLETE extern void dummy_hw_breakpoint(); -// OBSOLETE -// OBSOLETE exceptionHandler (255, dummy_hw_breakpoint); -// OBSOLETE -// OBSOLETE asm ("ta 255"); -// OBSOLETE -// OBSOLETE exceptionHandler (255, trap_low); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Convert the SPARC hardware trap type code to a unix signal number. */ -// OBSOLETE -// OBSOLETE static int -// OBSOLETE computeSignal (int tt) -// OBSOLETE { -// OBSOLETE struct hard_trap_info *ht; -// OBSOLETE -// OBSOLETE for (ht = hard_trap_info; ht->tt && ht->signo; ht++) -// OBSOLETE if (ht->tt == tt) -// OBSOLETE return ht->signo; -// OBSOLETE -// OBSOLETE return SIGHUP; /* default for things we don't know about */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * While we find nice hex chars, build an int. -// OBSOLETE * Return number of chars processed. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE static int -// OBSOLETE hexToInt(char **ptr, int *intValue) -// OBSOLETE { -// OBSOLETE int numChars = 0; -// OBSOLETE int hexValue; -// OBSOLETE -// OBSOLETE *intValue = 0; -// OBSOLETE -// OBSOLETE while (**ptr) -// OBSOLETE { -// OBSOLETE hexValue = hex(**ptr); -// OBSOLETE if (hexValue < 0) -// OBSOLETE break; -// OBSOLETE -// OBSOLETE *intValue = (*intValue << 4) | hexValue; -// OBSOLETE numChars ++; -// OBSOLETE -// OBSOLETE (*ptr)++; -// OBSOLETE } -// OBSOLETE -// OBSOLETE return (numChars); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * This function does all command procesing for interfacing to gdb. It -// OBSOLETE * returns 1 if you should skip the instruction at the trap address, 0 -// OBSOLETE * otherwise. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE handle_exception (unsigned long *registers) -// OBSOLETE { -// OBSOLETE int tt; /* Trap type */ -// OBSOLETE int sigval; -// OBSOLETE int addr; -// OBSOLETE int length; -// OBSOLETE char *ptr; -// OBSOLETE unsigned long *sp; -// OBSOLETE unsigned long dsr; -// OBSOLETE -// OBSOLETE /* First, we must force all of the windows to be spilled out */ -// OBSOLETE -// OBSOLETE asm(" save %sp, -64, %sp -// OBSOLETE save %sp, -64, %sp -// OBSOLETE save %sp, -64, %sp -// OBSOLETE save %sp, -64, %sp -// OBSOLETE save %sp, -64, %sp -// OBSOLETE save %sp, -64, %sp -// OBSOLETE save %sp, -64, %sp -// OBSOLETE save %sp, -64, %sp -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE "); -// OBSOLETE -// OBSOLETE get_in_break_mode (); /* Enable DSU register writes */ -// OBSOLETE -// OBSOLETE registers[DIA1] = read_asi (1, 0xff00); -// OBSOLETE registers[DIA2] = read_asi (1, 0xff04); -// OBSOLETE registers[DDA1] = read_asi (1, 0xff08); -// OBSOLETE registers[DDA2] = read_asi (1, 0xff0c); -// OBSOLETE registers[DDV1] = read_asi (1, 0xff10); -// OBSOLETE registers[DDV2] = read_asi (1, 0xff14); -// OBSOLETE registers[DCR] = read_asi (1, 0xff18); -// OBSOLETE registers[DSR] = read_asi (1, 0xff1c); -// OBSOLETE -// OBSOLETE if (registers[PC] == (unsigned long)breakinst) -// OBSOLETE { -// OBSOLETE registers[PC] = registers[NPC]; -// OBSOLETE registers[NPC] += 4; -// OBSOLETE } -// OBSOLETE sp = (unsigned long *)registers[SP]; -// OBSOLETE -// OBSOLETE dsr = (unsigned long)registers[DSR]; -// OBSOLETE if (dsr & 0x3c) -// OBSOLETE tt = 255; -// OBSOLETE else -// OBSOLETE tt = (registers[TBR] >> 4) & 0xff; -// OBSOLETE -// OBSOLETE /* reply to host that an exception has occurred */ -// OBSOLETE sigval = computeSignal(tt); -// OBSOLETE ptr = remcomOutBuffer; -// OBSOLETE -// OBSOLETE *ptr++ = 'T'; -// OBSOLETE *ptr++ = hexchars[sigval >> 4]; -// OBSOLETE *ptr++ = hexchars[sigval & 0xf]; -// OBSOLETE -// OBSOLETE *ptr++ = hexchars[PC >> 4]; -// OBSOLETE *ptr++ = hexchars[PC & 0xf]; -// OBSOLETE *ptr++ = ':'; -// OBSOLETE ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); -// OBSOLETE *ptr++ = ';'; -// OBSOLETE -// OBSOLETE *ptr++ = hexchars[FP >> 4]; -// OBSOLETE *ptr++ = hexchars[FP & 0xf]; -// OBSOLETE *ptr++ = ':'; -// OBSOLETE ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */ -// OBSOLETE *ptr++ = ';'; -// OBSOLETE -// OBSOLETE *ptr++ = hexchars[SP >> 4]; -// OBSOLETE *ptr++ = hexchars[SP & 0xf]; -// OBSOLETE *ptr++ = ':'; -// OBSOLETE ptr = mem2hex((char *)&sp, ptr, 4, 0); -// OBSOLETE *ptr++ = ';'; -// OBSOLETE -// OBSOLETE *ptr++ = hexchars[NPC >> 4]; -// OBSOLETE *ptr++ = hexchars[NPC & 0xf]; -// OBSOLETE *ptr++ = ':'; -// OBSOLETE ptr = mem2hex((char *)®isters[NPC], ptr, 4, 0); -// OBSOLETE *ptr++ = ';'; -// OBSOLETE -// OBSOLETE *ptr++ = hexchars[O7 >> 4]; -// OBSOLETE *ptr++ = hexchars[O7 & 0xf]; -// OBSOLETE *ptr++ = ':'; -// OBSOLETE ptr = mem2hex((char *)®isters[O7], ptr, 4, 0); -// OBSOLETE *ptr++ = ';'; -// OBSOLETE -// OBSOLETE *ptr++ = 0; -// OBSOLETE -// OBSOLETE putpacket(remcomOutBuffer); -// OBSOLETE -// OBSOLETE while (1) -// OBSOLETE { -// OBSOLETE remcomOutBuffer[0] = 0; -// OBSOLETE -// OBSOLETE ptr = getpacket(); -// OBSOLETE switch (*ptr++) -// OBSOLETE { -// OBSOLETE case '?': -// OBSOLETE remcomOutBuffer[0] = 'S'; -// OBSOLETE remcomOutBuffer[1] = hexchars[sigval >> 4]; -// OBSOLETE remcomOutBuffer[2] = hexchars[sigval & 0xf]; -// OBSOLETE remcomOutBuffer[3] = 0; -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case 'd': -// OBSOLETE /* toggle debug flag */ -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case 'g': /* return the value of the CPU registers */ -// OBSOLETE memcpy (®isters[L0], sp, 16 * 4); /* Copy L & I regs from stack */ -// OBSOLETE mem2hex ((char *)registers, remcomOutBuffer, NUMREGBYTES, 0); -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case 'G': /* Set the value of all registers */ -// OBSOLETE case 'P': /* Set the value of one register */ -// OBSOLETE { -// OBSOLETE unsigned long *newsp, psr; -// OBSOLETE -// OBSOLETE psr = registers[PSR]; -// OBSOLETE -// OBSOLETE if (ptr[-1] == 'P') -// OBSOLETE { -// OBSOLETE int regno; -// OBSOLETE -// OBSOLETE if (hexToInt (&ptr, ®no) -// OBSOLETE && *ptr++ == '=') -// OBSOLETE if (regno >= L0 && regno <= I7) -// OBSOLETE hex2mem (ptr, sp + regno - L0, 4, 0); -// OBSOLETE else -// OBSOLETE hex2mem (ptr, (char *)®isters[regno], 4, 0); -// OBSOLETE else -// OBSOLETE { -// OBSOLETE strcpy (remcomOutBuffer, "E01"); -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE hex2mem (ptr, (char *)registers, NUMREGBYTES, 0); -// OBSOLETE memcpy (sp, ®isters[L0], 16 * 4); /* Copy L & I regs to stack */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* See if the stack pointer has moved. If so, then copy the saved -// OBSOLETE locals and ins to the new location. This keeps the window -// OBSOLETE overflow and underflow routines happy. */ -// OBSOLETE -// OBSOLETE newsp = (unsigned long *)registers[SP]; -// OBSOLETE if (sp != newsp) -// OBSOLETE sp = memcpy(newsp, sp, 16 * 4); -// OBSOLETE -// OBSOLETE /* Don't allow CWP to be modified. */ -// OBSOLETE -// OBSOLETE if (psr != registers[PSR]) -// OBSOLETE registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); -// OBSOLETE -// OBSOLETE strcpy(remcomOutBuffer,"OK"); -// OBSOLETE } -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ -// OBSOLETE /* Try to read %x,%x. */ -// OBSOLETE -// OBSOLETE if (hexToInt(&ptr, &addr) -// OBSOLETE && *ptr++ == ',' -// OBSOLETE && hexToInt(&ptr, &length)) -// OBSOLETE { -// OBSOLETE if (mem2hex((char *)addr, remcomOutBuffer, length, 1)) -// OBSOLETE break; -// OBSOLETE -// OBSOLETE strcpy (remcomOutBuffer, "E03"); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE strcpy(remcomOutBuffer,"E01"); -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ -// OBSOLETE /* Try to read '%x,%x:'. */ -// OBSOLETE -// OBSOLETE if (hexToInt(&ptr, &addr) -// OBSOLETE && *ptr++ == ',' -// OBSOLETE && hexToInt(&ptr, &length) -// OBSOLETE && *ptr++ == ':') -// OBSOLETE { -// OBSOLETE if (hex2mem(ptr, (char *)addr, length, 1)) -// OBSOLETE strcpy(remcomOutBuffer, "OK"); -// OBSOLETE else -// OBSOLETE strcpy(remcomOutBuffer, "E03"); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE strcpy(remcomOutBuffer, "E02"); -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case 'c': /* cAA..AA Continue at address AA..AA(optional) */ -// OBSOLETE /* try to read optional parameter, pc unchanged if no parm */ -// OBSOLETE if (hexToInt(&ptr, &addr)) -// OBSOLETE { -// OBSOLETE registers[PC] = addr; -// OBSOLETE registers[NPC] = addr + 4; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Need to flush the instruction cache here, as we may have deposited a -// OBSOLETE breakpoint, and the icache probably has no way of knowing that a data ref to -// OBSOLETE some location may have changed something that is in the instruction cache. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE flush_i_cache (); -// OBSOLETE -// OBSOLETE if (!(registers[DSR] & 0x1) /* DSU enabled? */ -// OBSOLETE && !(registers[DCR] & 0x200)) /* Are we in break state? */ -// OBSOLETE { /* Yes, set the DSU regs */ -// OBSOLETE write_asi (1, 0xff00, registers[DIA1]); -// OBSOLETE write_asi (1, 0xff04, registers[DIA2]); -// OBSOLETE write_asi (1, 0xff08, registers[DDA1]); -// OBSOLETE write_asi (1, 0xff0c, registers[DDA2]); -// OBSOLETE write_asi (1, 0xff10, registers[DDV1]); -// OBSOLETE write_asi (1, 0xff14, registers[DDV2]); -// OBSOLETE write_asi (1, 0xff1c, registers[DSR]); -// OBSOLETE write_asi (1, 0xff18, registers[DCR] | 0x200); /* Clear break */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE return; -// OBSOLETE -// OBSOLETE /* kill the program */ -// OBSOLETE case 'k' : /* do nothing */ -// OBSOLETE break; -// OBSOLETE #if 0 -// OBSOLETE case 't': /* Test feature */ -// OBSOLETE asm (" std %f30,[%sp]"); -// OBSOLETE break; -// OBSOLETE #endif -// OBSOLETE case 'r': /* Reset */ -// OBSOLETE asm ("call 0 -// OBSOLETE nop "); -// OBSOLETE break; -// OBSOLETE } /* switch */ -// OBSOLETE -// OBSOLETE /* reply to the request */ -// OBSOLETE putpacket(remcomOutBuffer); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* This function will generate a breakpoint exception. It is used at the -// OBSOLETE beginning of a program to sync up with a debugger and can be used -// OBSOLETE otherwise as a quick means to stop program execution and "break" into -// OBSOLETE the debugger. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE breakpoint (void) -// OBSOLETE { -// OBSOLETE if (!initialized) -// OBSOLETE return; -// OBSOLETE -// OBSOLETE asm(" .globl _breakinst -// OBSOLETE -// OBSOLETE _breakinst: ta 1 -// OBSOLETE "); -// OBSOLETE } diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c deleted file mode 100644 index 8c376c5..0000000 --- a/gdb/sparcl-tdep.c +++ /dev/null @@ -1,869 +0,0 @@ -// OBSOLETE /* Target dependent code for the Fujitsu SPARClite for GDB, the GNU debugger. -// OBSOLETE Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001 -// OBSOLETE Free Software Foundation, Inc. -// OBSOLETE -// OBSOLETE This file is part of GDB. -// OBSOLETE -// OBSOLETE This program is free software; you can redistribute it and/or modify -// OBSOLETE it under the terms of the GNU General Public License as published by -// OBSOLETE the Free Software Foundation; either version 2 of the License, or -// OBSOLETE (at your option) any later version. -// OBSOLETE -// OBSOLETE This program is distributed in the hope that it will be useful, -// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of -// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// OBSOLETE GNU General Public License for more details. -// OBSOLETE -// OBSOLETE You should have received a copy of the GNU General Public License -// OBSOLETE along with this program; if not, write to the Free Software -// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, -// OBSOLETE Boston, MA 02111-1307, USA. */ -// OBSOLETE -// OBSOLETE #include "defs.h" -// OBSOLETE #include "gdbcore.h" -// OBSOLETE #include "breakpoint.h" -// OBSOLETE #include "target.h" -// OBSOLETE #include "serial.h" -// OBSOLETE #include "regcache.h" -// OBSOLETE #include -// OBSOLETE -// OBSOLETE #if (!defined(__GO32__) && !defined(_WIN32)) || defined(__CYGWIN__) -// OBSOLETE #define HAVE_SOCKETS -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE static struct target_ops sparclite_ops; -// OBSOLETE -// OBSOLETE static char *remote_target_name = NULL; -// OBSOLETE static struct serial *remote_desc = NULL; -// OBSOLETE static int serial_flag; -// OBSOLETE #ifdef HAVE_SOCKETS -// OBSOLETE static int udp_fd = -1; -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE static struct serial *open_tty (char *name); -// OBSOLETE static int send_resp (struct serial *desc, char c); -// OBSOLETE static void close_tty (void * ignore); -// OBSOLETE #ifdef HAVE_SOCKETS -// OBSOLETE static int recv_udp_buf (int fd, unsigned char *buf, int len, int timeout); -// OBSOLETE static int send_udp_buf (int fd, unsigned char *buf, int len); -// OBSOLETE #endif -// OBSOLETE static void sparclite_open (char *name, int from_tty); -// OBSOLETE static void sparclite_close (int quitting); -// OBSOLETE static void download (char *target_name, char *args, int from_tty, -// OBSOLETE void (*write_routine) (bfd * from_bfd, -// OBSOLETE asection * from_sec, -// OBSOLETE file_ptr from_addr, -// OBSOLETE bfd_vma to_addr, int len), -// OBSOLETE void (*start_routine) (bfd_vma entry)); -// OBSOLETE static void sparclite_serial_start (bfd_vma entry); -// OBSOLETE static void sparclite_serial_write (bfd * from_bfd, asection * from_sec, -// OBSOLETE file_ptr from_addr, -// OBSOLETE bfd_vma to_addr, int len); -// OBSOLETE #ifdef HAVE_SOCKETS -// OBSOLETE static unsigned short calc_checksum (unsigned char *buffer, int count); -// OBSOLETE static void sparclite_udp_start (bfd_vma entry); -// OBSOLETE static void sparclite_udp_write (bfd * from_bfd, asection * from_sec, -// OBSOLETE file_ptr from_addr, bfd_vma to_addr, -// OBSOLETE int len); -// OBSOLETE #endif -// OBSOLETE static void sparclite_download (char *filename, int from_tty); -// OBSOLETE -// OBSOLETE #define DDA2_SUP_ASI 0xb000000 -// OBSOLETE #define DDA1_SUP_ASI 0xb0000 -// OBSOLETE -// OBSOLETE #define DDA2_ASI_MASK 0xff000000 -// OBSOLETE #define DDA1_ASI_MASK 0xff0000 -// OBSOLETE #define DIA2_SUP_MODE 0x8000 -// OBSOLETE #define DIA1_SUP_MODE 0x4000 -// OBSOLETE #define DDA2_ENABLE 0x100 -// OBSOLETE #define DDA1_ENABLE 0x80 -// OBSOLETE #define DIA2_ENABLE 0x40 -// OBSOLETE #define DIA1_ENABLE 0x20 -// OBSOLETE #define DSINGLE_STEP 0x10 /* not used */ -// OBSOLETE #define DDV_TYPE_MASK 0xc -// OBSOLETE #define DDV_TYPE_LOAD 0x0 -// OBSOLETE #define DDV_TYPE_STORE 0x4 -// OBSOLETE #define DDV_TYPE_ACCESS 0x8 -// OBSOLETE #define DDV_TYPE_ALWAYS 0xc -// OBSOLETE #define DDV_COND 0x2 -// OBSOLETE #define DDV_MASK 0x1 -// OBSOLETE -// OBSOLETE int -// OBSOLETE sparclite_insert_watchpoint (CORE_ADDR addr, int len, int type) -// OBSOLETE { -// OBSOLETE CORE_ADDR dcr; -// OBSOLETE -// OBSOLETE dcr = read_register (DCR_REGNUM); -// OBSOLETE -// OBSOLETE if (!(dcr & DDA1_ENABLE)) -// OBSOLETE { -// OBSOLETE write_register (DDA1_REGNUM, addr); -// OBSOLETE dcr &= ~(DDA1_ASI_MASK | DDV_TYPE_MASK); -// OBSOLETE dcr |= (DDA1_SUP_ASI | DDA1_ENABLE); -// OBSOLETE if (type == 1) -// OBSOLETE { -// OBSOLETE write_register (DDV1_REGNUM, 0); -// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff); -// OBSOLETE dcr |= (DDV_TYPE_LOAD & (~DDV_COND & ~DDV_MASK)); -// OBSOLETE } -// OBSOLETE else if (type == 0) -// OBSOLETE { -// OBSOLETE write_register (DDV1_REGNUM, 0); -// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff); -// OBSOLETE dcr |= (DDV_TYPE_STORE & (~DDV_COND & ~DDV_MASK)); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE write_register (DDV1_REGNUM, 0); -// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff); -// OBSOLETE dcr |= (DDV_TYPE_ACCESS); -// OBSOLETE } -// OBSOLETE write_register (DCR_REGNUM, dcr); -// OBSOLETE } -// OBSOLETE else if (!(dcr & DDA2_ENABLE)) -// OBSOLETE { -// OBSOLETE write_register (DDA2_REGNUM, addr); -// OBSOLETE dcr &= ~(DDA2_ASI_MASK & DDV_TYPE_MASK); -// OBSOLETE dcr |= (DDA2_SUP_ASI | DDA2_ENABLE); -// OBSOLETE if (type == 1) -// OBSOLETE { -// OBSOLETE write_register (DDV1_REGNUM, 0); -// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff); -// OBSOLETE dcr |= (DDV_TYPE_LOAD & ~DDV_COND & ~DDV_MASK); -// OBSOLETE } -// OBSOLETE else if (type == 0) -// OBSOLETE { -// OBSOLETE write_register (DDV1_REGNUM, 0); -// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff); -// OBSOLETE dcr |= (DDV_TYPE_STORE & ~DDV_COND & ~DDV_MASK); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE write_register (DDV1_REGNUM, 0); -// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff); -// OBSOLETE dcr |= (DDV_TYPE_ACCESS); -// OBSOLETE } -// OBSOLETE write_register (DCR_REGNUM, dcr); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE return -1; -// OBSOLETE -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE sparclite_remove_watchpoint (CORE_ADDR addr, int len, int type) -// OBSOLETE { -// OBSOLETE CORE_ADDR dcr, dda1, dda2; -// OBSOLETE -// OBSOLETE dcr = read_register (DCR_REGNUM); -// OBSOLETE dda1 = read_register (DDA1_REGNUM); -// OBSOLETE dda2 = read_register (DDA2_REGNUM); -// OBSOLETE -// OBSOLETE if ((dcr & DDA1_ENABLE) && addr == dda1) -// OBSOLETE write_register (DCR_REGNUM, (dcr & ~DDA1_ENABLE)); -// OBSOLETE else if ((dcr & DDA2_ENABLE) && addr == dda2) -// OBSOLETE write_register (DCR_REGNUM, (dcr & ~DDA2_ENABLE)); -// OBSOLETE else -// OBSOLETE return -1; -// OBSOLETE -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE sparclite_insert_hw_breakpoint (CORE_ADDR addr, int len) -// OBSOLETE { -// OBSOLETE CORE_ADDR dcr; -// OBSOLETE -// OBSOLETE dcr = read_register (DCR_REGNUM); -// OBSOLETE -// OBSOLETE if (!(dcr & DIA1_ENABLE)) -// OBSOLETE { -// OBSOLETE write_register (DIA1_REGNUM, addr); -// OBSOLETE write_register (DCR_REGNUM, (dcr | DIA1_ENABLE | DIA1_SUP_MODE)); -// OBSOLETE } -// OBSOLETE else if (!(dcr & DIA2_ENABLE)) -// OBSOLETE { -// OBSOLETE write_register (DIA2_REGNUM, addr); -// OBSOLETE write_register (DCR_REGNUM, (dcr | DIA2_ENABLE | DIA2_SUP_MODE)); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE return -1; -// OBSOLETE -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE sparclite_remove_hw_breakpoint (CORE_ADDR addr, int shadow) -// OBSOLETE { -// OBSOLETE CORE_ADDR dcr, dia1, dia2; -// OBSOLETE -// OBSOLETE dcr = read_register (DCR_REGNUM); -// OBSOLETE dia1 = read_register (DIA1_REGNUM); -// OBSOLETE dia2 = read_register (DIA2_REGNUM); -// OBSOLETE -// OBSOLETE if ((dcr & DIA1_ENABLE) && addr == dia1) -// OBSOLETE write_register (DCR_REGNUM, (dcr & ~DIA1_ENABLE)); -// OBSOLETE else if ((dcr & DIA2_ENABLE) && addr == dia2) -// OBSOLETE write_register (DCR_REGNUM, (dcr & ~DIA2_ENABLE)); -// OBSOLETE else -// OBSOLETE return -1; -// OBSOLETE -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE sparclite_check_watch_resources (int type, int cnt, int ot) -// OBSOLETE { -// OBSOLETE /* Watchpoints not supported on simulator. */ -// OBSOLETE if (strcmp (target_shortname, "sim") == 0) -// OBSOLETE return 0; -// OBSOLETE -// OBSOLETE if (type == bp_hardware_breakpoint) -// OBSOLETE { -// OBSOLETE if (TARGET_HW_BREAK_LIMIT == 0) -// OBSOLETE return 0; -// OBSOLETE else if (cnt <= TARGET_HW_BREAK_LIMIT) -// OBSOLETE return 1; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE if (TARGET_HW_WATCH_LIMIT == 0) -// OBSOLETE return 0; -// OBSOLETE else if (ot) -// OBSOLETE return -1; -// OBSOLETE else if (cnt <= TARGET_HW_WATCH_LIMIT) -// OBSOLETE return 1; -// OBSOLETE } -// OBSOLETE return -1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE sparclite_stopped_data_address (void) -// OBSOLETE { -// OBSOLETE CORE_ADDR dsr, dda1, dda2; -// OBSOLETE -// OBSOLETE dsr = read_register (DSR_REGNUM); -// OBSOLETE dda1 = read_register (DDA1_REGNUM); -// OBSOLETE dda2 = read_register (DDA2_REGNUM); -// OBSOLETE -// OBSOLETE if (dsr & 0x10) -// OBSOLETE return dda1; -// OBSOLETE else if (dsr & 0x20) -// OBSOLETE return dda2; -// OBSOLETE else -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static struct serial * -// OBSOLETE open_tty (char *name) -// OBSOLETE { -// OBSOLETE struct serial *desc; -// OBSOLETE -// OBSOLETE desc = serial_open (name); -// OBSOLETE if (!desc) -// OBSOLETE perror_with_name (name); -// OBSOLETE -// OBSOLETE if (baud_rate != -1) -// OBSOLETE { -// OBSOLETE if (serial_setbaudrate (desc, baud_rate)) -// OBSOLETE { -// OBSOLETE serial_close (desc); -// OBSOLETE perror_with_name (name); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE serial_raw (desc); -// OBSOLETE -// OBSOLETE serial_flush_input (desc); -// OBSOLETE -// OBSOLETE return desc; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Read a single character from the remote end, masking it down to 7 bits. */ -// OBSOLETE -// OBSOLETE static int -// OBSOLETE readchar (struct serial *desc, int timeout) -// OBSOLETE { -// OBSOLETE int ch; -// OBSOLETE char s[10]; -// OBSOLETE -// OBSOLETE ch = serial_readchar (desc, timeout); -// OBSOLETE -// OBSOLETE switch (ch) -// OBSOLETE { -// OBSOLETE case SERIAL_EOF: -// OBSOLETE error ("SPARClite remote connection closed"); -// OBSOLETE case SERIAL_ERROR: -// OBSOLETE perror_with_name ("SPARClite communication error"); -// OBSOLETE case SERIAL_TIMEOUT: -// OBSOLETE error ("SPARClite remote timeout"); -// OBSOLETE default: -// OBSOLETE if (remote_debug > 0) -// OBSOLETE { -// OBSOLETE sprintf (s, "[%02x]", ch & 0xff); -// OBSOLETE puts_debug ("read -->", s, "<--"); -// OBSOLETE } -// OBSOLETE return ch; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE debug_serial_write (struct serial *desc, char *buf, int len) -// OBSOLETE { -// OBSOLETE char s[10]; -// OBSOLETE -// OBSOLETE serial_write (desc, buf, len); -// OBSOLETE if (remote_debug > 0) -// OBSOLETE { -// OBSOLETE while (len-- > 0) -// OBSOLETE { -// OBSOLETE sprintf (s, "[%02x]", *buf & 0xff); -// OBSOLETE puts_debug ("Sent -->", s, "<--"); -// OBSOLETE buf++; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE static int -// OBSOLETE send_resp (struct serial *desc, char c) -// OBSOLETE { -// OBSOLETE debug_serial_write (desc, &c, 1); -// OBSOLETE return readchar (desc, remote_timeout); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE close_tty (void *ignore) -// OBSOLETE { -// OBSOLETE if (!remote_desc) -// OBSOLETE return; -// OBSOLETE -// OBSOLETE serial_close (remote_desc); -// OBSOLETE -// OBSOLETE remote_desc = NULL; -// OBSOLETE } -// OBSOLETE -// OBSOLETE #ifdef HAVE_SOCKETS -// OBSOLETE static int -// OBSOLETE recv_udp_buf (int fd, unsigned char *buf, int len, int timeout) -// OBSOLETE { -// OBSOLETE int cc; -// OBSOLETE fd_set readfds; -// OBSOLETE -// OBSOLETE FD_ZERO (&readfds); -// OBSOLETE FD_SET (fd, &readfds); -// OBSOLETE -// OBSOLETE if (timeout >= 0) -// OBSOLETE { -// OBSOLETE struct timeval timebuf; -// OBSOLETE -// OBSOLETE timebuf.tv_sec = timeout; -// OBSOLETE timebuf.tv_usec = 0; -// OBSOLETE cc = select (fd + 1, &readfds, 0, 0, &timebuf); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE cc = select (fd + 1, &readfds, 0, 0, 0); -// OBSOLETE -// OBSOLETE if (cc == 0) -// OBSOLETE return 0; -// OBSOLETE -// OBSOLETE if (cc != 1) -// OBSOLETE perror_with_name ("recv_udp_buf: Bad return value from select:"); -// OBSOLETE -// OBSOLETE cc = recv (fd, buf, len, 0); -// OBSOLETE -// OBSOLETE if (cc < 0) -// OBSOLETE perror_with_name ("Got an error from recv: "); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static int -// OBSOLETE send_udp_buf (int fd, unsigned char *buf, int len) -// OBSOLETE { -// OBSOLETE int cc; -// OBSOLETE -// OBSOLETE cc = send (fd, buf, len, 0); -// OBSOLETE -// OBSOLETE if (cc == len) -// OBSOLETE return; -// OBSOLETE -// OBSOLETE if (cc < 0) -// OBSOLETE perror_with_name ("Got an error from send: "); -// OBSOLETE -// OBSOLETE error ("Short count in send: tried %d, sent %d\n", len, cc); -// OBSOLETE } -// OBSOLETE #endif /* HAVE_SOCKETS */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE sparclite_open (char *name, int from_tty) -// OBSOLETE { -// OBSOLETE struct cleanup *old_chain; -// OBSOLETE int c; -// OBSOLETE char *p; -// OBSOLETE -// OBSOLETE if (!name) -// OBSOLETE error ("You need to specify what device or hostname is associated with the SparcLite board."); -// OBSOLETE -// OBSOLETE target_preopen (from_tty); -// OBSOLETE -// OBSOLETE unpush_target (&sparclite_ops); -// OBSOLETE -// OBSOLETE if (remote_target_name) -// OBSOLETE xfree (remote_target_name); -// OBSOLETE -// OBSOLETE remote_target_name = xstrdup (name); -// OBSOLETE -// OBSOLETE /* We need a 'serial' or 'udp' keyword to disambiguate host:port, which can -// OBSOLETE mean either a serial port on a terminal server, or the IP address of a -// OBSOLETE SPARClite demo board. If there's no colon, then it pretty much has to be -// OBSOLETE a local device (except for DOS... grrmble) */ -// OBSOLETE -// OBSOLETE p = strchr (name, ' '); -// OBSOLETE -// OBSOLETE if (p) -// OBSOLETE { -// OBSOLETE *p++ = '\000'; -// OBSOLETE while ((*p != '\000') && isspace (*p)) -// OBSOLETE p++; -// OBSOLETE -// OBSOLETE if (strncmp (name, "serial", strlen (name)) == 0) -// OBSOLETE serial_flag = 1; -// OBSOLETE else if (strncmp (name, "udp", strlen (name)) == 0) -// OBSOLETE serial_flag = 0; -// OBSOLETE else -// OBSOLETE error ("Must specify either `serial' or `udp'."); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE p = name; -// OBSOLETE -// OBSOLETE if (!strchr (name, ':')) -// OBSOLETE serial_flag = 1; /* No colon is unambiguous (local device) */ -// OBSOLETE else -// OBSOLETE error ("Usage: target sparclite serial /dev/ttyb\n\ -// OBSOLETE or: target sparclite udp host"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (serial_flag) -// OBSOLETE { -// OBSOLETE remote_desc = open_tty (p); -// OBSOLETE -// OBSOLETE old_chain = make_cleanup (close_tty, 0 /*ignore*/); -// OBSOLETE -// OBSOLETE c = send_resp (remote_desc, 0x00); -// OBSOLETE -// OBSOLETE if (c != 0xaa) -// OBSOLETE error ("Unknown response (0x%x) from SparcLite. Try resetting the board.", -// OBSOLETE c); -// OBSOLETE -// OBSOLETE c = send_resp (remote_desc, 0x55); -// OBSOLETE -// OBSOLETE if (c != 0x55) -// OBSOLETE error ("Sparclite appears to be ill."); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE #ifdef HAVE_SOCKETS -// OBSOLETE struct hostent *he; -// OBSOLETE struct sockaddr_in sockaddr; -// OBSOLETE unsigned char buffer[100]; -// OBSOLETE int cc; -// OBSOLETE -// OBSOLETE /* Setup the socket. Must be raw UDP. */ -// OBSOLETE -// OBSOLETE he = gethostbyname (p); -// OBSOLETE -// OBSOLETE if (!he) -// OBSOLETE error ("No such host %s.", p); -// OBSOLETE -// OBSOLETE udp_fd = socket (PF_INET, SOCK_DGRAM, 0); -// OBSOLETE -// OBSOLETE old_chain = make_cleanup (close, udp_fd); -// OBSOLETE -// OBSOLETE sockaddr.sin_family = PF_INET; -// OBSOLETE sockaddr.sin_port = htons (7000); -// OBSOLETE memcpy (&sockaddr.sin_addr.s_addr, he->h_addr, sizeof (struct in_addr)); -// OBSOLETE -// OBSOLETE if (connect (udp_fd, &sockaddr, sizeof (sockaddr))) -// OBSOLETE perror_with_name ("Connect failed"); -// OBSOLETE -// OBSOLETE buffer[0] = 0x5; -// OBSOLETE buffer[1] = 0; -// OBSOLETE -// OBSOLETE send_udp_buf (udp_fd, buffer, 2); /* Request version */ -// OBSOLETE cc = recv_udp_buf (udp_fd, buffer, sizeof (buffer), 5); /* Get response */ -// OBSOLETE if (cc == 0) -// OBSOLETE error ("SPARClite isn't responding."); -// OBSOLETE -// OBSOLETE if (cc < 3) -// OBSOLETE error ("SPARClite appears to be ill."); -// OBSOLETE #else -// OBSOLETE error ("UDP downloading is not supported for DOS hosts."); -// OBSOLETE #endif /* HAVE_SOCKETS */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE printf_unfiltered ("[SPARClite appears to be alive]\n"); -// OBSOLETE -// OBSOLETE push_target (&sparclite_ops); -// OBSOLETE -// OBSOLETE discard_cleanups (old_chain); -// OBSOLETE -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE sparclite_close (int quitting) -// OBSOLETE { -// OBSOLETE if (serial_flag) -// OBSOLETE close_tty (0); -// OBSOLETE #ifdef HAVE_SOCKETS -// OBSOLETE else if (udp_fd != -1) -// OBSOLETE close (udp_fd); -// OBSOLETE #endif -// OBSOLETE } -// OBSOLETE -// OBSOLETE #define LOAD_ADDRESS 0x40000000 -// OBSOLETE -// OBSOLETE static void -// OBSOLETE download (char *target_name, char *args, int from_tty, -// OBSOLETE void (*write_routine) (bfd *from_bfd, asection *from_sec, -// OBSOLETE file_ptr from_addr, bfd_vma to_addr, int len), -// OBSOLETE void (*start_routine) (bfd_vma entry)) -// OBSOLETE { -// OBSOLETE struct cleanup *old_chain; -// OBSOLETE asection *section; -// OBSOLETE bfd *pbfd; -// OBSOLETE bfd_vma entry; -// OBSOLETE int i; -// OBSOLETE #define WRITESIZE 1024 -// OBSOLETE char *filename; -// OBSOLETE int quiet; -// OBSOLETE int nostart; -// OBSOLETE -// OBSOLETE quiet = 0; -// OBSOLETE nostart = 0; -// OBSOLETE filename = NULL; -// OBSOLETE -// OBSOLETE while (*args != '\000') -// OBSOLETE { -// OBSOLETE char *arg; -// OBSOLETE -// OBSOLETE while (isspace (*args)) -// OBSOLETE args++; -// OBSOLETE -// OBSOLETE arg = args; -// OBSOLETE -// OBSOLETE while ((*args != '\000') && !isspace (*args)) -// OBSOLETE args++; -// OBSOLETE -// OBSOLETE if (*args != '\000') -// OBSOLETE *args++ = '\000'; -// OBSOLETE -// OBSOLETE if (*arg != '-') -// OBSOLETE filename = arg; -// OBSOLETE else if (strncmp (arg, "-quiet", strlen (arg)) == 0) -// OBSOLETE quiet = 1; -// OBSOLETE else if (strncmp (arg, "-nostart", strlen (arg)) == 0) -// OBSOLETE nostart = 1; -// OBSOLETE else -// OBSOLETE error ("unknown option `%s'", arg); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (!filename) -// OBSOLETE filename = get_exec_file (1); -// OBSOLETE -// OBSOLETE pbfd = bfd_openr (filename, gnutarget); -// OBSOLETE if (pbfd == NULL) -// OBSOLETE { -// OBSOLETE perror_with_name (filename); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE old_chain = make_cleanup_bfd_close (pbfd); -// OBSOLETE -// OBSOLETE if (!bfd_check_format (pbfd, bfd_object)) -// OBSOLETE error ("\"%s\" is not an object file: %s", filename, -// OBSOLETE bfd_errmsg (bfd_get_error ())); -// OBSOLETE -// OBSOLETE for (section = pbfd->sections; section; section = section->next) -// OBSOLETE { -// OBSOLETE if (bfd_get_section_flags (pbfd, section) & SEC_LOAD) -// OBSOLETE { -// OBSOLETE bfd_vma section_address; -// OBSOLETE bfd_size_type section_size; -// OBSOLETE file_ptr fptr; -// OBSOLETE const char *section_name; -// OBSOLETE -// OBSOLETE section_name = bfd_get_section_name (pbfd, section); -// OBSOLETE -// OBSOLETE section_address = bfd_get_section_vma (pbfd, section); -// OBSOLETE -// OBSOLETE /* Adjust sections from a.out files, since they don't -// OBSOLETE carry their addresses with. */ -// OBSOLETE if (bfd_get_flavour (pbfd) == bfd_target_aout_flavour) -// OBSOLETE { -// OBSOLETE if (strcmp (section_name, ".text") == 0) -// OBSOLETE section_address = bfd_get_start_address (pbfd); -// OBSOLETE else if (strcmp (section_name, ".data") == 0) -// OBSOLETE { -// OBSOLETE /* Read the first 8 bytes of the data section. -// OBSOLETE There should be the string 'DaTa' followed by -// OBSOLETE a word containing the actual section address. */ -// OBSOLETE struct data_marker -// OBSOLETE { -// OBSOLETE char signature[4]; /* 'DaTa' */ -// OBSOLETE unsigned char sdata[4]; /* &sdata */ -// OBSOLETE } -// OBSOLETE marker; -// OBSOLETE bfd_get_section_contents (pbfd, section, &marker, 0, -// OBSOLETE sizeof (marker)); -// OBSOLETE if (strncmp (marker.signature, "DaTa", 4) == 0) -// OBSOLETE { -// OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) -// OBSOLETE section_address = bfd_getb32 (marker.sdata); -// OBSOLETE else -// OBSOLETE section_address = bfd_getl32 (marker.sdata); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE section_size = bfd_get_section_size_before_reloc (section); -// OBSOLETE -// OBSOLETE if (!quiet) -// OBSOLETE printf_filtered ("[Loading section %s at 0x%x (%d bytes)]\n", -// OBSOLETE bfd_get_section_name (pbfd, section), -// OBSOLETE section_address, -// OBSOLETE section_size); -// OBSOLETE -// OBSOLETE fptr = 0; -// OBSOLETE while (section_size > 0) -// OBSOLETE { -// OBSOLETE int count; -// OBSOLETE static char inds[] = "|/-\\"; -// OBSOLETE static int k = 0; -// OBSOLETE -// OBSOLETE QUIT; -// OBSOLETE -// OBSOLETE count = min (section_size, WRITESIZE); -// OBSOLETE -// OBSOLETE write_routine (pbfd, section, fptr, section_address, count); -// OBSOLETE -// OBSOLETE if (!quiet) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("\r%c", inds[k++ % 4]); -// OBSOLETE gdb_flush (gdb_stdout); -// OBSOLETE } -// OBSOLETE -// OBSOLETE section_address += count; -// OBSOLETE fptr += count; -// OBSOLETE section_size -= count; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (!nostart) -// OBSOLETE { -// OBSOLETE entry = bfd_get_start_address (pbfd); -// OBSOLETE -// OBSOLETE if (!quiet) -// OBSOLETE printf_unfiltered ("[Starting %s at 0x%x]\n", filename, entry); -// OBSOLETE -// OBSOLETE start_routine (entry); -// OBSOLETE } -// OBSOLETE -// OBSOLETE do_cleanups (old_chain); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE sparclite_serial_start (bfd_vma entry) -// OBSOLETE { -// OBSOLETE char buffer[5]; -// OBSOLETE int i; -// OBSOLETE -// OBSOLETE buffer[0] = 0x03; -// OBSOLETE store_unsigned_integer (buffer + 1, 4, entry); -// OBSOLETE -// OBSOLETE debug_serial_write (remote_desc, buffer, 1 + 4); -// OBSOLETE i = readchar (remote_desc, remote_timeout); -// OBSOLETE if (i != 0x55) -// OBSOLETE error ("Can't start SparcLite. Error code %d\n", i); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE sparclite_serial_write (bfd *from_bfd, asection *from_sec, file_ptr from_addr, -// OBSOLETE bfd_vma to_addr, int len) -// OBSOLETE { -// OBSOLETE char buffer[4 + 4 + WRITESIZE]; /* addr + len + data */ -// OBSOLETE unsigned char checksum; -// OBSOLETE int i; -// OBSOLETE -// OBSOLETE store_unsigned_integer (buffer, 4, to_addr); /* Address */ -// OBSOLETE store_unsigned_integer (buffer + 4, 4, len); /* Length */ -// OBSOLETE -// OBSOLETE bfd_get_section_contents (from_bfd, from_sec, buffer + 8, from_addr, len); -// OBSOLETE -// OBSOLETE checksum = 0; -// OBSOLETE for (i = 0; i < len; i++) -// OBSOLETE checksum += buffer[8 + i]; -// OBSOLETE -// OBSOLETE i = send_resp (remote_desc, 0x01); -// OBSOLETE -// OBSOLETE if (i != 0x5a) -// OBSOLETE error ("Bad response from load command (0x%x)", i); -// OBSOLETE -// OBSOLETE debug_serial_write (remote_desc, buffer, 4 + 4 + len); -// OBSOLETE i = readchar (remote_desc, remote_timeout); -// OBSOLETE -// OBSOLETE if (i != checksum) -// OBSOLETE error ("Bad checksum from load command (0x%x)", i); -// OBSOLETE } -// OBSOLETE -// OBSOLETE #ifdef HAVE_SOCKETS -// OBSOLETE -// OBSOLETE static unsigned short -// OBSOLETE calc_checksum (unsigned char *buffer, int count) -// OBSOLETE { -// OBSOLETE unsigned short checksum; -// OBSOLETE -// OBSOLETE checksum = 0; -// OBSOLETE for (; count > 0; count -= 2, buffer += 2) -// OBSOLETE checksum += (*buffer << 8) | *(buffer + 1); -// OBSOLETE -// OBSOLETE if (count != 0) -// OBSOLETE checksum += *buffer << 8; -// OBSOLETE -// OBSOLETE return checksum; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE sparclite_udp_start (bfd_vma entry) -// OBSOLETE { -// OBSOLETE unsigned char buffer[6]; -// OBSOLETE int i; -// OBSOLETE -// OBSOLETE buffer[0] = 0x3; -// OBSOLETE buffer[1] = 0; -// OBSOLETE buffer[2] = entry >> 24; -// OBSOLETE buffer[3] = entry >> 16; -// OBSOLETE buffer[4] = entry >> 8; -// OBSOLETE buffer[5] = entry; -// OBSOLETE -// OBSOLETE send_udp_buf (udp_fd, buffer, 6); /* Send start addr */ -// OBSOLETE i = recv_udp_buf (udp_fd, buffer, sizeof (buffer), -1); /* Get response */ -// OBSOLETE -// OBSOLETE if (i < 1 || buffer[0] != 0x55) -// OBSOLETE error ("Failed to take start address."); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE sparclite_udp_write (bfd *from_bfd, asection *from_sec, file_ptr from_addr, -// OBSOLETE bfd_vma to_addr, int len) -// OBSOLETE { -// OBSOLETE unsigned char buffer[2000]; -// OBSOLETE unsigned short checksum; -// OBSOLETE static int pkt_num = 0; -// OBSOLETE static unsigned long old_addr = -1; -// OBSOLETE int i; -// OBSOLETE -// OBSOLETE while (1) -// OBSOLETE { -// OBSOLETE if (to_addr != old_addr) -// OBSOLETE { -// OBSOLETE buffer[0] = 0x1; /* Load command */ -// OBSOLETE buffer[1] = 0x1; /* Loading address */ -// OBSOLETE buffer[2] = to_addr >> 24; -// OBSOLETE buffer[3] = to_addr >> 16; -// OBSOLETE buffer[4] = to_addr >> 8; -// OBSOLETE buffer[5] = to_addr; -// OBSOLETE -// OBSOLETE checksum = 0; -// OBSOLETE for (i = 0; i < 6; i++) -// OBSOLETE checksum += buffer[i]; -// OBSOLETE checksum &= 0xff; -// OBSOLETE -// OBSOLETE send_udp_buf (udp_fd, buffer, 6); -// OBSOLETE i = recv_udp_buf (udp_fd, buffer, sizeof buffer, -1); -// OBSOLETE -// OBSOLETE if (i < 1) -// OBSOLETE error ("Got back short checksum for load addr."); -// OBSOLETE -// OBSOLETE if (checksum != buffer[0]) -// OBSOLETE error ("Got back bad checksum for load addr."); -// OBSOLETE -// OBSOLETE pkt_num = 0; /* Load addr resets packet seq # */ -// OBSOLETE old_addr = to_addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE bfd_get_section_contents (from_bfd, from_sec, buffer + 6, from_addr, -// OBSOLETE len); -// OBSOLETE -// OBSOLETE checksum = calc_checksum (buffer + 6, len); -// OBSOLETE -// OBSOLETE buffer[0] = 0x1; /* Load command */ -// OBSOLETE buffer[1] = 0x2; /* Loading data */ -// OBSOLETE buffer[2] = pkt_num >> 8; -// OBSOLETE buffer[3] = pkt_num; -// OBSOLETE buffer[4] = checksum >> 8; -// OBSOLETE buffer[5] = checksum; -// OBSOLETE -// OBSOLETE send_udp_buf (udp_fd, buffer, len + 6); -// OBSOLETE i = recv_udp_buf (udp_fd, buffer, sizeof buffer, 3); -// OBSOLETE -// OBSOLETE if (i == 0) -// OBSOLETE { -// OBSOLETE fprintf_unfiltered (gdb_stderr, "send_data: timeout sending %d bytes to address 0x%x retrying\n", len, to_addr); -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (buffer[0] != 0xff) -// OBSOLETE error ("Got back bad response for load data."); -// OBSOLETE -// OBSOLETE old_addr += len; -// OBSOLETE pkt_num++; -// OBSOLETE -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE #endif /* HAVE_SOCKETS */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE sparclite_download (char *filename, int from_tty) -// OBSOLETE { -// OBSOLETE if (!serial_flag) -// OBSOLETE #ifdef HAVE_SOCKETS -// OBSOLETE download (remote_target_name, filename, from_tty, sparclite_udp_write, -// OBSOLETE sparclite_udp_start); -// OBSOLETE #else -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); /* sparclite_open should prevent this! */ -// OBSOLETE #endif -// OBSOLETE else -// OBSOLETE download (remote_target_name, filename, from_tty, sparclite_serial_write, -// OBSOLETE sparclite_serial_start); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Set up the sparclite target vector. */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE init_sparclite_ops (void) -// OBSOLETE { -// OBSOLETE sparclite_ops.to_shortname = "sparclite"; -// OBSOLETE sparclite_ops.to_longname = "SPARClite download target"; -// OBSOLETE sparclite_ops.to_doc = "Download to a remote SPARClite target board via serial of UDP.\n\ -// OBSOLETE Specify the device it is connected to (e.g. /dev/ttya)."; -// OBSOLETE sparclite_ops.to_open = sparclite_open; -// OBSOLETE sparclite_ops.to_close = sparclite_close; -// OBSOLETE sparclite_ops.to_load = sparclite_download; -// OBSOLETE sparclite_ops.to_stratum = download_stratum; -// OBSOLETE sparclite_ops.to_magic = OPS_MAGIC; -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE _initialize_sparcl_tdep (void) -// OBSOLETE { -// OBSOLETE init_sparclite_ops (); -// OBSOLETE add_target (&sparclite_ops); -// OBSOLETE } diff --git a/gdb/sparclet-rom.c b/gdb/sparclet-rom.c deleted file mode 100644 index 9247131..0000000 --- a/gdb/sparclet-rom.c +++ /dev/null @@ -1,316 +0,0 @@ -// OBSOLETE /* Remote target glue for the SPARC Sparclet ROM monitor. -// OBSOLETE -// OBSOLETE Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free -// OBSOLETE Software Foundation, Inc. -// OBSOLETE -// OBSOLETE This file is part of GDB. -// OBSOLETE -// OBSOLETE This program is free software; you can redistribute it and/or modify -// OBSOLETE it under the terms of the GNU General Public License as published by -// OBSOLETE the Free Software Foundation; either version 2 of the License, or -// OBSOLETE (at your option) any later version. -// OBSOLETE -// OBSOLETE This program is distributed in the hope that it will be useful, -// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of -// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// OBSOLETE GNU General Public License for more details. -// OBSOLETE -// OBSOLETE You should have received a copy of the GNU General Public License -// OBSOLETE along with this program; if not, write to the Free Software -// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, -// OBSOLETE Boston, MA 02111-1307, USA. */ -// OBSOLETE -// OBSOLETE -// OBSOLETE #include "defs.h" -// OBSOLETE #include "gdbcore.h" -// OBSOLETE #include "target.h" -// OBSOLETE #include "monitor.h" -// OBSOLETE #include "serial.h" -// OBSOLETE #include "srec.h" -// OBSOLETE #include "symtab.h" -// OBSOLETE #include "symfile.h" /* for generic_load */ -// OBSOLETE #include "regcache.h" -// OBSOLETE #include -// OBSOLETE -// OBSOLETE extern void report_transfer_performance (unsigned long, time_t, time_t); -// OBSOLETE -// OBSOLETE static struct target_ops sparclet_ops; -// OBSOLETE -// OBSOLETE static void sparclet_open (char *args, int from_tty); -// OBSOLETE -// OBSOLETE /* This array of registers need to match the indexes used by GDB. -// OBSOLETE This exists because the various ROM monitors use different strings -// OBSOLETE than does GDB, and don't necessarily support all the registers -// OBSOLETE either. So, typing "info reg sp" becomes a "r30". */ -// OBSOLETE -// OBSOLETE /*PSR 0x00000080 impl ver icc AW LE EE EC EF PIL S PS ET CWP WIM -// OBSOLETE 0x0 0x0 0x0 0 0 0 0 0 0x0 1 0 0 0x00 0x2 -// OBSOLETE 0000010 -// OBSOLETE INS LOCALS OUTS GLOBALS -// OBSOLETE 0 0x00000000 0x00000000 0x00000000 0x00000000 -// OBSOLETE 1 0x00000000 0x00000000 0x00000000 0x00000000 -// OBSOLETE 2 0x00000000 0x00000000 0x00000000 0x00000000 -// OBSOLETE 3 0x00000000 0x00000000 0x00000000 0x00000000 -// OBSOLETE 4 0x00000000 0x00000000 0x00000000 0x00000000 -// OBSOLETE 5 0x00000000 0x00001000 0x00000000 0x00000000 -// OBSOLETE 6 0x00000000 0x00000000 0x123f0000 0x00000000 -// OBSOLETE 7 0x00000000 0x00000000 0x00000000 0x00000000 -// OBSOLETE pc: 0x12010000 0x00000000 unimp -// OBSOLETE npc: 0x12010004 0x00001000 unimp 0x1000 -// OBSOLETE tbr: 0x00000000 -// OBSOLETE y: 0x00000000 -// OBSOLETE */ -// OBSOLETE /* these correspond to the offsets from tm-* files from config directories */ -// OBSOLETE -// OBSOLETE /* is wim part of psr?? */ -// OBSOLETE /* monitor wants lower case */ -// OBSOLETE static char *sparclet_regnames[] = { -// OBSOLETE "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", -// OBSOLETE "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", -// OBSOLETE "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", -// OBSOLETE "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", -// OBSOLETE -// OBSOLETE "", "", "", "", "", "", "", "", /* no FPU regs */ -// OBSOLETE "", "", "", "", "", "", "", "", -// OBSOLETE "", "", "", "", "", "", "", "", -// OBSOLETE "", "", "", "", "", "", "", "", -// OBSOLETE /* no CPSR, FPSR */ -// OBSOLETE "y", "psr", "wim", "tbr", "pc", "npc", "", "", -// OBSOLETE -// OBSOLETE "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "", -// OBSOLETE -// OBSOLETE /* ASR15 ASR19 (don't display them) */ -// OBSOLETE "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22", -// OBSOLETE /* -// OBSOLETE "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7", -// OBSOLETE "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15", -// OBSOLETE "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23", -// OBSOLETE "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31", -// OBSOLETE "apsr", -// OBSOLETE */ -// OBSOLETE }; -// OBSOLETE -// OBSOLETE -// OBSOLETE -// OBSOLETE /* Function: sparclet_supply_register -// OBSOLETE Just returns with no action. -// OBSOLETE This function is required, because parse_register_dump (monitor.c) -// OBSOLETE expects to be able to call it. If we don't supply something, it will -// OBSOLETE call a null pointer and core-dump. Since this function does not -// OBSOLETE actually do anything, GDB will request the registers individually. */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE sparclet_supply_register (char *regname, int regnamelen, char *val, int vallen) -// OBSOLETE { -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE sparclet_load (struct serial *desc, char *file, int hashmark) -// OBSOLETE { -// OBSOLETE bfd *abfd; -// OBSOLETE asection *s; -// OBSOLETE int i; -// OBSOLETE CORE_ADDR load_offset; -// OBSOLETE time_t start_time, end_time; -// OBSOLETE unsigned long data_count = 0; -// OBSOLETE -// OBSOLETE /* enable user to specify address for downloading as 2nd arg to load */ -// OBSOLETE -// OBSOLETE i = sscanf (file, "%*s 0x%lx", &load_offset); -// OBSOLETE if (i >= 1) -// OBSOLETE { -// OBSOLETE char *p; -// OBSOLETE -// OBSOLETE for (p = file; *p != '\000' && !isspace (*p); p++); -// OBSOLETE -// OBSOLETE *p = '\000'; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE load_offset = 0; -// OBSOLETE -// OBSOLETE abfd = bfd_openr (file, 0); -// OBSOLETE if (!abfd) -// OBSOLETE { -// OBSOLETE printf_filtered ("Unable to open file %s\n", file); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (bfd_check_format (abfd, bfd_object) == 0) -// OBSOLETE { -// OBSOLETE printf_filtered ("File is not an object file\n"); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE -// OBSOLETE start_time = time (NULL); -// OBSOLETE -// OBSOLETE for (s = abfd->sections; s; s = s->next) -// OBSOLETE if (s->flags & SEC_LOAD) -// OBSOLETE { -// OBSOLETE bfd_size_type section_size; -// OBSOLETE bfd_vma vma; -// OBSOLETE -// OBSOLETE vma = bfd_get_section_vma (abfd, s) + load_offset; -// OBSOLETE section_size = bfd_section_size (abfd, s); -// OBSOLETE -// OBSOLETE data_count += section_size; -// OBSOLETE -// OBSOLETE printf_filtered ("%s\t: 0x%4x .. 0x%4x ", -// OBSOLETE bfd_get_section_name (abfd, s), vma, -// OBSOLETE vma + section_size); -// OBSOLETE gdb_flush (gdb_stdout); -// OBSOLETE -// OBSOLETE monitor_printf ("load c r %x %x\r", vma, section_size); -// OBSOLETE -// OBSOLETE monitor_expect ("load: loading ", NULL, 0); -// OBSOLETE monitor_expect ("\r", NULL, 0); -// OBSOLETE -// OBSOLETE for (i = 0; i < section_size; i += 2048) -// OBSOLETE { -// OBSOLETE int numbytes; -// OBSOLETE char buf[2048]; -// OBSOLETE -// OBSOLETE numbytes = min (sizeof buf, section_size - i); -// OBSOLETE -// OBSOLETE bfd_get_section_contents (abfd, s, buf, i, numbytes); -// OBSOLETE -// OBSOLETE serial_write (desc, buf, numbytes); -// OBSOLETE -// OBSOLETE if (hashmark) -// OBSOLETE { -// OBSOLETE putchar_unfiltered ('#'); -// OBSOLETE gdb_flush (gdb_stdout); -// OBSOLETE } -// OBSOLETE } /* Per-packet (or S-record) loop */ -// OBSOLETE -// OBSOLETE monitor_expect_prompt (NULL, 0); -// OBSOLETE -// OBSOLETE putchar_unfiltered ('\n'); -// OBSOLETE } /* Loadable sections */ -// OBSOLETE -// OBSOLETE monitor_printf ("reg pc %x\r", bfd_get_start_address (abfd)); -// OBSOLETE monitor_expect_prompt (NULL, 0); -// OBSOLETE monitor_printf ("reg npc %x\r", bfd_get_start_address (abfd) + 4); -// OBSOLETE monitor_expect_prompt (NULL, 0); -// OBSOLETE -// OBSOLETE monitor_printf ("run\r"); -// OBSOLETE -// OBSOLETE end_time = time (NULL); -// OBSOLETE -// OBSOLETE if (hashmark) -// OBSOLETE putchar_unfiltered ('\n'); -// OBSOLETE -// OBSOLETE report_transfer_performance (data_count, start_time, end_time); -// OBSOLETE -// OBSOLETE pop_target (); -// OBSOLETE push_remote_target (monitor_get_dev_name (), 1); -// OBSOLETE -// OBSOLETE throw_exception (RETURN_QUIT); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Define the monitor command strings. Since these are passed directly -// OBSOLETE through to a printf style function, we may include formatting -// OBSOLETE strings. We also need a CR or LF on the end. */ -// OBSOLETE -// OBSOLETE /* need to pause the monitor for timing reasons, so slow it down */ -// OBSOLETE -// OBSOLETE static char *sparclet_inits[] = -// OBSOLETE {"\n\r\r\n", NULL}; -// OBSOLETE -// OBSOLETE static struct monitor_ops sparclet_cmds; -// OBSOLETE -// OBSOLETE static void -// OBSOLETE init_sparclet_cmds (void) -// OBSOLETE { -// OBSOLETE sparclet_cmds.flags = MO_CLR_BREAK_USES_ADDR | -// OBSOLETE MO_HEX_PREFIX | -// OBSOLETE MO_NO_ECHO_ON_OPEN | -// OBSOLETE MO_NO_ECHO_ON_SETMEM | -// OBSOLETE MO_RUN_FIRST_TIME | -// OBSOLETE MO_GETMEM_READ_SINGLE; /* flags */ -// OBSOLETE sparclet_cmds.init = sparclet_inits; /* Init strings */ -// OBSOLETE sparclet_cmds.cont = "cont\r"; /* continue command */ -// OBSOLETE sparclet_cmds.step = "step\r"; /* single step */ -// OBSOLETE sparclet_cmds.stop = "\r"; /* break interrupts the program */ -// OBSOLETE sparclet_cmds.set_break = "+bp %x\r"; /* set a breakpoint */ -// OBSOLETE sparclet_cmds.clr_break = "-bp %x\r"; /* can't use "br" because only 2 hw bps are supported */ -// OBSOLETE sparclet_cmds.clr_all_break = "-bp %x\r"; /* clear a breakpoint */ -// OBSOLETE "-bp\r"; /* clear all breakpoints */ -// OBSOLETE sparclet_cmds.fill = "fill %x -n %x -v %x -b\r"; /* fill (start length val) */ -// OBSOLETE /* can't use "fi" because it takes words, not bytes */ -// OBSOLETE /* ex [addr] [-n count] [-b|-s|-l] default: ex cur -n 1 -b */ -// OBSOLETE sparclet_cmds.setmem.cmdb = "ex %x -b\r%x\rq\r"; /* setmem.cmdb (addr, value) */ -// OBSOLETE sparclet_cmds.setmem.cmdw = "ex %x -s\r%x\rq\r"; /* setmem.cmdw (addr, value) */ -// OBSOLETE sparclet_cmds.setmem.cmdl = "ex %x -l\r%x\rq\r"; /* setmem.cmdl (addr, value) */ -// OBSOLETE sparclet_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */ -// OBSOLETE sparclet_cmds.setmem.resp_delim = NULL; /*": " *//* setmem.resp_delim */ -// OBSOLETE sparclet_cmds.setmem.term = NULL; /*"? " *//* setmem.term */ -// OBSOLETE sparclet_cmds.setmem.term_cmd = NULL; /*"q\r" *//* setmem.term_cmd */ -// OBSOLETE /* since the parsing of multiple bytes is difficult due to -// OBSOLETE interspersed addresses, we'll only read 1 value at a time, -// OBSOLETE even tho these can handle a count */ -// OBSOLETE /* we can use -n to set count to read, but may have to parse? */ -// OBSOLETE sparclet_cmds.getmem.cmdb = "ex %x -n 1 -b\r"; /* getmem.cmdb (addr, #bytes) */ -// OBSOLETE sparclet_cmds.getmem.cmdw = "ex %x -n 1 -s\r"; /* getmem.cmdw (addr, #swords) */ -// OBSOLETE sparclet_cmds.getmem.cmdl = "ex %x -n 1 -l\r"; /* getmem.cmdl (addr, #words) */ -// OBSOLETE sparclet_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, #dwords) */ -// OBSOLETE sparclet_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */ -// OBSOLETE sparclet_cmds.getmem.term = NULL; /* getmem.term */ -// OBSOLETE sparclet_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */ -// OBSOLETE sparclet_cmds.setreg.cmd = "reg %s 0x%x\r"; /* setreg.cmd (name, value) */ -// OBSOLETE sparclet_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */ -// OBSOLETE sparclet_cmds.setreg.term = NULL; /* setreg.term */ -// OBSOLETE sparclet_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */ -// OBSOLETE sparclet_cmds.getreg.cmd = "reg %s\r"; /* getreg.cmd (name) */ -// OBSOLETE sparclet_cmds.getreg.resp_delim = " "; /* getreg.resp_delim */ -// OBSOLETE sparclet_cmds.getreg.term = NULL; /* getreg.term */ -// OBSOLETE sparclet_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */ -// OBSOLETE sparclet_cmds.dump_registers = "reg\r"; /* dump_registers */ -// OBSOLETE sparclet_cmds.register_pattern = "\\(\\w+\\)=\\([0-9a-fA-F]+\\)"; /* register_pattern */ -// OBSOLETE sparclet_cmds.supply_register = sparclet_supply_register; /* supply_register */ -// OBSOLETE sparclet_cmds.load_routine = sparclet_load; /* load_routine */ -// OBSOLETE sparclet_cmds.load = NULL; /* download command (srecs on console) */ -// OBSOLETE sparclet_cmds.loadresp = NULL; /* load response */ -// OBSOLETE sparclet_cmds.prompt = "monitor>"; /* monitor command prompt */ -// OBSOLETE /* yikes! gdb core dumps without this delimitor!! */ -// OBSOLETE sparclet_cmds.line_term = "\r"; /* end-of-command delimitor */ -// OBSOLETE sparclet_cmds.cmd_end = NULL; /* optional command terminator */ -// OBSOLETE sparclet_cmds.target = &sparclet_ops; /* target operations */ -// OBSOLETE sparclet_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */ -// OBSOLETE sparclet_cmds.regnames = sparclet_regnames; /* registers names */ -// OBSOLETE sparclet_cmds.magic = MONITOR_OPS_MAGIC; /* magic */ -// OBSOLETE }; -// OBSOLETE -// OBSOLETE static void -// OBSOLETE sparclet_open (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE monitor_open (args, &sparclet_cmds, from_tty); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE _initialize_sparclet (void) -// OBSOLETE { -// OBSOLETE int i; -// OBSOLETE init_sparclet_cmds (); -// OBSOLETE -// OBSOLETE for (i = 0; i < NUM_REGS; i++) -// OBSOLETE if (sparclet_regnames[i][0] == 'c' || -// OBSOLETE sparclet_regnames[i][0] == 'a') -// OBSOLETE sparclet_regnames[i] = 0; /* mon can't report c* or a* regs */ -// OBSOLETE -// OBSOLETE sparclet_regnames[0] = 0; /* mon won't report %G0 */ -// OBSOLETE -// OBSOLETE init_monitor_ops (&sparclet_ops); -// OBSOLETE sparclet_ops.to_shortname = "sparclet"; /* for the target command */ -// OBSOLETE sparclet_ops.to_longname = "SPARC Sparclet monitor"; -// OBSOLETE /* use SW breaks; target only supports 2 HW breakpoints */ -// OBSOLETE sparclet_ops.to_insert_breakpoint = memory_insert_breakpoint; -// OBSOLETE sparclet_ops.to_remove_breakpoint = memory_remove_breakpoint; -// OBSOLETE -// OBSOLETE sparclet_ops.to_doc = -// OBSOLETE "Use a board running the Sparclet debug monitor.\n\ -// OBSOLETE Specify the serial device it is connected to (e.g. /dev/ttya)."; -// OBSOLETE -// OBSOLETE sparclet_ops.to_open = sparclet_open; -// OBSOLETE add_target (&sparclet_ops); -// OBSOLETE } diff --git a/gdb/sparclet-stub.c b/gdb/sparclet-stub.c deleted file mode 100644 index 88740f2..0000000 --- a/gdb/sparclet-stub.c +++ /dev/null @@ -1,1167 +0,0 @@ -// OBSOLETE /**************************************************************************** -// OBSOLETE -// OBSOLETE THIS SOFTWARE IS NOT COPYRIGHTED -// OBSOLETE -// OBSOLETE HP offers the following for use in the public domain. HP makes no -// OBSOLETE warranty with regard to the software or it's performance and the -// OBSOLETE user accepts the software "AS IS" with all faults. -// OBSOLETE -// OBSOLETE HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD -// OBSOLETE TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OBSOLETE OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// OBSOLETE -// OBSOLETE ****************************************************************************/ -// OBSOLETE -// OBSOLETE /**************************************************************************** -// OBSOLETE * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ -// OBSOLETE * -// OBSOLETE * Module name: remcom.c $ -// OBSOLETE * Revision: 1.34 $ -// OBSOLETE * Date: 91/03/09 12:29:49 $ -// OBSOLETE * Contributor: Lake Stevens Instrument Division$ -// OBSOLETE * -// OBSOLETE * Description: low level support for gdb debugger. $ -// OBSOLETE * -// OBSOLETE * Considerations: only works on target hardware $ -// OBSOLETE * -// OBSOLETE * Written by: Glenn Engel $ -// OBSOLETE * ModuleState: Experimental $ -// OBSOLETE * -// OBSOLETE * NOTES: See Below $ -// OBSOLETE * -// OBSOLETE * Modified for SPARC by Stu Grossman, Cygnus Support. -// OBSOLETE * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware -// OBSOLETE * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support. -// OBSOLETE * -// OBSOLETE * This code has been extensively tested on the Fujitsu SPARClite demo board. -// OBSOLETE * -// OBSOLETE * To enable debugger support, two things need to happen. One, a -// OBSOLETE * call to set_debug_traps() is necessary in order to allow any breakpoints -// OBSOLETE * or error conditions to be properly intercepted and reported to gdb. -// OBSOLETE * Two, a breakpoint needs to be generated to begin communication. This -// OBSOLETE * is most easily accomplished by a call to breakpoint(). Breakpoint() -// OBSOLETE * simulates a breakpoint by executing a trap #1. -// OBSOLETE * -// OBSOLETE ************* -// OBSOLETE * -// OBSOLETE * The following gdb commands are supported: -// OBSOLETE * -// OBSOLETE * command function Return value -// OBSOLETE * -// OBSOLETE * g return the value of the CPU registers hex data or ENN -// OBSOLETE * G set the value of the CPU registers OK or ENN -// OBSOLETE * P set the value of a single CPU register OK or ENN -// OBSOLETE * -// OBSOLETE * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN -// OBSOLETE * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN -// OBSOLETE * -// OBSOLETE * c Resume at current address SNN ( signal NN) -// OBSOLETE * cAA..AA Continue at address AA..AA SNN -// OBSOLETE * -// OBSOLETE * s Step one instruction SNN -// OBSOLETE * sAA..AA Step one instruction from AA..AA SNN -// OBSOLETE * -// OBSOLETE * k kill -// OBSOLETE * -// OBSOLETE * ? What was the last sigval ? SNN (signal NN) -// OBSOLETE * -// OBSOLETE * All commands and responses are sent with a packet which includes a -// OBSOLETE * checksum. A packet consists of -// OBSOLETE * -// OBSOLETE * $#. -// OBSOLETE * -// OBSOLETE * where -// OBSOLETE * :: -// OBSOLETE * :: > -// OBSOLETE * -// OBSOLETE * When a packet is received, it is first acknowledged with either '+' or '-'. -// OBSOLETE * '+' indicates a successful transfer. '-' indicates a failed transfer. -// OBSOLETE * -// OBSOLETE * Example: -// OBSOLETE * -// OBSOLETE * Host: Reply: -// OBSOLETE * $m0,10#2a +$00010203040506070809101112131415#42 -// OBSOLETE * -// OBSOLETE ****************************************************************************/ -// OBSOLETE -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE -// OBSOLETE /************************************************************************ -// OBSOLETE * -// OBSOLETE * external low-level support routines -// OBSOLETE */ -// OBSOLETE -// OBSOLETE extern void putDebugChar(); /* write a single character */ -// OBSOLETE extern int getDebugChar(); /* read and return a single char */ -// OBSOLETE -// OBSOLETE /************************************************************************/ -// OBSOLETE /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ -// OBSOLETE /* at least NUMREGBYTES*2 are needed for register packets */ -// OBSOLETE #define BUFMAX 2048 -// OBSOLETE -// OBSOLETE static int initialized = 0; /* !0 means we've been initialized */ -// OBSOLETE static int remote_debug = 0; /* turn on verbose debugging */ -// OBSOLETE -// OBSOLETE extern void breakinst(); -// OBSOLETE void _cprint(); -// OBSOLETE static void hw_breakpoint(); -// OBSOLETE static void set_mem_fault_trap(); -// OBSOLETE static void get_in_break_mode(); -// OBSOLETE static unsigned char *mem2hex(); -// OBSOLETE -// OBSOLETE static const char hexchars[]="0123456789abcdef"; -// OBSOLETE -// OBSOLETE #define NUMREGS 121 -// OBSOLETE -// OBSOLETE static unsigned long saved_stack_pointer; -// OBSOLETE -// OBSOLETE /* Number of bytes of registers. */ -// OBSOLETE #define NUMREGBYTES (NUMREGS * 4) -// OBSOLETE enum regnames { G0, G1, G2, G3, G4, G5, G6, G7, -// OBSOLETE O0, O1, O2, O3, O4, O5, SP, O7, -// OBSOLETE L0, L1, L2, L3, L4, L5, L6, L7, -// OBSOLETE I0, I1, I2, I3, I4, I5, FP, I7, -// OBSOLETE -// OBSOLETE F0, F1, F2, F3, F4, F5, F6, F7, -// OBSOLETE F8, F9, F10, F11, F12, F13, F14, F15, -// OBSOLETE F16, F17, F18, F19, F20, F21, F22, F23, -// OBSOLETE F24, F25, F26, F27, F28, F29, F30, F31, -// OBSOLETE -// OBSOLETE Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR, -// OBSOLETE CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR, UNUSED1, -// OBSOLETE -// OBSOLETE ASR1, ASR15, ASR17, ASR18, ASR19, ASR20, ASR21, ASR22, -// OBSOLETE /* the following not actually implemented */ -// OBSOLETE AWR0, AWR1, AWR2, AWR3, AWR4, AWR5, AWR6, AWR7, -// OBSOLETE AWR8, AWR9, AWR10, AWR11, AWR12, AWR13, AWR14, AWR15, -// OBSOLETE AWR16, AWR17, AWR18, AWR19, AWR20, AWR21, AWR22, AWR23, -// OBSOLETE AWR24, AWR25, AWR26, AWR27, AWR28, AWR29, AWR30, AWR31, -// OBSOLETE APSR -// OBSOLETE }; -// OBSOLETE -// OBSOLETE /*************************** ASSEMBLY CODE MACROS *************************/ -// OBSOLETE /* */ -// OBSOLETE -// OBSOLETE extern void trap_low(); -// OBSOLETE -// OBSOLETE asm(" -// OBSOLETE .reserve trapstack, 1000 * 4, \"bss\", 8 -// OBSOLETE -// OBSOLETE .data -// OBSOLETE .align 4 -// OBSOLETE -// OBSOLETE in_trap_handler: -// OBSOLETE .word 0 -// OBSOLETE -// OBSOLETE .text -// OBSOLETE .align 4 -// OBSOLETE -// OBSOLETE ! This function is called when any SPARC trap (except window overflow or -// OBSOLETE ! underflow) occurs. It makes sure that the invalid register window is still -// OBSOLETE ! available before jumping into C code. It will also restore the world if you -// OBSOLETE ! return from handle_exception. -// OBSOLETE ! -// OBSOLETE ! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly. -// OBSOLETE -// OBSOLETE .globl _trap_low -// OBSOLETE _trap_low: -// OBSOLETE mov %psr, %l0 -// OBSOLETE mov %wim, %l3 -// OBSOLETE -// OBSOLETE srl %l3, %l0, %l4 ! wim >> cwp -// OBSOLETE and %l4, 0xff, %l4 ! Mask off windows 28, 29 -// OBSOLETE cmp %l4, 1 -// OBSOLETE bne window_fine ! Branch if not in the invalid window -// OBSOLETE nop -// OBSOLETE -// OBSOLETE ! Handle window overflow -// OBSOLETE -// OBSOLETE mov %g1, %l4 ! Save g1, we use it to hold the wim -// OBSOLETE srl %l3, 1, %g1 ! Rotate wim right -// OBSOLETE and %g1, 0xff, %g1 ! Mask off windows 28, 29 -// OBSOLETE tst %g1 -// OBSOLETE bg good_wim ! Branch if new wim is non-zero -// OBSOLETE nop -// OBSOLETE -// OBSOLETE ! At this point, we need to bring a 1 into the high order bit of the wim. -// OBSOLETE ! Since we don't want to make any assumptions about the number of register -// OBSOLETE ! windows, we figure it out dynamically so as to setup the wim correctly. -// OBSOLETE -// OBSOLETE ! The normal way doesn't work on the sparclet as register windows -// OBSOLETE ! 28 and 29 are special purpose windows. -// OBSOLETE !not %g1 ! Fill g1 with ones -// OBSOLETE !mov %g1, %wim ! Fill the wim with ones -// OBSOLETE !nop -// OBSOLETE !nop -// OBSOLETE !nop -// OBSOLETE !mov %wim, %g1 ! Read back the wim -// OBSOLETE !inc %g1 ! Now g1 has 1 just to left of wim -// OBSOLETE !srl %g1, 1, %g1 ! Now put 1 at top of wim -// OBSOLETE -// OBSOLETE mov 0x80, %g1 ! Hack for sparclet -// OBSOLETE -// OBSOLETE ! This doesn't work on the sparclet. -// OBSOLETE !mov %g0, %wim ! Clear wim so that subsequent save -// OBSOLETE ! won't trap -// OBSOLETE andn %l3, 0xff, %l5 ! Clear wim but not windows 28, 29 -// OBSOLETE mov %l5, %wim -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE -// OBSOLETE good_wim: -// OBSOLETE save %g0, %g0, %g0 ! Slip into next window -// OBSOLETE mov %g1, %wim ! Install the new wim -// OBSOLETE -// OBSOLETE std %l0, [%sp + 0 * 4] ! save L & I registers -// OBSOLETE std %l2, [%sp + 2 * 4] -// OBSOLETE std %l4, [%sp + 4 * 4] -// OBSOLETE std %l6, [%sp + 6 * 4] -// OBSOLETE -// OBSOLETE std %i0, [%sp + 8 * 4] -// OBSOLETE std %i2, [%sp + 10 * 4] -// OBSOLETE std %i4, [%sp + 12 * 4] -// OBSOLETE std %i6, [%sp + 14 * 4] -// OBSOLETE -// OBSOLETE restore ! Go back to trap window. -// OBSOLETE mov %l4, %g1 ! Restore %g1 -// OBSOLETE -// OBSOLETE window_fine: -// OBSOLETE sethi %hi(in_trap_handler), %l4 -// OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5 -// OBSOLETE tst %l5 -// OBSOLETE bg recursive_trap -// OBSOLETE inc %l5 -// OBSOLETE -// OBSOLETE set trapstack+1000*4, %sp ! Switch to trap stack -// OBSOLETE -// OBSOLETE recursive_trap: -// OBSOLETE st %l5, [%lo(in_trap_handler) + %l4] -// OBSOLETE sub %sp,(16+1+6+1+88)*4,%sp ! Make room for input & locals -// OBSOLETE ! + hidden arg + arg spill -// OBSOLETE ! + doubleword alignment -// OBSOLETE ! + registers[121] -// OBSOLETE -// OBSOLETE std %g0, [%sp + (24 + 0) * 4] ! registers[Gx] -// OBSOLETE std %g2, [%sp + (24 + 2) * 4] -// OBSOLETE std %g4, [%sp + (24 + 4) * 4] -// OBSOLETE std %g6, [%sp + (24 + 6) * 4] -// OBSOLETE -// OBSOLETE std %i0, [%sp + (24 + 8) * 4] ! registers[Ox] -// OBSOLETE std %i2, [%sp + (24 + 10) * 4] -// OBSOLETE std %i4, [%sp + (24 + 12) * 4] -// OBSOLETE std %i6, [%sp + (24 + 14) * 4] -// OBSOLETE -// OBSOLETE ! FP regs (sparclet doesn't have fpu) -// OBSOLETE -// OBSOLETE mov %y, %l4 -// OBSOLETE mov %tbr, %l5 -// OBSOLETE st %l4, [%sp + (24 + 64) * 4] ! Y -// OBSOLETE st %l0, [%sp + (24 + 65) * 4] ! PSR -// OBSOLETE st %l3, [%sp + (24 + 66) * 4] ! WIM -// OBSOLETE st %l5, [%sp + (24 + 67) * 4] ! TBR -// OBSOLETE st %l1, [%sp + (24 + 68) * 4] ! PC -// OBSOLETE st %l2, [%sp + (24 + 69) * 4] ! NPC -// OBSOLETE ! CPSR and FPSR not impl -// OBSOLETE or %l0, 0xf20, %l4 -// OBSOLETE mov %l4, %psr ! Turn on traps, disable interrupts -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE -// OBSOLETE ! Save coprocessor state. -// OBSOLETE ! See SK/demo/hdlc_demo/ldc_swap_context.S. -// OBSOLETE -// OBSOLETE mov %psr, %l0 -// OBSOLETE sethi %hi(0x2000), %l5 ! EC bit in PSR -// OBSOLETE or %l5, %l0, %l5 -// OBSOLETE mov %l5, %psr ! enable coprocessor -// OBSOLETE nop ! 3 nops after write to %psr (needed?) -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE crdcxt %ccsr, %l1 ! capture CCSR -// OBSOLETE mov 0x6, %l2 -// OBSOLETE cwrcxt %l2, %ccsr ! set CCP state machine for CCFR -// OBSOLETE crdcxt %ccfr, %l2 ! capture CCOR -// OBSOLETE cwrcxt %l2, %ccfr ! tickle CCFR -// OBSOLETE crdcxt %ccfr, %l3 ! capture CCOBR -// OBSOLETE cwrcxt %l3, %ccfr ! tickle CCFR -// OBSOLETE crdcxt %ccfr, %l4 ! capture CCIBR -// OBSOLETE cwrcxt %l4, %ccfr ! tickle CCFR -// OBSOLETE crdcxt %ccfr, %l5 ! capture CCIR -// OBSOLETE cwrcxt %l5, %ccfr ! tickle CCFR -// OBSOLETE crdcxt %ccpr, %l6 ! capture CCPR -// OBSOLETE crdcxt %cccrcr, %l7 ! capture CCCRCR -// OBSOLETE st %l1, [%sp + (24 + 72) * 4] ! save CCSR -// OBSOLETE st %l2, [%sp + (24 + 75) * 4] ! save CCOR -// OBSOLETE st %l3, [%sp + (24 + 76) * 4] ! save CCOBR -// OBSOLETE st %l4, [%sp + (24 + 77) * 4] ! save CCIBR -// OBSOLETE st %l5, [%sp + (24 + 78) * 4] ! save CCIR -// OBSOLETE st %l6, [%sp + (24 + 73) * 4] ! save CCPR -// OBSOLETE st %l7, [%sp + (24 + 74) * 4] ! save CCCRCR -// OBSOLETE mov %l0, %psr ! restore original PSR -// OBSOLETE nop ! 3 nops after write to %psr (needed?) -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE -// OBSOLETE ! End of saving coprocessor state. -// OBSOLETE ! Save asr regs -// OBSOLETE -// OBSOLETE ! Part of this is silly -- we should not display ASR15 or ASR19 at all. -// OBSOLETE -// OBSOLETE sethi %hi(0x01000000), %l6 -// OBSOLETE st %l6, [%sp + (24 + 81) * 4] ! ASR15 == NOP -// OBSOLETE sethi %hi(0xdeadc0de), %l6 -// OBSOLETE or %l6, %lo(0xdeadc0de), %l6 -// OBSOLETE st %l6, [%sp + (24 + 84) * 4] ! ASR19 == DEADC0DE -// OBSOLETE -// OBSOLETE rd %asr1, %l4 -// OBSOLETE st %l4, [%sp + (24 + 80) * 4] -// OBSOLETE ! rd %asr15, %l4 ! must not read ASR15 -// OBSOLETE ! st %l4, [%sp + (24 + 81) * 4] ! (illegal instr trap) -// OBSOLETE rd %asr17, %l4 -// OBSOLETE st %l4, [%sp + (24 + 82) * 4] -// OBSOLETE rd %asr18, %l4 -// OBSOLETE st %l4, [%sp + (24 + 83) * 4] -// OBSOLETE ! rd %asr19, %l4 ! must not read asr19 -// OBSOLETE ! st %l4, [%sp + (24 + 84) * 4] ! (halts the CPU) -// OBSOLETE rd %asr20, %l4 -// OBSOLETE st %l4, [%sp + (24 + 85) * 4] -// OBSOLETE rd %asr21, %l4 -// OBSOLETE st %l4, [%sp + (24 + 86) * 4] -// OBSOLETE rd %asr22, %l4 -// OBSOLETE st %l4, [%sp + (24 + 87) * 4] -// OBSOLETE -// OBSOLETE ! End of saving asr regs -// OBSOLETE -// OBSOLETE call _handle_exception -// OBSOLETE add %sp, 24 * 4, %o0 ! Pass address of registers -// OBSOLETE -// OBSOLETE ! Reload all of the registers that aren't on the stack -// OBSOLETE -// OBSOLETE ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx] -// OBSOLETE ldd [%sp + (24 + 2) * 4], %g2 -// OBSOLETE ldd [%sp + (24 + 4) * 4], %g4 -// OBSOLETE ldd [%sp + (24 + 6) * 4], %g6 -// OBSOLETE -// OBSOLETE ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox] -// OBSOLETE ldd [%sp + (24 + 10) * 4], %i2 -// OBSOLETE ldd [%sp + (24 + 12) * 4], %i4 -// OBSOLETE ldd [%sp + (24 + 14) * 4], %i6 -// OBSOLETE -// OBSOLETE ! FP regs (sparclet doesn't have fpu) -// OBSOLETE -// OBSOLETE ! Update the coprocessor registers. -// OBSOLETE ! See SK/demo/hdlc_demo/ldc_swap_context.S. -// OBSOLETE -// OBSOLETE mov %psr, %l0 -// OBSOLETE sethi %hi(0x2000), %l5 ! EC bit in PSR -// OBSOLETE or %l5, %l0, %l5 -// OBSOLETE mov %l5, %psr ! enable coprocessor -// OBSOLETE nop ! 3 nops after write to %psr (needed?) -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE -// OBSOLETE mov 0x6, %l2 -// OBSOLETE cwrcxt %l2, %ccsr ! set CCP state machine for CCFR -// OBSOLETE -// OBSOLETE ld [%sp + (24 + 72) * 4], %l1 ! saved CCSR -// OBSOLETE ld [%sp + (24 + 75) * 4], %l2 ! saved CCOR -// OBSOLETE ld [%sp + (24 + 76) * 4], %l3 ! saved CCOBR -// OBSOLETE ld [%sp + (24 + 77) * 4], %l4 ! saved CCIBR -// OBSOLETE ld [%sp + (24 + 78) * 4], %l5 ! saved CCIR -// OBSOLETE ld [%sp + (24 + 73) * 4], %l6 ! saved CCPR -// OBSOLETE ld [%sp + (24 + 74) * 4], %l7 ! saved CCCRCR -// OBSOLETE -// OBSOLETE cwrcxt %l2, %ccfr ! restore CCOR -// OBSOLETE cwrcxt %l3, %ccfr ! restore CCOBR -// OBSOLETE cwrcxt %l4, %ccfr ! restore CCIBR -// OBSOLETE cwrcxt %l5, %ccfr ! restore CCIR -// OBSOLETE cwrcxt %l6, %ccpr ! restore CCPR -// OBSOLETE cwrcxt %l7, %cccrcr ! restore CCCRCR -// OBSOLETE cwrcxt %l1, %ccsr ! restore CCSR -// OBSOLETE -// OBSOLETE mov %l0, %psr ! restore PSR -// OBSOLETE nop ! 3 nops after write to %psr (needed?) -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE -// OBSOLETE ! End of coprocessor handling stuff. -// OBSOLETE ! Update asr regs -// OBSOLETE -// OBSOLETE ld [%sp + (24 + 80) * 4], %l4 -// OBSOLETE wr %l4, %asr1 -// OBSOLETE ! ld [%sp + (24 + 81) * 4], %l4 ! can't write asr15 -// OBSOLETE ! wr %l4, %asr15 -// OBSOLETE ld [%sp + (24 + 82) * 4], %l4 -// OBSOLETE wr %l4, %asr17 -// OBSOLETE ld [%sp + (24 + 83) * 4], %l4 -// OBSOLETE wr %l4, %asr18 -// OBSOLETE ! ld [%sp + (24 + 84) * 4], %l4 ! can't write asr19 -// OBSOLETE ! wr %l4, %asr19 -// OBSOLETE ! ld [%sp + (24 + 85) * 4], %l4 ! can't write asr20 -// OBSOLETE ! wr %l4, %asr20 -// OBSOLETE ! ld [%sp + (24 + 86) * 4], %l4 ! can't write asr21 -// OBSOLETE ! wr %l4, %asr21 -// OBSOLETE ld [%sp + (24 + 87) * 4], %l4 -// OBSOLETE wr %l4, %asr22 -// OBSOLETE -// OBSOLETE ! End of restoring asr regs -// OBSOLETE -// OBSOLETE -// OBSOLETE ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR -// OBSOLETE ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC -// OBSOLETE -// OBSOLETE restore ! Ensure that previous window is valid -// OBSOLETE save %g0, %g0, %g0 ! by causing a window_underflow trap -// OBSOLETE -// OBSOLETE mov %l0, %y -// OBSOLETE mov %l1, %psr ! Make sure that traps are disabled -// OBSOLETE ! for rett -// OBSOLETE nop ! 3 nops after write to %psr (needed?) -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE -// OBSOLETE sethi %hi(in_trap_handler), %l4 -// OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5 -// OBSOLETE dec %l5 -// OBSOLETE st %l5, [%lo(in_trap_handler) + %l4] -// OBSOLETE -// OBSOLETE jmpl %l2, %g0 ! Restore old PC -// OBSOLETE rett %l3 ! Restore old nPC -// OBSOLETE "); -// OBSOLETE -// OBSOLETE /* Convert ch from a hex digit to an int */ -// OBSOLETE -// OBSOLETE static int -// OBSOLETE hex (unsigned char ch) -// OBSOLETE { -// OBSOLETE if (ch >= 'a' && ch <= 'f') -// OBSOLETE return ch-'a'+10; -// OBSOLETE if (ch >= '0' && ch <= '9') -// OBSOLETE return ch-'0'; -// OBSOLETE if (ch >= 'A' && ch <= 'F') -// OBSOLETE return ch-'A'+10; -// OBSOLETE return -1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static char remcomInBuffer[BUFMAX]; -// OBSOLETE static char remcomOutBuffer[BUFMAX]; -// OBSOLETE -// OBSOLETE /* scan for the sequence $# */ -// OBSOLETE -// OBSOLETE unsigned char * -// OBSOLETE getpacket (void) -// OBSOLETE { -// OBSOLETE unsigned char *buffer = &remcomInBuffer[0]; -// OBSOLETE unsigned char checksum; -// OBSOLETE unsigned char xmitcsum; -// OBSOLETE int count; -// OBSOLETE char ch; -// OBSOLETE -// OBSOLETE while (1) -// OBSOLETE { -// OBSOLETE /* wait around for the start character, ignore all other characters */ -// OBSOLETE while ((ch = getDebugChar ()) != '$') -// OBSOLETE ; -// OBSOLETE -// OBSOLETE retry: -// OBSOLETE checksum = 0; -// OBSOLETE xmitcsum = -1; -// OBSOLETE count = 0; -// OBSOLETE -// OBSOLETE /* now, read until a # or end of buffer is found */ -// OBSOLETE while (count < BUFMAX) -// OBSOLETE { -// OBSOLETE ch = getDebugChar (); -// OBSOLETE if (ch == '$') -// OBSOLETE goto retry; -// OBSOLETE if (ch == '#') -// OBSOLETE break; -// OBSOLETE checksum = checksum + ch; -// OBSOLETE buffer[count] = ch; -// OBSOLETE count = count + 1; -// OBSOLETE } -// OBSOLETE buffer[count] = 0; -// OBSOLETE -// OBSOLETE if (ch == '#') -// OBSOLETE { -// OBSOLETE ch = getDebugChar (); -// OBSOLETE xmitcsum = hex (ch) << 4; -// OBSOLETE ch = getDebugChar (); -// OBSOLETE xmitcsum += hex (ch); -// OBSOLETE -// OBSOLETE if (checksum != xmitcsum) -// OBSOLETE { -// OBSOLETE putDebugChar ('-'); /* failed checksum */ -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE putDebugChar ('+'); /* successful transfer */ -// OBSOLETE -// OBSOLETE /* if a sequence char is present, reply the sequence ID */ -// OBSOLETE if (buffer[2] == ':') -// OBSOLETE { -// OBSOLETE putDebugChar (buffer[0]); -// OBSOLETE putDebugChar (buffer[1]); -// OBSOLETE -// OBSOLETE return &buffer[3]; -// OBSOLETE } -// OBSOLETE -// OBSOLETE return &buffer[0]; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* send the packet in buffer. */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE putpacket (unsigned char *buffer) -// OBSOLETE { -// OBSOLETE unsigned char checksum; -// OBSOLETE int count; -// OBSOLETE unsigned char ch; -// OBSOLETE -// OBSOLETE /* $#. */ -// OBSOLETE do -// OBSOLETE { -// OBSOLETE putDebugChar('$'); -// OBSOLETE checksum = 0; -// OBSOLETE count = 0; -// OBSOLETE -// OBSOLETE while (ch = buffer[count]) -// OBSOLETE { -// OBSOLETE putDebugChar(ch); -// OBSOLETE checksum += ch; -// OBSOLETE count += 1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE putDebugChar('#'); -// OBSOLETE putDebugChar(hexchars[checksum >> 4]); -// OBSOLETE putDebugChar(hexchars[checksum & 0xf]); -// OBSOLETE -// OBSOLETE } -// OBSOLETE while (getDebugChar() != '+'); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Indicate to caller of mem2hex or hex2mem that there has been an -// OBSOLETE error. */ -// OBSOLETE static volatile int mem_err = 0; -// OBSOLETE -// OBSOLETE /* Convert the memory pointed to by mem into hex, placing result in buf. -// OBSOLETE * Return a pointer to the last char put in buf (null), in case of mem fault, -// OBSOLETE * return 0. -// OBSOLETE * If MAY_FAULT is non-zero, then we will handle memory faults by returning -// OBSOLETE * a 0, else treat a fault like any other fault in the stub. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE static unsigned char * -// OBSOLETE mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault) -// OBSOLETE { -// OBSOLETE unsigned char ch; -// OBSOLETE -// OBSOLETE set_mem_fault_trap(may_fault); -// OBSOLETE -// OBSOLETE while (count-- > 0) -// OBSOLETE { -// OBSOLETE ch = *mem++; -// OBSOLETE if (mem_err) -// OBSOLETE return 0; -// OBSOLETE *buf++ = hexchars[ch >> 4]; -// OBSOLETE *buf++ = hexchars[ch & 0xf]; -// OBSOLETE } -// OBSOLETE -// OBSOLETE *buf = 0; -// OBSOLETE -// OBSOLETE set_mem_fault_trap(0); -// OBSOLETE -// OBSOLETE return buf; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* convert the hex array pointed to by buf into binary to be placed in mem -// OBSOLETE * return a pointer to the character AFTER the last byte written */ -// OBSOLETE -// OBSOLETE static char * -// OBSOLETE hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault) -// OBSOLETE { -// OBSOLETE int i; -// OBSOLETE unsigned char ch; -// OBSOLETE -// OBSOLETE set_mem_fault_trap(may_fault); -// OBSOLETE -// OBSOLETE for (i=0; itt && ht->signo; ht++) -// OBSOLETE exceptionHandler(ht->tt, trap_low); -// OBSOLETE -// OBSOLETE initialized = 1; -// OBSOLETE } -// OBSOLETE -// OBSOLETE asm (" -// OBSOLETE ! Trap handler for memory errors. This just sets mem_err to be non-zero. It -// OBSOLETE ! assumes that %l1 is non-zero. This should be safe, as it is doubtful that -// OBSOLETE ! 0 would ever contain code that could mem fault. This routine will skip -// OBSOLETE ! past the faulting instruction after setting mem_err. -// OBSOLETE -// OBSOLETE .text -// OBSOLETE .align 4 -// OBSOLETE -// OBSOLETE _fltr_set_mem_err: -// OBSOLETE sethi %hi(_mem_err), %l0 -// OBSOLETE st %l1, [%l0 + %lo(_mem_err)] -// OBSOLETE jmpl %l2, %g0 -// OBSOLETE rett %l2+4 -// OBSOLETE "); -// OBSOLETE -// OBSOLETE static void -// OBSOLETE set_mem_fault_trap (int enable) -// OBSOLETE { -// OBSOLETE extern void fltr_set_mem_err(); -// OBSOLETE mem_err = 0; -// OBSOLETE -// OBSOLETE if (enable) -// OBSOLETE exceptionHandler(0x29, fltr_set_mem_err); -// OBSOLETE else -// OBSOLETE exceptionHandler(0x29, trap_low); -// OBSOLETE } -// OBSOLETE -// OBSOLETE asm (" -// OBSOLETE .text -// OBSOLETE .align 4 -// OBSOLETE -// OBSOLETE _dummy_hw_breakpoint: -// OBSOLETE jmpl %l2, %g0 -// OBSOLETE rett %l2+4 -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE "); -// OBSOLETE -// OBSOLETE static void -// OBSOLETE set_hw_breakpoint_trap (int enable) -// OBSOLETE { -// OBSOLETE extern void dummy_hw_breakpoint(); -// OBSOLETE -// OBSOLETE if (enable) -// OBSOLETE exceptionHandler(255, dummy_hw_breakpoint); -// OBSOLETE else -// OBSOLETE exceptionHandler(255, trap_low); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE get_in_break_mode (void) -// OBSOLETE { -// OBSOLETE #if 0 -// OBSOLETE int x; -// OBSOLETE mesg("get_in_break_mode, sp = "); -// OBSOLETE phex(&x); -// OBSOLETE #endif -// OBSOLETE set_hw_breakpoint_trap(1); -// OBSOLETE -// OBSOLETE asm(" -// OBSOLETE sethi %hi(0xff10), %l4 -// OBSOLETE or %l4, %lo(0xff10), %l4 -// OBSOLETE sta %g0, [%l4]0x1 -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE "); -// OBSOLETE -// OBSOLETE set_hw_breakpoint_trap(0); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Convert the SPARC hardware trap type code to a unix signal number. */ -// OBSOLETE -// OBSOLETE static int -// OBSOLETE computeSignal (int tt) -// OBSOLETE { -// OBSOLETE struct hard_trap_info *ht; -// OBSOLETE -// OBSOLETE for (ht = hard_trap_info; ht->tt && ht->signo; ht++) -// OBSOLETE if (ht->tt == tt) -// OBSOLETE return ht->signo; -// OBSOLETE -// OBSOLETE return SIGHUP; /* default for things we don't know about */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * While we find nice hex chars, build an int. -// OBSOLETE * Return number of chars processed. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE static int -// OBSOLETE hexToInt(char **ptr, int *intValue) -// OBSOLETE { -// OBSOLETE int numChars = 0; -// OBSOLETE int hexValue; -// OBSOLETE -// OBSOLETE *intValue = 0; -// OBSOLETE -// OBSOLETE while (**ptr) -// OBSOLETE { -// OBSOLETE hexValue = hex(**ptr); -// OBSOLETE if (hexValue < 0) -// OBSOLETE break; -// OBSOLETE -// OBSOLETE *intValue = (*intValue << 4) | hexValue; -// OBSOLETE numChars ++; -// OBSOLETE -// OBSOLETE (*ptr)++; -// OBSOLETE } -// OBSOLETE -// OBSOLETE return (numChars); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * This function does all command procesing for interfacing to gdb. It -// OBSOLETE * returns 1 if you should skip the instruction at the trap address, 0 -// OBSOLETE * otherwise. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE static void -// OBSOLETE handle_exception (unsigned long *registers) -// OBSOLETE { -// OBSOLETE int tt; /* Trap type */ -// OBSOLETE int sigval; -// OBSOLETE int addr; -// OBSOLETE int length; -// OBSOLETE char *ptr; -// OBSOLETE unsigned long *sp; -// OBSOLETE unsigned long dsr; -// OBSOLETE -// OBSOLETE /* First, we must force all of the windows to be spilled out */ -// OBSOLETE -// OBSOLETE asm(" -// OBSOLETE ! Ugh. sparclet has broken save -// OBSOLETE !save %sp, -64, %sp -// OBSOLETE save -// OBSOLETE add %fp,-64,%sp -// OBSOLETE !save %sp, -64, %sp -// OBSOLETE save -// OBSOLETE add %fp,-64,%sp -// OBSOLETE !save %sp, -64, %sp -// OBSOLETE save -// OBSOLETE add %fp,-64,%sp -// OBSOLETE !save %sp, -64, %sp -// OBSOLETE save -// OBSOLETE add %fp,-64,%sp -// OBSOLETE !save %sp, -64, %sp -// OBSOLETE save -// OBSOLETE add %fp,-64,%sp -// OBSOLETE !save %sp, -64, %sp -// OBSOLETE save -// OBSOLETE add %fp,-64,%sp -// OBSOLETE !save %sp, -64, %sp -// OBSOLETE save -// OBSOLETE add %fp,-64,%sp -// OBSOLETE !save %sp, -64, %sp -// OBSOLETE save -// OBSOLETE add %fp,-64,%sp -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE restore -// OBSOLETE "); -// OBSOLETE -// OBSOLETE if (registers[PC] == (unsigned long)breakinst) -// OBSOLETE { -// OBSOLETE registers[PC] = registers[NPC]; -// OBSOLETE registers[NPC] += 4; -// OBSOLETE } -// OBSOLETE sp = (unsigned long *)registers[SP]; -// OBSOLETE -// OBSOLETE tt = (registers[TBR] >> 4) & 0xff; -// OBSOLETE -// OBSOLETE /* reply to host that an exception has occurred */ -// OBSOLETE sigval = computeSignal(tt); -// OBSOLETE ptr = remcomOutBuffer; -// OBSOLETE -// OBSOLETE *ptr++ = 'T'; -// OBSOLETE *ptr++ = hexchars[sigval >> 4]; -// OBSOLETE *ptr++ = hexchars[sigval & 0xf]; -// OBSOLETE -// OBSOLETE *ptr++ = hexchars[PC >> 4]; -// OBSOLETE *ptr++ = hexchars[PC & 0xf]; -// OBSOLETE *ptr++ = ':'; -// OBSOLETE ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); -// OBSOLETE *ptr++ = ';'; -// OBSOLETE -// OBSOLETE *ptr++ = hexchars[FP >> 4]; -// OBSOLETE *ptr++ = hexchars[FP & 0xf]; -// OBSOLETE *ptr++ = ':'; -// OBSOLETE ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */ -// OBSOLETE *ptr++ = ';'; -// OBSOLETE -// OBSOLETE *ptr++ = hexchars[SP >> 4]; -// OBSOLETE *ptr++ = hexchars[SP & 0xf]; -// OBSOLETE *ptr++ = ':'; -// OBSOLETE ptr = mem2hex((char *)&sp, ptr, 4, 0); -// OBSOLETE *ptr++ = ';'; -// OBSOLETE -// OBSOLETE *ptr++ = hexchars[NPC >> 4]; -// OBSOLETE *ptr++ = hexchars[NPC & 0xf]; -// OBSOLETE *ptr++ = ':'; -// OBSOLETE ptr = mem2hex((char *)®isters[NPC], ptr, 4, 0); -// OBSOLETE *ptr++ = ';'; -// OBSOLETE -// OBSOLETE *ptr++ = hexchars[O7 >> 4]; -// OBSOLETE *ptr++ = hexchars[O7 & 0xf]; -// OBSOLETE *ptr++ = ':'; -// OBSOLETE ptr = mem2hex((char *)®isters[O7], ptr, 4, 0); -// OBSOLETE *ptr++ = ';'; -// OBSOLETE -// OBSOLETE *ptr++ = 0; -// OBSOLETE -// OBSOLETE putpacket(remcomOutBuffer); -// OBSOLETE -// OBSOLETE while (1) -// OBSOLETE { -// OBSOLETE remcomOutBuffer[0] = 0; -// OBSOLETE -// OBSOLETE ptr = getpacket(); -// OBSOLETE switch (*ptr++) -// OBSOLETE { -// OBSOLETE case '?': -// OBSOLETE remcomOutBuffer[0] = 'S'; -// OBSOLETE remcomOutBuffer[1] = hexchars[sigval >> 4]; -// OBSOLETE remcomOutBuffer[2] = hexchars[sigval & 0xf]; -// OBSOLETE remcomOutBuffer[3] = 0; -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case 'd': -// OBSOLETE remote_debug = !(remote_debug); /* toggle debug flag */ -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case 'g': /* return the value of the CPU registers */ -// OBSOLETE { -// OBSOLETE ptr = remcomOutBuffer; -// OBSOLETE ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */ -// OBSOLETE ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */ -// OBSOLETE memset(ptr, '0', 32 * 8); /* Floating point */ -// OBSOLETE ptr = mem2hex((char *)®isters[Y], -// OBSOLETE ptr + 32 * 4 * 2, -// OBSOLETE 8 * 4, -// OBSOLETE 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ -// OBSOLETE ptr = mem2hex((char *)®isters[CCSR], -// OBSOLETE ptr, -// OBSOLETE 8 * 4, -// OBSOLETE 0); /* CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR */ -// OBSOLETE ptr = mem2hex((char *)®isters[ASR1], -// OBSOLETE ptr, -// OBSOLETE 8 * 4, -// OBSOLETE 0); /* ASR1,ASR15,ASR17,ASR18,ASR19,ASR20,ASR21,ASR22 */ -// OBSOLETE #if 0 /* not implemented */ -// OBSOLETE ptr = mem2hex((char *) ®isters[AWR0], -// OBSOLETE ptr, -// OBSOLETE 32 * 4, -// OBSOLETE 0); /* Alternate Window Registers */ -// OBSOLETE #endif -// OBSOLETE } -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case 'G': /* set value of all the CPU registers - return OK */ -// OBSOLETE case 'P': /* set value of one CPU register - return OK */ -// OBSOLETE { -// OBSOLETE unsigned long *newsp, psr; -// OBSOLETE -// OBSOLETE psr = registers[PSR]; -// OBSOLETE -// OBSOLETE if (ptr[-1] == 'P') /* do a single register */ -// OBSOLETE { -// OBSOLETE int regno; -// OBSOLETE -// OBSOLETE if (hexToInt (&ptr, ®no) -// OBSOLETE && *ptr++ == '=') -// OBSOLETE if (regno >= L0 && regno <= I7) -// OBSOLETE hex2mem (ptr, sp + regno - L0, 4, 0); -// OBSOLETE else -// OBSOLETE hex2mem (ptr, (char *)®isters[regno], 4, 0); -// OBSOLETE else -// OBSOLETE { -// OBSOLETE strcpy (remcomOutBuffer, "E01"); -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */ -// OBSOLETE hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */ -// OBSOLETE hex2mem(ptr + 64 * 4 * 2, (char *)®isters[Y], -// OBSOLETE 8 * 4, 0); /* Y,PSR,WIM,TBR,PC,NPC,FPSR,CPSR */ -// OBSOLETE hex2mem(ptr + 72 * 4 * 2, (char *)®isters[CCSR], -// OBSOLETE 8 * 4, 0); /* CCSR,CCPR,CCCRCR,CCOR,CCOBR,CCIBR,CCIR */ -// OBSOLETE hex2mem(ptr + 80 * 4 * 2, (char *)®isters[ASR1], -// OBSOLETE 8 * 4, 0); /* ASR1 ... ASR22 */ -// OBSOLETE #if 0 /* not implemented */ -// OBSOLETE hex2mem(ptr + 88 * 4 * 2, (char *)®isters[AWR0], -// OBSOLETE 8 * 4, 0); /* Alternate Window Registers */ -// OBSOLETE #endif -// OBSOLETE } -// OBSOLETE /* See if the stack pointer has moved. If so, then copy the saved -// OBSOLETE locals and ins to the new location. This keeps the window -// OBSOLETE overflow and underflow routines happy. */ -// OBSOLETE -// OBSOLETE newsp = (unsigned long *)registers[SP]; -// OBSOLETE if (sp != newsp) -// OBSOLETE sp = memcpy(newsp, sp, 16 * 4); -// OBSOLETE -// OBSOLETE /* Don't allow CWP to be modified. */ -// OBSOLETE -// OBSOLETE if (psr != registers[PSR]) -// OBSOLETE registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); -// OBSOLETE -// OBSOLETE strcpy(remcomOutBuffer,"OK"); -// OBSOLETE } -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ -// OBSOLETE /* Try to read %x,%x. */ -// OBSOLETE -// OBSOLETE if (hexToInt(&ptr, &addr) -// OBSOLETE && *ptr++ == ',' -// OBSOLETE && hexToInt(&ptr, &length)) -// OBSOLETE { -// OBSOLETE if (mem2hex((char *)addr, remcomOutBuffer, length, 1)) -// OBSOLETE break; -// OBSOLETE -// OBSOLETE strcpy (remcomOutBuffer, "E03"); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE strcpy(remcomOutBuffer,"E01"); -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ -// OBSOLETE /* Try to read '%x,%x:'. */ -// OBSOLETE -// OBSOLETE if (hexToInt(&ptr, &addr) -// OBSOLETE && *ptr++ == ',' -// OBSOLETE && hexToInt(&ptr, &length) -// OBSOLETE && *ptr++ == ':') -// OBSOLETE { -// OBSOLETE if (hex2mem(ptr, (char *)addr, length, 1)) -// OBSOLETE strcpy(remcomOutBuffer, "OK"); -// OBSOLETE else -// OBSOLETE strcpy(remcomOutBuffer, "E03"); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE strcpy(remcomOutBuffer, "E02"); -// OBSOLETE break; -// OBSOLETE -// OBSOLETE case 'c': /* cAA..AA Continue at address AA..AA(optional) */ -// OBSOLETE /* try to read optional parameter, pc unchanged if no parm */ -// OBSOLETE -// OBSOLETE if (hexToInt(&ptr, &addr)) -// OBSOLETE { -// OBSOLETE registers[PC] = addr; -// OBSOLETE registers[NPC] = addr + 4; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Need to flush the instruction cache here, as we may have deposited a -// OBSOLETE breakpoint, and the icache probably has no way of knowing that a data ref to -// OBSOLETE some location may have changed something that is in the instruction cache. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE flush_i_cache(); -// OBSOLETE return; -// OBSOLETE -// OBSOLETE /* kill the program */ -// OBSOLETE case 'k' : /* do nothing */ -// OBSOLETE break; -// OBSOLETE #if 0 -// OBSOLETE case 't': /* Test feature */ -// OBSOLETE asm (" std %f30,[%sp]"); -// OBSOLETE break; -// OBSOLETE #endif -// OBSOLETE case 'r': /* Reset */ -// OBSOLETE asm ("call 0 -// OBSOLETE nop "); -// OBSOLETE break; -// OBSOLETE } /* switch */ -// OBSOLETE -// OBSOLETE /* reply to the request */ -// OBSOLETE putpacket(remcomOutBuffer); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* This function will generate a breakpoint exception. It is used at the -// OBSOLETE beginning of a program to sync up with a debugger and can be used -// OBSOLETE otherwise as a quick means to stop program execution and "break" into -// OBSOLETE the debugger. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE breakpoint (void) -// OBSOLETE { -// OBSOLETE if (!initialized) -// OBSOLETE return; -// OBSOLETE -// OBSOLETE asm(" .globl _breakinst -// OBSOLETE -// OBSOLETE _breakinst: ta 1 -// OBSOLETE "); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE hw_breakpoint (void) -// OBSOLETE { -// OBSOLETE asm(" -// OBSOLETE ta 127 -// OBSOLETE "); -// OBSOLETE } -// OBSOLETE -// OBSOLETE #if 0 /* experimental and never finished, left here for reference */ -// OBSOLETE static void -// OBSOLETE splet_temp(void) -// OBSOLETE { -// OBSOLETE asm(" sub %sp,(16+1+6+1+121)*4,%sp ! Make room for input & locals -// OBSOLETE ! + hidden arg + arg spill -// OBSOLETE ! + doubleword alignment -// OBSOLETE ! + registers[121] -// OBSOLETE -// OBSOLETE ! Leave a trail of breadcrumbs! (save register save area for debugging) -// OBSOLETE mov %sp, %l0 -// OBSOLETE add %l0, 24*4, %l0 -// OBSOLETE sethi %hi(_debug_registers), %l1 -// OBSOLETE st %l0, [%lo(_debug_registers) + %l1] -// OBSOLETE -// OBSOLETE ! Save the Alternate Register Set: (not implemented yet) -// OBSOLETE ! To save the Alternate Register set, we must: -// OBSOLETE ! 1) Save the current SP in some global location. -// OBSOLETE ! 2) Swap the register sets. -// OBSOLETE ! 3) Save the Alternate SP in the Y register -// OBSOLETE ! 4) Fetch the SP that we saved in step 1. -// OBSOLETE ! 5) Use that to save the rest of the regs (not forgetting ASP in Y) -// OBSOLETE ! 6) Restore the Alternate SP from Y -// OBSOLETE ! 7) Swap the registers back. -// OBSOLETE -// OBSOLETE ! 1) Copy the current stack pointer to global _SAVED_STACK_POINTER: -// OBSOLETE sethi %hi(_saved_stack_pointer), %l0 -// OBSOLETE st %sp, [%lo(_saved_stack_pointer) + %l0] -// OBSOLETE -// OBSOLETE ! 2) Swap the register sets: -// OBSOLETE mov %psr, %l1 -// OBSOLETE sethi %hi(0x10000), %l2 -// OBSOLETE xor %l1, %l2, %l1 -// OBSOLETE mov %l1, %psr -// OBSOLETE nop ! 3 nops after write to %psr (needed?) -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE -// OBSOLETE ! 3) Save Alternate L0 in Y -// OBSOLETE wr %l0, 0, %y -// OBSOLETE -// OBSOLETE ! 4) Load former SP into alternate SP, using L0 -// OBSOLETE sethi %hi(_saved_stack_pointer), %l0 -// OBSOLETE or %lo(_saved_stack_pointer), %l0, %l0 -// OBSOLETE swap [%l0], %sp -// OBSOLETE -// OBSOLETE ! 4.5) Restore alternate L0 -// OBSOLETE rd %y, %l0 -// OBSOLETE -// OBSOLETE ! 5) Save the Alternate Window Registers -// OBSOLETE st %r0, [%sp + (24 + 88) * 4] ! AWR0 -// OBSOLETE st %r1, [%sp + (24 + 89) * 4] ! AWR1 -// OBSOLETE st %r2, [%sp + (24 + 90) * 4] ! AWR2 -// OBSOLETE st %r3, [%sp + (24 + 91) * 4] ! AWR3 -// OBSOLETE st %r4, [%sp + (24 + 92) * 4] ! AWR4 -// OBSOLETE st %r5, [%sp + (24 + 93) * 4] ! AWR5 -// OBSOLETE st %r6, [%sp + (24 + 94) * 4] ! AWR6 -// OBSOLETE st %r7, [%sp + (24 + 95) * 4] ! AWR7 -// OBSOLETE st %r8, [%sp + (24 + 96) * 4] ! AWR8 -// OBSOLETE st %r9, [%sp + (24 + 97) * 4] ! AWR9 -// OBSOLETE st %r10, [%sp + (24 + 98) * 4] ! AWR10 -// OBSOLETE st %r11, [%sp + (24 + 99) * 4] ! AWR11 -// OBSOLETE st %r12, [%sp + (24 + 100) * 4] ! AWR12 -// OBSOLETE st %r13, [%sp + (24 + 101) * 4] ! AWR13 -// OBSOLETE ! st %r14, [%sp + (24 + 102) * 4] ! AWR14 (SP) -// OBSOLETE st %r15, [%sp + (24 + 103) * 4] ! AWR15 -// OBSOLETE st %r16, [%sp + (24 + 104) * 4] ! AWR16 -// OBSOLETE st %r17, [%sp + (24 + 105) * 4] ! AWR17 -// OBSOLETE st %r18, [%sp + (24 + 106) * 4] ! AWR18 -// OBSOLETE st %r19, [%sp + (24 + 107) * 4] ! AWR19 -// OBSOLETE st %r20, [%sp + (24 + 108) * 4] ! AWR20 -// OBSOLETE st %r21, [%sp + (24 + 109) * 4] ! AWR21 -// OBSOLETE st %r22, [%sp + (24 + 110) * 4] ! AWR22 -// OBSOLETE st %r23, [%sp + (24 + 111) * 4] ! AWR23 -// OBSOLETE st %r24, [%sp + (24 + 112) * 4] ! AWR24 -// OBSOLETE st %r25, [%sp + (24 + 113) * 4] ! AWR25 -// OBSOLETE st %r26, [%sp + (24 + 114) * 4] ! AWR26 -// OBSOLETE st %r27, [%sp + (24 + 115) * 4] ! AWR27 -// OBSOLETE st %r28, [%sp + (24 + 116) * 4] ! AWR28 -// OBSOLETE st %r29, [%sp + (24 + 117) * 4] ! AWR29 -// OBSOLETE st %r30, [%sp + (24 + 118) * 4] ! AWR30 -// OBSOLETE st %r31, [%sp + (24 + 119) * 4] ! AWR21 -// OBSOLETE -// OBSOLETE ! Get the Alternate PSR (I hope...) -// OBSOLETE -// OBSOLETE rd %psr, %l2 -// OBSOLETE st %l2, [%sp + (24 + 120) * 4] ! APSR -// OBSOLETE -// OBSOLETE ! Don't forget the alternate stack pointer -// OBSOLETE -// OBSOLETE rd %y, %l3 -// OBSOLETE st %l3, [%sp + (24 + 102) * 4] ! AWR14 (SP) -// OBSOLETE -// OBSOLETE ! 6) Restore the Alternate SP (saved in Y) -// OBSOLETE -// OBSOLETE rd %y, %o6 -// OBSOLETE -// OBSOLETE -// OBSOLETE ! 7) Swap the registers back: -// OBSOLETE -// OBSOLETE mov %psr, %l1 -// OBSOLETE sethi %hi(0x10000), %l2 -// OBSOLETE xor %l1, %l2, %l1 -// OBSOLETE mov %l1, %psr -// OBSOLETE nop ! 3 nops after write to %psr (needed?) -// OBSOLETE nop -// OBSOLETE nop -// OBSOLETE "); -// OBSOLETE } -// OBSOLETE -// OBSOLETE #endif diff --git a/gdb/symm-nat.c b/gdb/symm-nat.c deleted file mode 100644 index c4b2c9a..0000000 --- a/gdb/symm-nat.c +++ /dev/null @@ -1,902 +0,0 @@ -// OBSOLETE /* Sequent Symmetry host interface, for GDB when running under Unix. -// OBSOLETE -// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1999, -// OBSOLETE 2000, 2001, 2003 Free Software Foundation, Inc. -// OBSOLETE -// OBSOLETE This file is part of GDB. -// OBSOLETE -// OBSOLETE This program is free software; you can redistribute it and/or modify -// OBSOLETE it under the terms of the GNU General Public License as published by -// OBSOLETE the Free Software Foundation; either version 2 of the License, or -// OBSOLETE (at your option) any later version. -// OBSOLETE -// OBSOLETE This program is distributed in the hope that it will be useful, -// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of -// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// OBSOLETE GNU General Public License for more details. -// OBSOLETE -// OBSOLETE You should have received a copy of the GNU General Public License -// OBSOLETE along with this program; if not, write to the Free Software -// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, -// OBSOLETE Boston, MA 02111-1307, USA. */ -// OBSOLETE -// OBSOLETE /* FIXME, some 387-specific items of use taken from i387-tdep.c -- ought to be -// OBSOLETE merged back in. */ -// OBSOLETE -// OBSOLETE #include "defs.h" -// OBSOLETE #include "frame.h" -// OBSOLETE #include "inferior.h" -// OBSOLETE #include "symtab.h" -// OBSOLETE #include "target.h" -// OBSOLETE #include "regcache.h" -// OBSOLETE -// OBSOLETE /* FIXME: What is the _INKERNEL define for? */ -// OBSOLETE #define _INKERNEL -// OBSOLETE #include -// OBSOLETE #undef _INKERNEL -// OBSOLETE #include "gdb_wait.h" -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include "gdb_stat.h" -// OBSOLETE #ifdef _SEQUENT_ -// OBSOLETE #include -// OBSOLETE #else -// OBSOLETE /* Dynix has only machine/ptrace.h, which is already included by sys/user.h */ -// OBSOLETE /* Dynix has no mptrace call */ -// OBSOLETE #define mptrace ptrace -// OBSOLETE #endif -// OBSOLETE #include "gdbcore.h" -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #define TERMINAL struct sgttyb -// OBSOLETE -// OBSOLETE #include "gdbcore.h" -// OBSOLETE -// OBSOLETE void -// OBSOLETE store_inferior_registers (int regno) -// OBSOLETE { -// OBSOLETE struct pt_regset regs; -// OBSOLETE int i; -// OBSOLETE -// OBSOLETE /* FIXME: Fetching the registers is a kludge to initialize all elements -// OBSOLETE in the fpu and fpa status. This works for normal debugging, but -// OBSOLETE might cause problems when calling functions in the inferior. -// OBSOLETE At least fpu_control and fpa_pcr (probably more) should be added -// OBSOLETE to the registers array to solve this properly. */ -// OBSOLETE mptrace (XPT_RREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0); -// OBSOLETE -// OBSOLETE regs.pr_eax = *(int *) &deprecated_registers[REGISTER_BYTE (0)]; -// OBSOLETE regs.pr_ebx = *(int *) &deprecated_registers[REGISTER_BYTE (5)]; -// OBSOLETE regs.pr_ecx = *(int *) &deprecated_registers[REGISTER_BYTE (2)]; -// OBSOLETE regs.pr_edx = *(int *) &deprecated_registers[REGISTER_BYTE (1)]; -// OBSOLETE regs.pr_esi = *(int *) &deprecated_registers[REGISTER_BYTE (6)]; -// OBSOLETE regs.pr_edi = *(int *) &deprecated_registers[REGISTER_BYTE (7)]; -// OBSOLETE regs.pr_esp = *(int *) &deprecated_registers[REGISTER_BYTE (14)]; -// OBSOLETE regs.pr_ebp = *(int *) &deprecated_registers[REGISTER_BYTE (15)]; -// OBSOLETE regs.pr_eip = *(int *) &deprecated_registers[REGISTER_BYTE (16)]; -// OBSOLETE regs.pr_flags = *(int *) &deprecated_registers[REGISTER_BYTE (17)]; -// OBSOLETE for (i = 0; i < 31; i++) -// OBSOLETE { -// OBSOLETE regs.pr_fpa.fpa_regs[i] = -// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (FP1_REGNUM + i)]; -// OBSOLETE } -// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[0], &deprecated_registers[REGISTER_BYTE (ST0_REGNUM)], 10); -// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[1], &deprecated_registers[REGISTER_BYTE (ST1_REGNUM)], 10); -// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[2], &deprecated_registers[REGISTER_BYTE (ST2_REGNUM)], 10); -// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[3], &deprecated_registers[REGISTER_BYTE (ST3_REGNUM)], 10); -// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[4], &deprecated_registers[REGISTER_BYTE (ST4_REGNUM)], 10); -// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[5], &deprecated_registers[REGISTER_BYTE (ST5_REGNUM)], 10); -// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[6], &deprecated_registers[REGISTER_BYTE (ST6_REGNUM)], 10); -// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[7], &deprecated_registers[REGISTER_BYTE (ST7_REGNUM)], 10); -// OBSOLETE mptrace (XPT_WREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE fetch_inferior_registers (int regno) -// OBSOLETE { -// OBSOLETE int i; -// OBSOLETE struct pt_regset regs; -// OBSOLETE -// OBSOLETE deprecated_registers_fetched (); -// OBSOLETE -// OBSOLETE mptrace (XPT_RREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0); -// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EAX_REGNUM)] = regs.pr_eax; -// OBSOLETE *(int *) &rdeprecated_egisters[REGISTER_BYTE (EBX_REGNUM)] = regs.pr_ebx; -// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (ECX_REGNUM)] = regs.pr_ecx; -// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EDX_REGNUM)] = regs.pr_edx; -// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (ESI_REGNUM)] = regs.pr_esi; -// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EDI_REGNUM)] = regs.pr_edi; -// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EBP_REGNUM)] = regs.pr_ebp; -// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (ESP_REGNUM)] = regs.pr_esp; -// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EIP_REGNUM)] = regs.pr_eip; -// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EFLAGS_REGNUM)] = regs.pr_flags; -// OBSOLETE for (i = 0; i < FPA_NREGS; i++) -// OBSOLETE { -// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (FP1_REGNUM + i)] = -// OBSOLETE regs.pr_fpa.fpa_regs[i]; -// OBSOLETE } -// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST0_REGNUM)], regs.pr_fpu.fpu_stack[0], 10); -// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST1_REGNUM)], regs.pr_fpu.fpu_stack[1], 10); -// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST2_REGNUM)], regs.pr_fpu.fpu_stack[2], 10); -// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST3_REGNUM)], regs.pr_fpu.fpu_stack[3], 10); -// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST4_REGNUM)], regs.pr_fpu.fpu_stack[4], 10); -// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST5_REGNUM)], regs.pr_fpu.fpu_stack[5], 10); -// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST6_REGNUM)], regs.pr_fpu.fpu_stack[6], 10); -// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST7_REGNUM)], regs.pr_fpu.fpu_stack[7], 10); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* FIXME: This should be merged with i387-tdep.c as well. */ -// OBSOLETE static -// OBSOLETE print_fpu_status (struct pt_regset ep) -// OBSOLETE { -// OBSOLETE int i; -// OBSOLETE int bothstatus; -// OBSOLETE int top; -// OBSOLETE int fpreg; -// OBSOLETE unsigned char *p; -// OBSOLETE -// OBSOLETE printf_unfiltered ("80387:"); -// OBSOLETE if (ep.pr_fpu.fpu_ip == 0) -// OBSOLETE { -// OBSOLETE printf_unfiltered (" not in use.\n"); -// OBSOLETE return; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE printf_unfiltered ("\n"); -// OBSOLETE } -// OBSOLETE if (ep.pr_fpu.fpu_status != 0) -// OBSOLETE { -// OBSOLETE print_387_status_word (ep.pr_fpu.fpu_status); -// OBSOLETE } -// OBSOLETE print_387_control_word (ep.pr_fpu.fpu_control); -// OBSOLETE printf_unfiltered ("last exception: "); -// OBSOLETE printf_unfiltered ("opcode 0x%x; ", ep.pr_fpu.fpu_rsvd4); -// OBSOLETE printf_unfiltered ("pc 0x%x:0x%x; ", ep.pr_fpu.fpu_cs, ep.pr_fpu.fpu_ip); -// OBSOLETE printf_unfiltered ("operand 0x%x:0x%x\n", ep.pr_fpu.fpu_data_offset, ep.pr_fpu.fpu_op_sel); -// OBSOLETE -// OBSOLETE top = (ep.pr_fpu.fpu_status >> 11) & 7; -// OBSOLETE -// OBSOLETE printf_unfiltered ("regno tag msb lsb value\n"); -// OBSOLETE for (fpreg = 7; fpreg >= 0; fpreg--) -// OBSOLETE { -// OBSOLETE double val; -// OBSOLETE -// OBSOLETE printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg); -// OBSOLETE -// OBSOLETE switch ((ep.pr_fpu.fpu_tag >> (fpreg * 2)) & 3) -// OBSOLETE { -// OBSOLETE case 0: -// OBSOLETE printf_unfiltered ("valid "); -// OBSOLETE break; -// OBSOLETE case 1: -// OBSOLETE printf_unfiltered ("zero "); -// OBSOLETE break; -// OBSOLETE case 2: -// OBSOLETE printf_unfiltered ("trap "); -// OBSOLETE break; -// OBSOLETE case 3: -// OBSOLETE printf_unfiltered ("empty "); -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE for (i = 9; i >= 0; i--) -// OBSOLETE printf_unfiltered ("%02x", ep.pr_fpu.fpu_stack[fpreg][i]); -// OBSOLETE -// OBSOLETE i387_to_double ((char *) ep.pr_fpu.fpu_stack[fpreg], (char *) &val); -// OBSOLETE printf_unfiltered (" %g\n", val); -// OBSOLETE } -// OBSOLETE if (ep.pr_fpu.fpu_rsvd1) -// OBSOLETE warning ("rsvd1 is 0x%x\n", ep.pr_fpu.fpu_rsvd1); -// OBSOLETE if (ep.pr_fpu.fpu_rsvd2) -// OBSOLETE warning ("rsvd2 is 0x%x\n", ep.pr_fpu.fpu_rsvd2); -// OBSOLETE if (ep.pr_fpu.fpu_rsvd3) -// OBSOLETE warning ("rsvd3 is 0x%x\n", ep.pr_fpu.fpu_rsvd3); -// OBSOLETE if (ep.pr_fpu.fpu_rsvd5) -// OBSOLETE warning ("rsvd5 is 0x%x\n", ep.pr_fpu.fpu_rsvd5); -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE print_1167_control_word (unsigned int pcr) -// OBSOLETE { -// OBSOLETE int pcr_tmp; -// OBSOLETE -// OBSOLETE pcr_tmp = pcr & FPA_PCR_MODE; -// OBSOLETE printf_unfiltered ("\tMODE= %#x; RND= %#x ", pcr_tmp, pcr_tmp & 12); -// OBSOLETE switch (pcr_tmp & 12) -// OBSOLETE { -// OBSOLETE case 0: -// OBSOLETE printf_unfiltered ("RN (Nearest Value)"); -// OBSOLETE break; -// OBSOLETE case 1: -// OBSOLETE printf_unfiltered ("RZ (Zero)"); -// OBSOLETE break; -// OBSOLETE case 2: -// OBSOLETE printf_unfiltered ("RP (Positive Infinity)"); -// OBSOLETE break; -// OBSOLETE case 3: -// OBSOLETE printf_unfiltered ("RM (Negative Infinity)"); -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE printf_unfiltered ("; IRND= %d ", pcr_tmp & 2); -// OBSOLETE if (0 == pcr_tmp & 2) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("(same as RND)\n"); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE printf_unfiltered ("(toward zero)\n"); -// OBSOLETE } -// OBSOLETE pcr_tmp = pcr & FPA_PCR_EM; -// OBSOLETE printf_unfiltered ("\tEM= %#x", pcr_tmp); -// OBSOLETE if (pcr_tmp & FPA_PCR_EM_DM) -// OBSOLETE printf_unfiltered (" DM"); -// OBSOLETE if (pcr_tmp & FPA_PCR_EM_UOM) -// OBSOLETE printf_unfiltered (" UOM"); -// OBSOLETE if (pcr_tmp & FPA_PCR_EM_PM) -// OBSOLETE printf_unfiltered (" PM"); -// OBSOLETE if (pcr_tmp & FPA_PCR_EM_UM) -// OBSOLETE printf_unfiltered (" UM"); -// OBSOLETE if (pcr_tmp & FPA_PCR_EM_OM) -// OBSOLETE printf_unfiltered (" OM"); -// OBSOLETE if (pcr_tmp & FPA_PCR_EM_ZM) -// OBSOLETE printf_unfiltered (" ZM"); -// OBSOLETE if (pcr_tmp & FPA_PCR_EM_IM) -// OBSOLETE printf_unfiltered (" IM"); -// OBSOLETE printf_unfiltered ("\n"); -// OBSOLETE pcr_tmp = FPA_PCR_CC; -// OBSOLETE printf_unfiltered ("\tCC= %#x", pcr_tmp); -// OBSOLETE if (pcr_tmp & FPA_PCR_20MHZ) -// OBSOLETE printf_unfiltered (" 20MHZ"); -// OBSOLETE if (pcr_tmp & FPA_PCR_CC_Z) -// OBSOLETE printf_unfiltered (" Z"); -// OBSOLETE if (pcr_tmp & FPA_PCR_CC_C2) -// OBSOLETE printf_unfiltered (" C2"); -// OBSOLETE -// OBSOLETE /* Dynix defines FPA_PCR_CC_C0 to 0x100 and ptx defines -// OBSOLETE FPA_PCR_CC_C1 to 0x100. Use whichever is defined and assume -// OBSOLETE the OS knows what it is doing. */ -// OBSOLETE #ifdef FPA_PCR_CC_C1 -// OBSOLETE if (pcr_tmp & FPA_PCR_CC_C1) -// OBSOLETE printf_unfiltered (" C1"); -// OBSOLETE #else -// OBSOLETE if (pcr_tmp & FPA_PCR_CC_C0) -// OBSOLETE printf_unfiltered (" C0"); -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE switch (pcr_tmp) -// OBSOLETE { -// OBSOLETE case FPA_PCR_CC_Z: -// OBSOLETE printf_unfiltered (" (Equal)"); -// OBSOLETE break; -// OBSOLETE #ifdef FPA_PCR_CC_C1 -// OBSOLETE case FPA_PCR_CC_C1: -// OBSOLETE #else -// OBSOLETE case FPA_PCR_CC_C0: -// OBSOLETE #endif -// OBSOLETE printf_unfiltered (" (Less than)"); -// OBSOLETE break; -// OBSOLETE case 0: -// OBSOLETE printf_unfiltered (" (Greater than)"); -// OBSOLETE break; -// OBSOLETE case FPA_PCR_CC_Z | -// OBSOLETE #ifdef FPA_PCR_CC_C1 -// OBSOLETE FPA_PCR_CC_C1 -// OBSOLETE #else -// OBSOLETE FPA_PCR_CC_C0 -// OBSOLETE #endif -// OBSOLETE | FPA_PCR_CC_C2: -// OBSOLETE printf_unfiltered (" (Unordered)"); -// OBSOLETE break; -// OBSOLETE default: -// OBSOLETE printf_unfiltered (" (Undefined)"); -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE printf_unfiltered ("\n"); -// OBSOLETE pcr_tmp = pcr & FPA_PCR_AE; -// OBSOLETE printf_unfiltered ("\tAE= %#x", pcr_tmp); -// OBSOLETE if (pcr_tmp & FPA_PCR_AE_DE) -// OBSOLETE printf_unfiltered (" DE"); -// OBSOLETE if (pcr_tmp & FPA_PCR_AE_UOE) -// OBSOLETE printf_unfiltered (" UOE"); -// OBSOLETE if (pcr_tmp & FPA_PCR_AE_PE) -// OBSOLETE printf_unfiltered (" PE"); -// OBSOLETE if (pcr_tmp & FPA_PCR_AE_UE) -// OBSOLETE printf_unfiltered (" UE"); -// OBSOLETE if (pcr_tmp & FPA_PCR_AE_OE) -// OBSOLETE printf_unfiltered (" OE"); -// OBSOLETE if (pcr_tmp & FPA_PCR_AE_ZE) -// OBSOLETE printf_unfiltered (" ZE"); -// OBSOLETE if (pcr_tmp & FPA_PCR_AE_EE) -// OBSOLETE printf_unfiltered (" EE"); -// OBSOLETE if (pcr_tmp & FPA_PCR_AE_IE) -// OBSOLETE printf_unfiltered (" IE"); -// OBSOLETE printf_unfiltered ("\n"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE print_1167_regs (long regs[FPA_NREGS]) -// OBSOLETE { -// OBSOLETE int i; -// OBSOLETE -// OBSOLETE union -// OBSOLETE { -// OBSOLETE double d; -// OBSOLETE long l[2]; -// OBSOLETE } -// OBSOLETE xd; -// OBSOLETE union -// OBSOLETE { -// OBSOLETE float f; -// OBSOLETE long l; -// OBSOLETE } -// OBSOLETE xf; -// OBSOLETE -// OBSOLETE -// OBSOLETE for (i = 0; i < FPA_NREGS; i++) -// OBSOLETE { -// OBSOLETE xf.l = regs[i]; -// OBSOLETE printf_unfiltered ("%%fp%d: raw= %#x, single= %f", i + 1, regs[i], xf.f); -// OBSOLETE if (!(i & 1)) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("\n"); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE xd.l[1] = regs[i]; -// OBSOLETE xd.l[0] = regs[i + 1]; -// OBSOLETE printf_unfiltered (", double= %f\n", xd.d); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE print_fpa_status (struct pt_regset ep) -// OBSOLETE { -// OBSOLETE -// OBSOLETE printf_unfiltered ("WTL 1167:"); -// OBSOLETE if (ep.pr_fpa.fpa_pcr != 0) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("\n"); -// OBSOLETE print_1167_control_word (ep.pr_fpa.fpa_pcr); -// OBSOLETE print_1167_regs (ep.pr_fpa.fpa_regs); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE printf_unfiltered (" not in use.\n"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE #if 0 /* disabled because it doesn't go through the target vector. */ -// OBSOLETE i386_float_info (void) -// OBSOLETE { -// OBSOLETE char ubuf[UPAGES * NBPG]; -// OBSOLETE struct pt_regset regset; -// OBSOLETE -// OBSOLETE if (have_inferior_p ()) -// OBSOLETE { -// OBSOLETE PTRACE_READ_REGS (PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regset); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE int corechan = bfd_cache_lookup (core_bfd); -// OBSOLETE if (lseek (corechan, 0, 0) < 0) -// OBSOLETE { -// OBSOLETE perror ("seek on core file"); -// OBSOLETE } -// OBSOLETE if (myread (corechan, ubuf, UPAGES * NBPG) < 0) -// OBSOLETE { -// OBSOLETE perror ("read on core file"); -// OBSOLETE } -// OBSOLETE /* only interested in the floating point registers */ -// OBSOLETE regset.pr_fpu = ((struct user *) ubuf)->u_fpusave; -// OBSOLETE regset.pr_fpa = ((struct user *) ubuf)->u_fpasave; -// OBSOLETE } -// OBSOLETE print_fpu_status (regset); -// OBSOLETE print_fpa_status (regset); -// OBSOLETE } -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE static volatile int got_sigchld; -// OBSOLETE -// OBSOLETE /*ARGSUSED */ -// OBSOLETE /* This will eventually be more interesting. */ -// OBSOLETE void -// OBSOLETE sigchld_handler (int signo) -// OBSOLETE { -// OBSOLETE got_sigchld++; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Signals for which the default action does not cause the process -// OBSOLETE * to die. See for where this came from (alas, we -// OBSOLETE * can't use those macros directly) -// OBSOLETE */ -// OBSOLETE #ifndef sigmask -// OBSOLETE #define sigmask(s) (1 << ((s) - 1)) -// OBSOLETE #endif -// OBSOLETE #define SIGNALS_DFL_SAFE sigmask(SIGSTOP) | sigmask(SIGTSTP) | \ -// OBSOLETE sigmask(SIGTTIN) | sigmask(SIGTTOU) | sigmask(SIGCHLD) | \ -// OBSOLETE sigmask(SIGCONT) | sigmask(SIGWINCH) | sigmask(SIGPWR) | \ -// OBSOLETE sigmask(SIGURG) | sigmask(SIGPOLL) -// OBSOLETE -// OBSOLETE #ifdef ATTACH_DETACH -// OBSOLETE /* -// OBSOLETE * Thanks to XPT_MPDEBUGGER, we have to mange child_wait(). -// OBSOLETE */ -// OBSOLETE ptid_t -// OBSOLETE child_wait (ptid_t ptid, struct target_waitstatus *status) -// OBSOLETE { -// OBSOLETE int save_errno, rv, xvaloff, saoff, sa_hand; -// OBSOLETE struct pt_stop pt; -// OBSOLETE struct user u; -// OBSOLETE sigset_t set; -// OBSOLETE /* Host signal number for a signal which the inferior terminates with, or -// OBSOLETE 0 if it hasn't terminated due to a signal. */ -// OBSOLETE static int death_by_signal = 0; -// OBSOLETE #ifdef SVR4_SHARED_LIBS /* use this to distinguish ptx 2 vs ptx 4 */ -// OBSOLETE prstatus_t pstatus; -// OBSOLETE #endif -// OBSOLETE int pid = PIDGET (ptid); -// OBSOLETE -// OBSOLETE do -// OBSOLETE { -// OBSOLETE set_sigint_trap (); /* Causes SIGINT to be passed on to the -// OBSOLETE attached process. */ -// OBSOLETE save_errno = errno; -// OBSOLETE -// OBSOLETE got_sigchld = 0; -// OBSOLETE -// OBSOLETE sigemptyset (&set); -// OBSOLETE -// OBSOLETE while (got_sigchld == 0) -// OBSOLETE { -// OBSOLETE sigsuspend (&set); -// OBSOLETE } -// OBSOLETE -// OBSOLETE clear_sigint_trap (); -// OBSOLETE -// OBSOLETE rv = mptrace (XPT_STOPSTAT, 0, (char *) &pt, 0); -// OBSOLETE if (-1 == rv) -// OBSOLETE { -// OBSOLETE printf ("XPT_STOPSTAT: errno %d\n", errno); /* DEBUG */ -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE pid = pt.ps_pid; -// OBSOLETE -// OBSOLETE if (pid != PIDGET (inferior_ptid)) -// OBSOLETE { -// OBSOLETE /* NOTE: the mystery fork in csh/tcsh needs to be ignored. -// OBSOLETE * We should not return new children for the initial run -// OBSOLETE * of a process until it has done the exec. -// OBSOLETE */ -// OBSOLETE /* inferior probably forked; send it on its way */ -// OBSOLETE rv = mptrace (XPT_UNDEBUG, pid, 0, 0); -// OBSOLETE if (-1 == rv) -// OBSOLETE { -// OBSOLETE printf ("child_wait: XPT_UNDEBUG: pid %d: %s\n", pid, -// OBSOLETE safe_strerror (errno)); -// OBSOLETE } -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE /* FIXME: Do we deal with fork notification correctly? */ -// OBSOLETE switch (pt.ps_reason) -// OBSOLETE { -// OBSOLETE case PTS_FORK: -// OBSOLETE /* multi proc: treat like PTS_EXEC */ -// OBSOLETE /* -// OBSOLETE * Pretend this didn't happen, since gdb isn't set up -// OBSOLETE * to deal with stops on fork. -// OBSOLETE */ -// OBSOLETE rv = ptrace (PT_CONTSIG, pid, 1, 0); -// OBSOLETE if (-1 == rv) -// OBSOLETE { -// OBSOLETE printf ("PTS_FORK: PT_CONTSIG: error %d\n", errno); -// OBSOLETE } -// OBSOLETE continue; -// OBSOLETE case PTS_EXEC: -// OBSOLETE /* -// OBSOLETE * Pretend this is a SIGTRAP. -// OBSOLETE */ -// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; -// OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP; -// OBSOLETE break; -// OBSOLETE case PTS_EXIT: -// OBSOLETE /* -// OBSOLETE * Note: we stop before the exit actually occurs. Extract -// OBSOLETE * the exit code from the uarea. If we're stopped in the -// OBSOLETE * exit() system call, the exit code will be in -// OBSOLETE * u.u_ap[0]. An exit due to an uncaught signal will have -// OBSOLETE * something else in here, see the comment in the default: -// OBSOLETE * case, below. Finally,let the process exit. -// OBSOLETE */ -// OBSOLETE if (death_by_signal) -// OBSOLETE { -// OBSOLETE status->kind = TARGET_WAITKIND_SIGNALED; -// OBSOLETE status->value.sig = target_signal_from_host (death_by_signal); -// OBSOLETE death_by_signal = 0; -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE xvaloff = (unsigned long) &u.u_ap[0] - (unsigned long) &u; -// OBSOLETE errno = 0; -// OBSOLETE rv = ptrace (PT_RUSER, pid, (char *) xvaloff, 0); -// OBSOLETE status->kind = TARGET_WAITKIND_EXITED; -// OBSOLETE status->value.integer = rv; -// OBSOLETE /* -// OBSOLETE * addr & data to mptrace() don't matter here, since -// OBSOLETE * the process is already dead. -// OBSOLETE */ -// OBSOLETE rv = mptrace (XPT_UNDEBUG, pid, 0, 0); -// OBSOLETE if (-1 == rv) -// OBSOLETE { -// OBSOLETE printf ("child_wait: PTS_EXIT: XPT_UNDEBUG: pid %d error %d\n", pid, -// OBSOLETE errno); -// OBSOLETE } -// OBSOLETE break; -// OBSOLETE case PTS_WATCHPT_HIT: -// OBSOLETE internal_error (__FILE__, __LINE__, -// OBSOLETE "PTS_WATCHPT_HIT\n"); -// OBSOLETE break; -// OBSOLETE default: -// OBSOLETE /* stopped by signal */ -// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; -// OBSOLETE status->value.sig = target_signal_from_host (pt.ps_reason); -// OBSOLETE death_by_signal = 0; -// OBSOLETE -// OBSOLETE if (0 == (SIGNALS_DFL_SAFE & sigmask (pt.ps_reason))) -// OBSOLETE { -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE /* else default action of signal is to die */ -// OBSOLETE #ifdef SVR4_SHARED_LIBS -// OBSOLETE rv = ptrace (PT_GET_PRSTATUS, pid, (char *) &pstatus, 0); -// OBSOLETE if (-1 == rv) -// OBSOLETE error ("child_wait: signal %d PT_GET_PRSTATUS: %s\n", -// OBSOLETE pt.ps_reason, safe_strerror (errno)); -// OBSOLETE if (pstatus.pr_cursig != pt.ps_reason) -// OBSOLETE { -// OBSOLETE printf ("pstatus signal %d, pt signal %d\n", -// OBSOLETE pstatus.pr_cursig, pt.ps_reason); -// OBSOLETE } -// OBSOLETE sa_hand = (int) pstatus.pr_action.sa_handler; -// OBSOLETE #else -// OBSOLETE saoff = (unsigned long) &u.u_sa[0] - (unsigned long) &u; -// OBSOLETE saoff += sizeof (struct sigaction) * (pt.ps_reason - 1); -// OBSOLETE errno = 0; -// OBSOLETE sa_hand = ptrace (PT_RUSER, pid, (char *) saoff, 0); -// OBSOLETE if (errno) -// OBSOLETE error ("child_wait: signal %d: RUSER: %s\n", -// OBSOLETE pt.ps_reason, safe_strerror (errno)); -// OBSOLETE #endif -// OBSOLETE if ((int) SIG_DFL == sa_hand) -// OBSOLETE { -// OBSOLETE /* we will be dying */ -// OBSOLETE death_by_signal = pt.ps_reason; -// OBSOLETE } -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE -// OBSOLETE } -// OBSOLETE while (pid != PIDGET (inferior_ptid)); /* Some other child died or stopped */ -// OBSOLETE -// OBSOLETE return pid_to_ptid (pid); -// OBSOLETE } -// OBSOLETE #else /* !ATTACH_DETACH */ -// OBSOLETE /* -// OBSOLETE * Simple child_wait() based on inftarg.c child_wait() for use until -// OBSOLETE * the MPDEBUGGER child_wait() works properly. This will go away when -// OBSOLETE * that is fixed. -// OBSOLETE */ -// OBSOLETE ptid_t -// OBSOLETE child_wait (ptid_t ptid, struct target_waitstatus *ourstatus) -// OBSOLETE { -// OBSOLETE int save_errno; -// OBSOLETE int status; -// OBSOLETE int pid = PIDGET (ptid); -// OBSOLETE -// OBSOLETE do -// OBSOLETE { -// OBSOLETE pid = wait (&status); -// OBSOLETE save_errno = errno; -// OBSOLETE -// OBSOLETE if (pid == -1) -// OBSOLETE { -// OBSOLETE if (save_errno == EINTR) -// OBSOLETE continue; -// OBSOLETE fprintf (stderr, "Child process unexpectedly missing: %s.\n", -// OBSOLETE safe_strerror (save_errno)); -// OBSOLETE ourstatus->kind = TARGET_WAITKIND_SIGNALLED; -// OBSOLETE ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN; -// OBSOLETE return pid_to_ptid (-1); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE while (pid != PIDGET (inferior_ptid)); /* Some other child died or stopped */ -// OBSOLETE store_waitstatus (ourstatus, status); -// OBSOLETE return pid_to_ptid (pid); -// OBSOLETE } -// OBSOLETE #endif /* ATTACH_DETACH */ -// OBSOLETE -// OBSOLETE -// OBSOLETE -// OBSOLETE /* This function simply calls ptrace with the given arguments. -// OBSOLETE It exists so that all calls to ptrace are isolated in this -// OBSOLETE machine-dependent file. */ -// OBSOLETE int -// OBSOLETE call_ptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data) -// OBSOLETE { -// OBSOLETE return ptrace (request, pid, addr, data); -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE call_mptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data) -// OBSOLETE { -// OBSOLETE return mptrace (request, pid, addr, data); -// OBSOLETE } -// OBSOLETE -// OBSOLETE #if defined (DEBUG_PTRACE) -// OBSOLETE /* For the rest of the file, use an extra level of indirection */ -// OBSOLETE /* This lets us breakpoint usefully on call_ptrace. */ -// OBSOLETE #define ptrace call_ptrace -// OBSOLETE #define mptrace call_mptrace -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE void -// OBSOLETE kill_inferior (void) -// OBSOLETE { -// OBSOLETE if (ptid_equal (inferior_ptid, null_ptid)) -// OBSOLETE return; -// OBSOLETE -// OBSOLETE /* For MPDEBUGGER, don't use PT_KILL, since the child will stop -// OBSOLETE again with a PTS_EXIT. Just hit him with SIGKILL (so he stops) -// OBSOLETE and detach. */ -// OBSOLETE -// OBSOLETE kill (PIDGET (inferior_ptid), SIGKILL); -// OBSOLETE #ifdef ATTACH_DETACH -// OBSOLETE detach (SIGKILL); -// OBSOLETE #else /* ATTACH_DETACH */ -// OBSOLETE ptrace (PT_KILL, PIDGET (inferior_ptid), 0, 0); -// OBSOLETE wait ((int *) NULL); -// OBSOLETE #endif /* ATTACH_DETACH */ -// OBSOLETE target_mourn_inferior (); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Resume execution of the inferior process. -// OBSOLETE If STEP is nonzero, single-step it. -// OBSOLETE If SIGNAL is nonzero, give it that signal. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE child_resume (ptid_t ptid, int step, enum target_signal signal) -// OBSOLETE { -// OBSOLETE int pid = PIDGET (ptid); -// OBSOLETE -// OBSOLETE errno = 0; -// OBSOLETE -// OBSOLETE if (pid == -1) -// OBSOLETE pid = PIDGET (inferior_ptid); -// OBSOLETE -// OBSOLETE /* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where -// OBSOLETE it was. (If GDB wanted it to start some other way, we have already -// OBSOLETE written a new PC value to the child.) -// OBSOLETE -// OBSOLETE If this system does not support PT_SSTEP, a higher level function will -// OBSOLETE have called single_step() to transmute the step request into a -// OBSOLETE continue request (by setting breakpoints on all possible successor -// OBSOLETE instructions), so we don't have to worry about that here. */ -// OBSOLETE -// OBSOLETE if (step) -// OBSOLETE ptrace (PT_SSTEP, pid, (PTRACE_ARG3_TYPE) 1, signal); -// OBSOLETE else -// OBSOLETE ptrace (PT_CONTSIG, pid, (PTRACE_ARG3_TYPE) 1, signal); -// OBSOLETE -// OBSOLETE if (errno) -// OBSOLETE perror_with_name ("ptrace"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE #ifdef ATTACH_DETACH -// OBSOLETE /* Start debugging the process whose number is PID. */ -// OBSOLETE int -// OBSOLETE attach (int pid) -// OBSOLETE { -// OBSOLETE sigset_t set; -// OBSOLETE int rv; -// OBSOLETE -// OBSOLETE rv = mptrace (XPT_DEBUG, pid, 0, 0); -// OBSOLETE if (-1 == rv) -// OBSOLETE { -// OBSOLETE error ("mptrace(XPT_DEBUG): %s", safe_strerror (errno)); -// OBSOLETE } -// OBSOLETE rv = mptrace (XPT_SIGNAL, pid, 0, SIGSTOP); -// OBSOLETE if (-1 == rv) -// OBSOLETE { -// OBSOLETE error ("mptrace(XPT_SIGNAL): %s", safe_strerror (errno)); -// OBSOLETE } -// OBSOLETE attach_flag = 1; -// OBSOLETE return pid; -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE detach (int signo) -// OBSOLETE { -// OBSOLETE int rv; -// OBSOLETE -// OBSOLETE rv = mptrace (XPT_UNDEBUG, PIDGET (inferior_ptid), 1, signo); -// OBSOLETE if (-1 == rv) -// OBSOLETE { -// OBSOLETE error ("mptrace(XPT_UNDEBUG): %s", safe_strerror (errno)); -// OBSOLETE } -// OBSOLETE attach_flag = 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE #endif /* ATTACH_DETACH */ -// OBSOLETE -// OBSOLETE /* Default the type of the ptrace transfer to int. */ -// OBSOLETE #ifndef PTRACE_XFER_TYPE -// OBSOLETE #define PTRACE_XFER_TYPE int -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE -// OBSOLETE /* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory -// OBSOLETE in the NEW_SUN_PTRACE case. -// OBSOLETE It ought to be straightforward. But it appears that writing did -// OBSOLETE not write the data that I specified. I cannot understand where -// OBSOLETE it got the data that it actually did write. */ -// OBSOLETE -// OBSOLETE /* Copy LEN bytes to or from inferior's memory starting at MEMADDR -// OBSOLETE to debugger memory starting at MYADDR. Copy to inferior if -// OBSOLETE WRITE is nonzero. TARGET is ignored. -// OBSOLETE -// OBSOLETE Returns the length copied, which is either the LEN argument or zero. -// OBSOLETE This xfer function does not do partial moves, since child_ops -// OBSOLETE doesn't allow memory operations to cross below us in the target stack -// OBSOLETE anyway. */ -// OBSOLETE -// OBSOLETE int -// OBSOLETE child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, -// OBSOLETE struct mem_attrib *attrib, -// OBSOLETE struct target_ops *target) -// OBSOLETE { -// OBSOLETE register int i; -// OBSOLETE /* Round starting address down to longword boundary. */ -// OBSOLETE register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE); -// OBSOLETE /* Round ending address up; get number of longwords that makes. */ -// OBSOLETE register int count -// OBSOLETE = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1) -// OBSOLETE / sizeof (PTRACE_XFER_TYPE); -// OBSOLETE /* Allocate buffer of that many longwords. */ -// OBSOLETE /* FIXME (alloca): This code, cloned from infptrace.c, is unsafe -// OBSOLETE because it uses alloca to allocate a buffer of arbitrary size. -// OBSOLETE For very large xfers, this could crash GDB's stack. */ -// OBSOLETE register PTRACE_XFER_TYPE *buffer -// OBSOLETE = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE)); -// OBSOLETE -// OBSOLETE if (write) -// OBSOLETE { -// OBSOLETE /* Fill start and end extra bytes of buffer with existing memory data. */ -// OBSOLETE -// OBSOLETE if (addr != memaddr || len < (int) sizeof (PTRACE_XFER_TYPE)) -// OBSOLETE { -// OBSOLETE /* Need part of initial word -- fetch it. */ -// OBSOLETE buffer[0] = ptrace (PT_RTEXT, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr, -// OBSOLETE 0); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (count > 1) /* FIXME, avoid if even boundary */ -// OBSOLETE { -// OBSOLETE buffer[count - 1] -// OBSOLETE = ptrace (PT_RTEXT, PIDGET (inferior_ptid), -// OBSOLETE ((PTRACE_ARG3_TYPE) -// OBSOLETE (addr + (count - 1) * sizeof (PTRACE_XFER_TYPE))), -// OBSOLETE 0); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Copy data to be written over corresponding part of buffer */ -// OBSOLETE -// OBSOLETE memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), -// OBSOLETE myaddr, -// OBSOLETE len); -// OBSOLETE -// OBSOLETE /* Write the entire buffer. */ -// OBSOLETE -// OBSOLETE for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE)) -// OBSOLETE { -// OBSOLETE errno = 0; -// OBSOLETE ptrace (PT_WDATA, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr, -// OBSOLETE buffer[i]); -// OBSOLETE if (errno) -// OBSOLETE { -// OBSOLETE /* Using the appropriate one (I or D) is necessary for -// OBSOLETE Gould NP1, at least. */ -// OBSOLETE errno = 0; -// OBSOLETE ptrace (PT_WTEXT, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr, -// OBSOLETE buffer[i]); -// OBSOLETE } -// OBSOLETE if (errno) -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* Read all the longwords */ -// OBSOLETE for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE)) -// OBSOLETE { -// OBSOLETE errno = 0; -// OBSOLETE buffer[i] = ptrace (PT_RTEXT, PIDGET (inferior_ptid), -// OBSOLETE (PTRACE_ARG3_TYPE) addr, 0); -// OBSOLETE if (errno) -// OBSOLETE return 0; -// OBSOLETE QUIT; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Copy appropriate bytes out of the buffer. */ -// OBSOLETE memcpy (myaddr, -// OBSOLETE (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), -// OBSOLETE len); -// OBSOLETE } -// OBSOLETE return len; -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE void -// OBSOLETE _initialize_symm_nat (void) -// OBSOLETE { -// OBSOLETE #ifdef ATTACH_DETACH -// OBSOLETE /* -// OBSOLETE * the MPDEBUGGER is necessary for process tree debugging and attach -// OBSOLETE * to work, but it alters the behavior of debugged processes, so other -// OBSOLETE * things (at least child_wait()) will have to change to accomodate -// OBSOLETE * that. -// OBSOLETE * -// OBSOLETE * Note that attach is not implemented in dynix 3, and not in ptx -// OBSOLETE * until version 2.1 of the OS. -// OBSOLETE */ -// OBSOLETE int rv; -// OBSOLETE sigset_t set; -// OBSOLETE struct sigaction sact; -// OBSOLETE -// OBSOLETE rv = mptrace (XPT_MPDEBUGGER, 0, 0, 0); -// OBSOLETE if (-1 == rv) -// OBSOLETE { -// OBSOLETE internal_error (__FILE__, __LINE__, -// OBSOLETE "_initialize_symm_nat(): mptrace(XPT_MPDEBUGGER): %s", -// OBSOLETE safe_strerror (errno)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Under MPDEBUGGER, we get SIGCLHD when a traced process does -// OBSOLETE * anything of interest. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE /* -// OBSOLETE * Block SIGCHLD. We leave it blocked all the time, and then -// OBSOLETE * call sigsuspend() in child_wait() to wait for the child -// OBSOLETE * to do something. None of these ought to fail, but check anyway. -// OBSOLETE */ -// OBSOLETE sigemptyset (&set); -// OBSOLETE rv = sigaddset (&set, SIGCHLD); -// OBSOLETE if (-1 == rv) -// OBSOLETE { -// OBSOLETE internal_error (__FILE__, __LINE__, -// OBSOLETE "_initialize_symm_nat(): sigaddset(SIGCHLD): %s", -// OBSOLETE safe_strerror (errno)); -// OBSOLETE } -// OBSOLETE rv = sigprocmask (SIG_BLOCK, &set, (sigset_t *) NULL); -// OBSOLETE if (-1 == rv) -// OBSOLETE { -// OBSOLETE internal_error (__FILE__, __LINE__, -// OBSOLETE "_initialize_symm_nat(): sigprocmask(SIG_BLOCK): %s", -// OBSOLETE safe_strerror (errno)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE sact.sa_handler = sigchld_handler; -// OBSOLETE sigemptyset (&sact.sa_mask); -// OBSOLETE sact.sa_flags = SA_NOCLDWAIT; /* keep the zombies away */ -// OBSOLETE rv = sigaction (SIGCHLD, &sact, (struct sigaction *) NULL); -// OBSOLETE if (-1 == rv) -// OBSOLETE { -// OBSOLETE internal_error (__FILE__, __LINE__, -// OBSOLETE "_initialize_symm_nat(): sigaction(SIGCHLD): %s", -// OBSOLETE safe_strerror (errno)); -// OBSOLETE } -// OBSOLETE #endif -// OBSOLETE } diff --git a/gdb/symm-tdep.c b/gdb/symm-tdep.c deleted file mode 100644 index 21c8436..0000000 --- a/gdb/symm-tdep.c +++ /dev/null @@ -1,102 +0,0 @@ -// OBSOLETE /* Sequent Symmetry target interface, for GDB. -// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2000 -// OBSOLETE Free Software Foundation, Inc. -// OBSOLETE -// OBSOLETE This file is part of GDB. -// OBSOLETE -// OBSOLETE This program is free software; you can redistribute it and/or modify -// OBSOLETE it under the terms of the GNU General Public License as published by -// OBSOLETE the Free Software Foundation; either version 2 of the License, or -// OBSOLETE (at your option) any later version. -// OBSOLETE -// OBSOLETE This program is distributed in the hope that it will be useful, -// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of -// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// OBSOLETE GNU General Public License for more details. -// OBSOLETE -// OBSOLETE You should have received a copy of the GNU General Public License -// OBSOLETE along with this program; if not, write to the Free Software -// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, -// OBSOLETE Boston, MA 02111-1307, USA. */ -// OBSOLETE -// OBSOLETE /* many 387-specific items of use taken from i386-dep.c */ -// OBSOLETE -// OBSOLETE #include "defs.h" -// OBSOLETE #include "frame.h" -// OBSOLETE #include "inferior.h" -// OBSOLETE #include "symtab.h" -// OBSOLETE -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include -// OBSOLETE #include "gdb_stat.h" -// OBSOLETE #include "gdbcore.h" -// OBSOLETE #include -// OBSOLETE -// OBSOLETE void -// OBSOLETE symmetry_extract_return_value (struct type *type, char *regbuf, char *valbuf) -// OBSOLETE { -// OBSOLETE union -// OBSOLETE { -// OBSOLETE double d; -// OBSOLETE int l[2]; -// OBSOLETE } -// OBSOLETE xd; -// OBSOLETE struct minimal_symbol *msymbol; -// OBSOLETE float f; -// OBSOLETE -// OBSOLETE if (TYPE_CODE_FLT == TYPE_CODE (type)) -// OBSOLETE { -// OBSOLETE msymbol = lookup_minimal_symbol ("1167_flt", NULL, NULL); -// OBSOLETE if (msymbol != NULL) -// OBSOLETE { -// OBSOLETE /* found "1167_flt" means 1167, %fp2-%fp3 */ -// OBSOLETE /* float & double; 19= %fp2, 20= %fp3 */ -// OBSOLETE /* no single precision on 1167 */ -// OBSOLETE xd.l[1] = *((int *) ®buf[REGISTER_BYTE (19)]); -// OBSOLETE xd.l[0] = *((int *) ®buf[REGISTER_BYTE (20)]); -// OBSOLETE switch (TYPE_LENGTH (type)) -// OBSOLETE { -// OBSOLETE case 4: -// OBSOLETE /* FIXME: broken for cross-debugging. */ -// OBSOLETE f = (float) xd.d; -// OBSOLETE memcpy (valbuf, &f, TYPE_LENGTH (type)); -// OBSOLETE break; -// OBSOLETE case 8: -// OBSOLETE /* FIXME: broken for cross-debugging. */ -// OBSOLETE memcpy (valbuf, &xd.d, TYPE_LENGTH (type)); -// OBSOLETE break; -// OBSOLETE default: -// OBSOLETE error ("Unknown floating point size"); -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* 387 %st(0), gcc uses this */ -// OBSOLETE i387_to_double (((int *) ®buf[REGISTER_BYTE (3)]), -// OBSOLETE &xd.d); -// OBSOLETE switch (TYPE_LENGTH (type)) -// OBSOLETE { -// OBSOLETE case 4: /* float */ -// OBSOLETE f = (float) xd.d; -// OBSOLETE /* FIXME: broken for cross-debugging. */ -// OBSOLETE memcpy (valbuf, &f, 4); -// OBSOLETE break; -// OBSOLETE case 8: /* double */ -// OBSOLETE /* FIXME: broken for cross-debugging. */ -// OBSOLETE memcpy (valbuf, &xd.d, 8); -// OBSOLETE break; -// OBSOLETE default: -// OBSOLETE error ("Unknown floating point size"); -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE memcpy (valbuf, regbuf, TYPE_LENGTH (type)); -// OBSOLETE } -// OBSOLETE } diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c deleted file mode 100644 index d6d42e3..0000000 --- a/gdb/z8k-tdep.c +++ /dev/null @@ -1,535 +0,0 @@ -// OBSOLETE /* Target-machine dependent code for Zilog Z8000, for GDB. -// OBSOLETE -// OBSOLETE Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -// OBSOLETE 2002, 2003 Free Software Foundation, Inc. -// OBSOLETE -// OBSOLETE This file is part of GDB. -// OBSOLETE -// OBSOLETE This program is free software; you can redistribute it and/or modify -// OBSOLETE it under the terms of the GNU General Public License as published by -// OBSOLETE the Free Software Foundation; either version 2 of the License, or -// OBSOLETE (at your option) any later version. -// OBSOLETE -// OBSOLETE This program is distributed in the hope that it will be useful, -// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of -// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// OBSOLETE GNU General Public License for more details. -// OBSOLETE -// OBSOLETE You should have received a copy of the GNU General Public License -// OBSOLETE along with this program; if not, write to the Free Software -// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, -// OBSOLETE Boston, MA 02111-1307, USA. */ -// OBSOLETE -// OBSOLETE /* -// OBSOLETE Contributed by Steve Chamberlain -// OBSOLETE sac@cygnus.com -// OBSOLETE */ -// OBSOLETE -// OBSOLETE #include "defs.h" -// OBSOLETE #include "frame.h" -// OBSOLETE #include "symtab.h" -// OBSOLETE #include "gdbcmd.h" -// OBSOLETE #include "gdbtypes.h" -// OBSOLETE #include "dis-asm.h" -// OBSOLETE #include "gdbcore.h" -// OBSOLETE #include "regcache.h" -// OBSOLETE -// OBSOLETE #include "value.h" /* For read_register() */ -// OBSOLETE -// OBSOLETE -// OBSOLETE static int read_memory_pointer (CORE_ADDR x); -// OBSOLETE -// OBSOLETE /* Return the saved PC from this frame. -// OBSOLETE -// OBSOLETE If the frame has a memory copy of SRP_REGNUM, use that. If not, -// OBSOLETE just use the register SRP_REGNUM itself. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE z8k_frame_saved_pc (struct frame_info *frame) -// OBSOLETE { -// OBSOLETE return read_memory_pointer (frame->frame + (BIG ? 4 : 2)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE #define IS_PUSHL(x) (BIG ? ((x & 0xfff0) == 0x91e0):((x & 0xfff0) == 0x91F0)) -// OBSOLETE #define IS_PUSHW(x) (BIG ? ((x & 0xfff0) == 0x93e0):((x & 0xfff0)==0x93f0)) -// OBSOLETE #define IS_MOVE_FP(x) (BIG ? x == 0xa1ea : x == 0xa1fa) -// OBSOLETE #define IS_MOV_SP_FP(x) (BIG ? x == 0x94ea : x == 0x0d76) -// OBSOLETE #define IS_SUB2_SP(x) (x==0x1b87) -// OBSOLETE #define IS_MOVK_R5(x) (x==0x7905) -// OBSOLETE #define IS_SUB_SP(x) ((x & 0xffff) == 0x020f) -// OBSOLETE #define IS_PUSH_FP(x) (BIG ? (x == 0x93ea) : (x == 0x93fa)) -// OBSOLETE -// OBSOLETE /* work out how much local space is on the stack and -// OBSOLETE return the pc pointing to the first push */ -// OBSOLETE -// OBSOLETE static CORE_ADDR -// OBSOLETE skip_adjust (CORE_ADDR pc, int *size) -// OBSOLETE { -// OBSOLETE *size = 0; -// OBSOLETE -// OBSOLETE if (IS_PUSH_FP (read_memory_short (pc)) -// OBSOLETE && IS_MOV_SP_FP (read_memory_short (pc + 2))) -// OBSOLETE { -// OBSOLETE /* This is a function with an explict frame pointer */ -// OBSOLETE pc += 4; -// OBSOLETE *size += 2; /* remember the frame pointer */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* remember any stack adjustment */ -// OBSOLETE if (IS_SUB_SP (read_memory_short (pc))) -// OBSOLETE { -// OBSOLETE *size += read_memory_short (pc + 2); -// OBSOLETE pc += 4; -// OBSOLETE } -// OBSOLETE return pc; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static CORE_ADDR examine_frame (CORE_ADDR, CORE_ADDR * regs, CORE_ADDR); -// OBSOLETE static CORE_ADDR -// OBSOLETE examine_frame (CORE_ADDR pc, CORE_ADDR *regs, CORE_ADDR sp) -// OBSOLETE { -// OBSOLETE int w = read_memory_short (pc); -// OBSOLETE int offset = 0; -// OBSOLETE int regno; -// OBSOLETE -// OBSOLETE for (regno = 0; regno < NUM_REGS; regno++) -// OBSOLETE regs[regno] = 0; -// OBSOLETE -// OBSOLETE while (IS_PUSHW (w) || IS_PUSHL (w)) -// OBSOLETE { -// OBSOLETE /* work out which register is being pushed to where */ -// OBSOLETE if (IS_PUSHL (w)) -// OBSOLETE { -// OBSOLETE regs[w & 0xf] = offset; -// OBSOLETE regs[(w & 0xf) + 1] = offset + 2; -// OBSOLETE offset += 4; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE regs[w & 0xf] = offset; -// OBSOLETE offset += 2; -// OBSOLETE } -// OBSOLETE pc += 2; -// OBSOLETE w = read_memory_short (pc); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (IS_MOVE_FP (w)) -// OBSOLETE { -// OBSOLETE /* We know the fp */ -// OBSOLETE -// OBSOLETE } -// OBSOLETE else if (IS_SUB_SP (w)) -// OBSOLETE { -// OBSOLETE /* Subtracting a value from the sp, so were in a function -// OBSOLETE which needs stack space for locals, but has no fp. We fake up -// OBSOLETE the values as if we had an fp */ -// OBSOLETE regs[FP_REGNUM] = sp; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* This one didn't have an fp, we'll fake it up */ -// OBSOLETE regs[SP_REGNUM] = sp; -// OBSOLETE } -// OBSOLETE /* stack pointer contains address of next frame */ -// OBSOLETE /* regs[fp_regnum()] = fp; */ -// OBSOLETE regs[SP_REGNUM] = sp; -// OBSOLETE return pc; -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE z8k_skip_prologue (CORE_ADDR start_pc) -// OBSOLETE { -// OBSOLETE CORE_ADDR dummy[NUM_REGS]; -// OBSOLETE -// OBSOLETE return examine_frame (start_pc, dummy, 0); -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE z8k_addr_bits_remove (CORE_ADDR addr) -// OBSOLETE { -// OBSOLETE return (addr & PTR_MASK); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static int -// OBSOLETE read_memory_pointer (CORE_ADDR x) -// OBSOLETE { -// OBSOLETE return read_memory_integer (ADDR_BITS_REMOVE (x), BIG ? 4 : 2); -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE z8k_frame_chain (struct frame_info *thisframe) -// OBSOLETE { -// OBSOLETE if (!inside_entry_file (get_frame_pc (thisframe))) -// OBSOLETE { -// OBSOLETE return read_memory_pointer (thisframe->frame); -// OBSOLETE } -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, -// OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. -// OBSOLETE This includes special registers such as pc and fp saved in special -// OBSOLETE ways in the stack frame. sp is even more special: -// OBSOLETE the address we return for it IS the sp for the next frame. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE z8k_frame_init_saved_regs (struct frame_info *frame_info) -// OBSOLETE { -// OBSOLETE CORE_ADDR pc; -// OBSOLETE int w; -// OBSOLETE -// OBSOLETE frame_saved_regs_zalloc (frame_info); -// OBSOLETE pc = get_pc_function_start (get_frame_pc (frame_info)); -// OBSOLETE -// OBSOLETE /* wander down the instruction stream */ -// OBSOLETE examine_frame (pc, frame_info->saved_regs, frame_info->frame); -// OBSOLETE -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE z8k_push_dummy_frame (void) -// OBSOLETE { -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE gdb_print_insn_z8k (bfd_vma memaddr, disassemble_info *info) -// OBSOLETE { -// OBSOLETE if (BIG) -// OBSOLETE return print_insn_z8001 (memaddr, info); -// OBSOLETE else -// OBSOLETE return print_insn_z8002 (memaddr, info); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or -// OBSOLETE is not the address of a valid instruction, the address of the next -// OBSOLETE instruction beyond ADDR otherwise. *PWORD1 receives the first word -// OBSOLETE of the instruction. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, short *pword1) -// OBSOLETE { -// OBSOLETE char buf[2]; -// OBSOLETE if (addr < lim + 8) -// OBSOLETE { -// OBSOLETE read_memory (addr, buf, 2); -// OBSOLETE *pword1 = extract_signed_integer (buf, 2); -// OBSOLETE -// OBSOLETE return addr + 2; -// OBSOLETE } -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE #if 0 -// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, -// OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. -// OBSOLETE This includes special registers such as pc and fp saved in special -// OBSOLETE ways in the stack frame. sp is even more special: -// OBSOLETE the address we return for it IS the sp for the next frame. -// OBSOLETE -// OBSOLETE We cache the result of doing this in the frame_cache_obstack, since -// OBSOLETE it is fairly expensive. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE frame_find_saved_regs (struct frame_info *fip, struct frame_saved_regs *fsrp) -// OBSOLETE { -// OBSOLETE int locals; -// OBSOLETE CORE_ADDR pc; -// OBSOLETE CORE_ADDR adr; -// OBSOLETE int i; -// OBSOLETE -// OBSOLETE memset (fsrp, 0, sizeof *fsrp); -// OBSOLETE -// OBSOLETE pc = skip_adjust (get_pc_function_start (get_frame_pc (fip)), &locals); -// OBSOLETE -// OBSOLETE { -// OBSOLETE adr = get_frame_base (fip) - locals; -// OBSOLETE for (i = 0; i < 8; i++) -// OBSOLETE { -// OBSOLETE int word = read_memory_short (pc); -// OBSOLETE -// OBSOLETE pc += 2; -// OBSOLETE if (IS_PUSHL (word)) -// OBSOLETE { -// OBSOLETE fsrp->regs[word & 0xf] = adr; -// OBSOLETE fsrp->regs[(word & 0xf) + 1] = adr - 2; -// OBSOLETE adr -= 4; -// OBSOLETE } -// OBSOLETE else if (IS_PUSHW (word)) -// OBSOLETE { -// OBSOLETE fsrp->regs[word & 0xf] = adr; -// OBSOLETE adr -= 2; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE -// OBSOLETE } -// OBSOLETE -// OBSOLETE fsrp->regs[PC_REGNUM] = fip->frame + 4; -// OBSOLETE fsrp->regs[FP_REGNUM] = fip->frame; -// OBSOLETE -// OBSOLETE } -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE int -// OBSOLETE z8k_saved_pc_after_call (struct frame_info *frame) -// OBSOLETE { -// OBSOLETE return ADDR_BITS_REMOVE -// OBSOLETE (read_memory_integer (read_register (SP_REGNUM), PTR_SIZE)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE void -// OBSOLETE extract_return_value (struct type *type, char *regbuf, char *valbuf) -// OBSOLETE { -// OBSOLETE int b; -// OBSOLETE int len = TYPE_LENGTH (type); -// OBSOLETE -// OBSOLETE for (b = 0; b < len; b += 2) -// OBSOLETE { -// OBSOLETE int todo = len - b; -// OBSOLETE -// OBSOLETE if (todo > 2) -// OBSOLETE todo = 2; -// OBSOLETE memcpy (valbuf + b, regbuf + b, todo); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE write_return_value (struct type *type, char *valbuf) -// OBSOLETE { -// OBSOLETE int reg; -// OBSOLETE int len; -// OBSOLETE -// OBSOLETE for (len = 0; len < TYPE_LENGTH (type); len += 2) -// OBSOLETE deprecated_write_register_bytes (REGISTER_BYTE (len / 2 + 2), -// OBSOLETE valbuf + len, 2); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE store_struct_return (CORE_ADDR addr, CORE_ADDR sp) -// OBSOLETE { -// OBSOLETE write_register (2, addr); -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE static void -// OBSOLETE z8k_print_register_hook (int regno) -// OBSOLETE { -// OBSOLETE if ((regno & 1) == 0 && regno < 16) -// OBSOLETE { -// OBSOLETE unsigned char l[4]; -// OBSOLETE -// OBSOLETE frame_register_read (deprecated_selected_frame, regno, l + 0); -// OBSOLETE frame_register_read (deprecated_selected_frame, regno + 1, l + 2); -// OBSOLETE printf_unfiltered ("\t"); -// OBSOLETE printf_unfiltered ("0x%02x%02x%02x%02x", l[0], l[1], l[2], l[3]); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if ((regno & 3) == 0 && regno < 16) -// OBSOLETE { -// OBSOLETE unsigned char l[8]; -// OBSOLETE -// OBSOLETE frame_register_read (deprecated_selected_frame, regno, l + 0); -// OBSOLETE frame_register_read (deprecated_selected_frame, regno + 1, l + 2); -// OBSOLETE frame_register_read (deprecated_selected_frame, regno + 2, l + 4); -// OBSOLETE frame_register_read (deprecated_selected_frame, regno + 3, l + 6); -// OBSOLETE -// OBSOLETE printf_unfiltered ("\t"); -// OBSOLETE printf_unfiltered ("0x%02x%02x%02x%02x%02x%02x%02x%02x", -// OBSOLETE l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7]); -// OBSOLETE } -// OBSOLETE if (regno == 15) -// OBSOLETE { -// OBSOLETE unsigned short rval; -// OBSOLETE int i; -// OBSOLETE -// OBSOLETE frame_register_read (deprecated_selected_frame, regno, (char *) (&rval)); -// OBSOLETE -// OBSOLETE printf_unfiltered ("\n"); -// OBSOLETE for (i = 0; i < 10; i += 2) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("(sp+%d=%04x)", i, -// OBSOLETE (unsigned int)read_memory_short (rval + i)); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE z8k_print_registers_info (struct gdbarch *gdbarch, -// OBSOLETE struct ui_file *file, -// OBSOLETE struct frame_info *frame, -// OBSOLETE int regnum, int print_all) -// OBSOLETE { -// OBSOLETE int i; -// OBSOLETE const int numregs = NUM_REGS + NUM_PSEUDO_REGS; -// OBSOLETE char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); -// OBSOLETE char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); -// OBSOLETE -// OBSOLETE for (i = 0; i < numregs; i++) -// OBSOLETE { -// OBSOLETE /* Decide between printing all regs, non-float / vector regs, or -// OBSOLETE specific reg. */ -// OBSOLETE if (regnum == -1) -// OBSOLETE { -// OBSOLETE if (!print_all) -// OBSOLETE { -// OBSOLETE if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) -// OBSOLETE continue; -// OBSOLETE if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i))) -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE if (i != regnum) -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* If the register name is empty, it is undefined for this -// OBSOLETE processor, so don't display anything. */ -// OBSOLETE if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0') -// OBSOLETE continue; -// OBSOLETE -// OBSOLETE fputs_filtered (REGISTER_NAME (i), file); -// OBSOLETE print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file); -// OBSOLETE -// OBSOLETE /* Get the data in raw format. */ -// OBSOLETE if (! frame_register_read (frame, i, raw_buffer)) -// OBSOLETE { -// OBSOLETE fprintf_filtered (file, "*value not available*\n"); -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* FIXME: cagney/2002-08-03: This code shouldn't be necessary. -// OBSOLETE The function frame_register_read() should have returned the -// OBSOLETE pre-cooked register so no conversion is necessary. */ -// OBSOLETE /* Convert raw data to virtual format if necessary. */ -// OBSOLETE if (REGISTER_CONVERTIBLE (i)) -// OBSOLETE { -// OBSOLETE REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i), -// OBSOLETE raw_buffer, virtual_buffer); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE memcpy (virtual_buffer, raw_buffer, -// OBSOLETE REGISTER_VIRTUAL_SIZE (i)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* If virtual format is floating, print it that way, and in raw -// OBSOLETE hex. */ -// OBSOLETE if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) -// OBSOLETE { -// OBSOLETE int j; -// OBSOLETE -// OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, -// OBSOLETE file, 0, 1, 0, Val_pretty_default); -// OBSOLETE -// OBSOLETE fprintf_filtered (file, "\t(raw 0x"); -// OBSOLETE for (j = 0; j < REGISTER_RAW_SIZE (i); j++) -// OBSOLETE { -// OBSOLETE int idx; -// OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) -// OBSOLETE idx = j; -// OBSOLETE else -// OBSOLETE idx = REGISTER_RAW_SIZE (i) - 1 - j; -// OBSOLETE fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]); -// OBSOLETE } -// OBSOLETE fprintf_filtered (file, ")"); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* Print the register in hex. */ -// OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, -// OBSOLETE file, 'x', 1, 0, Val_pretty_default); -// OBSOLETE /* If not a vector register, print it also according to its -// OBSOLETE natural format. */ -// OBSOLETE if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0) -// OBSOLETE { -// OBSOLETE fprintf_filtered (file, "\t"); -// OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, -// OBSOLETE file, 0, 1, 0, Val_pretty_default); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Some z8k specific info. */ -// OBSOLETE z8k_print_register_hook (i); -// OBSOLETE -// OBSOLETE fprintf_filtered (file, "\n"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE z8k_do_registers_info (int regnum, int all) -// OBSOLETE { -// OBSOLETE z8k_print_registers_info (current_gdbarch, gdb_stdout, -// OBSOLETE deprecated_selected_frame, regnum, all); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE z8k_pop_frame (void) -// OBSOLETE { -// OBSOLETE } -// OBSOLETE -// OBSOLETE struct cmd_list_element *setmemorylist; -// OBSOLETE -// OBSOLETE void -// OBSOLETE z8k_set_pointer_size (int newsize) -// OBSOLETE { -// OBSOLETE static int oldsize = 0; -// OBSOLETE -// OBSOLETE if (oldsize != newsize) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("pointer size set to %d bits\n", newsize); -// OBSOLETE oldsize = newsize; -// OBSOLETE if (newsize == 32) -// OBSOLETE { -// OBSOLETE BIG = 1; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE BIG = 0; -// OBSOLETE } -// OBSOLETE /* FIXME: This code should be using the GDBARCH framework to -// OBSOLETE handle changed type sizes. If this problem is ever fixed -// OBSOLETE (the direct reference to _initialize_gdbtypes() below -// OBSOLETE eliminated) then Makefile.in should be updated so that -// OBSOLETE z8k-tdep.c is again compiled with -Werror. */ -// OBSOLETE _initialize_gdbtypes (); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE segmented_command (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE z8k_set_pointer_size (32); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE unsegmented_command (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE z8k_set_pointer_size (16); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE set_memory (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n"); -// OBSOLETE help_list (setmemorylist, "set memory ", -1, gdb_stdout); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE _initialize_z8ktdep (void) -// OBSOLETE { -// OBSOLETE tm_print_insn = gdb_print_insn_z8k; -// OBSOLETE -// OBSOLETE add_prefix_cmd ("memory", no_class, set_memory, -// OBSOLETE "set the memory model", &setmemorylist, "set memory ", 0, -// OBSOLETE &setlist); -// OBSOLETE add_cmd ("segmented", class_support, segmented_command, -// OBSOLETE "Set segmented memory model.", &setmemorylist); -// OBSOLETE add_cmd ("unsegmented", class_support, unsegmented_command, -// OBSOLETE "Set unsegmented memory model.", &setmemorylist); -// OBSOLETE -// OBSOLETE } -- 2.7.4