/*
* taken from gdb/remote.c
*
* I am only interested in the write to memory stuff - everything else
* has been ripped out
*
* all the copyright notices etc have been left in
*/
/* enough so that it will compile */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
/*nicked from gcc..*/
#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C. */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
#pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc. */
#endif /* not GNU C. */
#ifdef __cplusplus
extern "C" {
#endif
void* alloca(size_t);
#ifdef __cplusplus
}
#endif
#endif /* alloca not defined. */
#include "serial.h"
#include "error.h"
#include "remote.h"
#define REGISTER_BYTES 0
#define fprintf_unfiltered fprintf
#define fprintf_filtered fprintf
#define fputs_unfiltered fputs
#define fputs_filtered fputs
#define fputc_unfiltered fputc
#define fputc_filtered fputc
#define printf_unfiltered printf
#define printf_filtered printf
#define puts_unfiltered puts
#define puts_filtered puts
#define putchar_unfiltered putchar
#define putchar_filtered putchar
#define fputstr_unfiltered(a,b,c) fputs((a), (c))
#define gdb_stdlog stderr
#define SERIAL_READCHAR(fd,timo) serialreadchar((fd), (timo))
#define SERIAL_WRITE(fd, addr, len) serialwrite((fd), (addr), (len))
#define error Error
#define perror_with_name Perror
#define gdb_flush fflush
#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
#define target_mourn_inferior() {}
#define ULONGEST unsigned long
#define CORE_ADDR unsigned long
static int putpkt (char *);
static int putpkt_binary(char *, int);
static void getpkt (char *, int);
static int remote_debug = 0, remote_register_buf_size = 0, watchdog = 0;
int remote_desc = -1, remote_timeout = 10;
static void
fputstrn_unfiltered(char *s, int n, int x, FILE *fp)
{
while (n-- > 0)
fputc(*s++, fp);
}
void
remote_reset(void)
{
SERIAL_WRITE(remote_desc, "+", 1);
}
void
remote_continue(void)
{
putpkt("c");
}
/* Remote target communications for serial-line targets in custom GDB protocol
Copyright 1988, 91, 92, 93, 94, 95, 96, 97, 98, 1999
Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the 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 of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* *INDENT-OFF* */
/* Remote communication protocol.
A debug packet whose contents are <data>
is encapsulated for transmission in the form:
$ <data> # CSUM1 CSUM2
<data> must be ASCII alphanumeric and cannot include characters
'$' or '#'. If <data> starts with two characters followed by
':', then the existing stubs interpret this as a sequence number.
CSUM1 and CSUM2 are ascii hex representation of an 8-bit
checksum of <data>, the most significant nibble is sent first.
the hex digits 0-9,a-f are used.
Receiver responds with:
+ - if CSUM is correct and ready for next packet
- - if CSUM is incorrect
<data> is as follows:
Most values are encoded in ascii hex digits. Signal numbers are according
to the numbering in target.h.
Request Packet
set thread Hct... Set thread for subsequent operations.
c = 'c' for thread used in step and
continue; t... can be -1 for all
threads.
c = 'g' for thread used in other
operations. If zero, pick a thread,
any thread.
reply OK for success
ENN for an error.
read registers g
reply XX....X Each byte of register data
is described by two hex digits.
Registers are in the internal order
for GDB, and the bytes in a register
are in the same order the machine uses.
or ENN for an error.
write regs GXX..XX Each byte of register data
is described by two hex digits.
reply OK for success
ENN for an error
write reg Pn...=r... Write register n... with value r...,
which contains two hex digits for each
byte in the register (target byte
order).
reply OK for success
ENN for an error
(not supported by all stubs).
read mem mAA..AA,LLLL AA..AA is address, LLLL is length.
reply XX..XX XX..XX is mem contents
Can be fewer bytes than requested
if able to read only part of the data.
or ENN NN is errno
write mem MAA..AA,LLLL:XX..XX
AA..AA is address,
LLLL is number of bytes,
XX..XX is data
reply OK for success
ENN for an error (this includes the case
where only part of the data was
written).
write mem XAA..AA,LLLL:XX..XX
(binary) AA..AA is address,
LLLL is number of bytes,
XX..XX is binary data
reply OK for success
ENN for an error
continue cAA..AA AA..AA is address to resume
If AA..AA is omitted,
resume at same address.
step sAA..AA AA..AA is address to resume
If AA..AA is omitted,
resume at same address.
continue with Csig;AA..AA Continue with signal sig (hex signal
signal number). If ;AA..AA is omitted,
resume at same address.
step with Ssig;AA..AA Like 'C' but step not continue.
signal
last signal ? Reply the current reason for stopping.
This is the same reply as is generated
for step or cont : SAA where AA is the
signal number.
detach D Reply OK.
There is no immediate reply to step or cont.
The reply comes when the machine stops.
It is SAA AA is the signal number.
or... TAAn...:r...;n...:r...;n...:r...;
AA = signal number
n... = register number (hex)
r... = register contents
n... = `thread'
r... = thread process ID. This is
a hex integer.
n... = other string not starting
with valid hex digit.
gdb should ignore this n,r pair
and go on to the next. This way
we can extend the protocol.
or... WAA The process exited, and AA is
the exit status. This is only
applicable for certains sorts of
targets.
or... XAA The process terminated with signal
AA.
or (obsolete) NAA;tttttttt;dddddddd;bbbbbbbb
AA = signal number
tttttttt = address of symbol "_start"
dddddddd = base of data section
bbbbbbbb = base of bss section.
Note: only used by Cisco Systems
targets. The difference between this
reply and the "qOffsets" query is that
the 'N' packet may arrive spontaneously
whereas the 'qOffsets' is a query
initiated by the host debugger.
or... OXX..XX XX..XX is hex encoding of ASCII data. This
can happen at any time while the
program is running and the debugger
should continue to wait for
'W', 'T', etc.
thread alive TXX Find out if the thread XX is alive.
reply OK thread is still alive
ENN thread is dead
remote restart RXX Restart the remote server
extended ops ! Use the extended remote protocol.
Sticky -- only needs to be set once.
kill request k
toggle debug d toggle debug flag (see 386 & 68k stubs)
reset r reset -- see
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
tools.rar (81个子文件)
tools
gen_eth_addr.c 1KB
bddb
browse.php 4KB
execute.php 601B
dodellog.php 1KB
doedit.php 5KB
index.php 926B
edit.php 3KB
create_tables.sql 5KB
newlog.php 1KB
new.php 3KB
config.php 384B
bddb.css 4KB
doedlog.php 2KB
badsubmit.php 660B
edlog.php 2KB
brlog.php 3KB
README 5KB
donew.php 5KB
donewlog.php 2KB
defs.php 17KB
dodelete.php 2KB
bmp_logo.o 3KB
img2brec.sh 14KB
envcrc 27KB
mkimage 12KB
crc32.o 5KB
easylogo
runme.sh 96B
easylogo.c 9KB
linux_logo.tga 19KB
Makefile 44B
Makefile.win32 1KB
updater
flash.c 5KB
ctype.c 2KB
utils.c 3KB
junk 256B
string.c 5KB
update.c 2KB
dummy.c 35B
ppcstring.S 3KB
cmd_flash.c 10KB
Makefile 3KB
flash_hw.c 14KB
img2srec.o 4KB
envcrc.o 21KB
mkimage.o 45KB
.depend 6KB
gen_eth_addr 3KB
gdb
serial.c 3KB
serial.h 1KB
remote.c 24KB
error.c 2KB
remote.h 1KB
gdbcont.c 2KB
Makefile 2KB
gdbsend.c 3KB
error.h 1008B
bmp_logo.c 4KB
logos
denx.bmp 15KB
img2srec 5KB
setlocalversion 486B
img2srec.c 11KB
envcrc.c 3KB
scripts
send_cmd 323B
send_image 427B
flash_param 1KB
README 2KB
dot.kermrc 500B
ncb.c 715B
gen_eth_addr.o 22KB
env
fw_env_main.c 2KB
fw_env.h 2KB
README 1KB
Makefile 1KB
fw_env.config 284B
fw_env.c 17KB
inca-swap-bytes.c 647B
environment.o 2KB
mpc86x_clk.c 5KB
mkimage.c 18KB
Makefile 5KB
bmp_logo 5KB
共 81 条
- 1
fangsfang
- 粉丝: 1
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 采用P-f和Q-V滞控的去中心化逆变器型交流微电网的模拟(Simulink仿真实现)
- 彩虹聚合二级域名DNS管理系统源码v1.3
- 【TOF相机笔记3】Simulink使用方法
- 算法部署-基于C++和Python使用ONNXRuntime部署RT-DETR目标检测算法-附项目源码-优质项目实战.zip
- Bitree.cpp
- 改变浏览器大小,图片(img)内容居中显示
- 全景分割-基于FAIR-DETR对Cityscapes数据集进行微调实现全景分割-附项目源码-优质项目实战.zip
- Tru master.m4a
- 基于ELMAN神经网络的用气量预测,基于ELMAN的天然气消费量预测(代码完整,数据齐全)
- 基于Vue3+ThreeJS实现机械臂控制和预览+源码+开发文档+代码解析(高分优秀项目)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页