⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 low-xcopilot.c

📁 树大根深三棱尽所标杆ssfsfsa fdsafs
💻 C
字号:
/* Low level interface to xcopilot, for the remote server for GDB.   Copyright (C) 1986, 1987, 1993 Free Software Foundation, Inc.Ported to xcopilot by D Jeff DionneThis file is part of GDB.This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  *///#include <stdio.h>//#include "server.h"#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include "server.h"#include "config.h"#include "sysdeps.h"#include "shared.h"#include "memory.h"#include "custom.h"#include "newcpu.h"int quit_flag = 0;int registers[18];/* attach to a process, specified by it's pid */intcreate_inferior (int pid){  return 1;}/* Kill the inferior process.  Make us have no inferior.  */voidkill_inferior (){}/* Wait for process, returns status */unsigned charmywait (status)     char *status;{  /* wait until target stops */  fetch_inferior_registers (0);  *status = 'T';  /*  return ((unsigned char) WSTOPSIG (w)); */  return 5;}/* Resume execution of the inferior process.   If STEP is nonzero, single-step it.   If SIGNAL is nonzero, give it that signal.  */voidmyresume (step, signal)     int step;     int signal;{  /* make go! */}/* Fetch one or more registers from the inferior.  REGNO == -1 to get   them all.  We actually fetch more than requested, when convenient,   marking them as valid so we won't fetch them again.  */voidfetch_inferior_registers (ignored)     int ignored;{  /* into registers[] */}voidstore_inferior_registers (ignored)     int ignored;{	int i;  for (i=0; i<8; i++) (Shptr->regs).d[i] = ntohl(registers[0 + i]);  for (i=0; i<8; i++) (Shptr->regs).a[i] = ntohl(registers[8 + i]);//  ps = ntohl (registers[16]);//  pc = ntohl (registers[17]);}/* Copy LEN bytes from inferior's memory starting at MEMADDR   to debugger memory starting at MYADDR.  */voidread_inferior_memory (memaddr, myaddr, len)     char *memaddr;     char *myaddr;     int len;{    char a; //tanghao  while (len--) {		a=get_byte(memaddr); //tanghao	  fprintf(stderr, "address:%x:=%x ",memaddr,a);//tanghao    *(myaddr++) = get_byte(memaddr++);  }}/* Copy LEN bytes of data from debugger memory at MYADDR   to inferior's memory at MEMADDR.   On failure (cannot write the inferior)   returns the value of errno.  */intwrite_inferior_memory (memaddr, myaddr, len)     char *memaddr;     char *myaddr;     int len;{    char a;	  fprintf(stderr, "here to write_inferior_memory,and len=%x\n",len);//tanghao  while (len--) {	  fprintf(stderr, "write :memaddr=%x:*myaddr%x ",memaddr,*myaddr);     //tanghao//    put_byte(*(myaddr++), memaddr++);  //it was wrong,before.    put_byte(memaddr++, *(myaddr++));    }  return 0;}                                                   voidinitialize (){  inferior_pid = 0;}inthave_inferior_p (){  return inferior_pid != 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -