推荐文档列表

Gdb/Armulator 源代码分析

时间:2021-10-01 09:43:45 计算机论文 我要投稿

Gdb/Armulator 源代码分析

作者Email: Anti_chen2000@sohu.com

    摘要

    Gdb/Armulator 是Gdb自带的arm7模拟器,是调试arm程序的一个好工具.而了解它的原码结构对扩展它的IO功能有重要意义.本文介绍了从Armulator的启动到其内部运作和IO扩展的大部分原代码功能.

    说明

    源代码用的是gdb-5.0.tar+ gdb-5.0-uclinux-armulator-20021127.patch

    A. 和GDB间的通迅

    Armulator一般和Gdb通讯有两种方式,其一是在Gdb内部直接调用模拟器的相关函数,另一方法则是用pipe或socket传递RDP协议来连接Gdb和Amulator.而第一种方法是现在Gdb/Armulator所真正使用的(第二种是早期使用的方法),下面就分析了函数直接调用法.

    函数直接调用

这个方法是由Steve (sac@cygnus.com) 修改原RDP方法而来的,Steve本人的描述如下:

/******************************************************

This directory contains the standard release of the ARMulator from

Advanced RISC Machines, and was ftp'd from.

ftp.cl.cam.ac.uk:/arm/gnu

It likes to use TCP/IP between the simulator and the host, which is

nice, but is a pain to use under anything non-unix.

I've added created a new Makefile.in (the original in Makefile.orig)

to build a version of the simulator without the TCP/IP stuff, and a

wrapper.c to link directly into gdb and the run command.

It should be possible (barring major changes in the layout of

the armulator) to upgrade the simulator by copying all the files

out of a release into this directory and renaming the Makefile.

(Except that I changed armos.c to work more simply with our

simulator rigs)

********************************************************/

/gdb/target.c,/gdb/remote_sim.c以及在/sim/arm/wrapper.c是在Armulator和Gdb的通信中起着至关重要做用的几个文件.所有的Gdb调试命令最后都是通过在target.h里定义的target_ops结构中的函数指针调用在/sim/arm/w

[1] [2] [3] [4] [5] [6]