ra寄存器定位core
$ra寄存器中存入的是pc的值(程序运行处的地址),调用函数时,在跳转前,必须保存当前地址(pc的值),以便后来返回。jal $ra 保存后跳转,jr $ra,返回到跳转前,通过$ra保存进入上层栈地址。
jal
直接跳转指令,并带有链接功能,指令的跳转地址在指令中,跳转发生时要把返回地址存放到R31寄存器(ra)中。
jr
使用寄存器的跳转指令,跳转地址在寄存器中。
所以根据ra定位core位置时,可以直接在ra位置前找jal便可以找到当前正在执行的函数。
转自http://user.it.uu.se/~justin/Teaching/NewDarkSlides/lecture5.pdf
• As in high level languages , when programming in assembly language you should split up your program into smaller functions, that you can reuse.
• One of the key ideas with functions is that you can call them
from any where and return back to where you called the function from.
• The MIPS processor has two instructions that enable you to call functions, jr and jal.
• Jump and link.
jal label
Copies the address of the next instruction into the register $ra
(register 31) and then jumps to the address label.
• jr $register jumps to the address in $register most common use
jr $ra
.data
str: .asciiz "Hello mum!.\n"
.text
.globl main #necessary for the assembler
main: jal message
jal message
li $v0,
syscall #exit the program gracefully
message: la $a0,str
li $v0,
syscall #Magic to printhings on the screen.
jr $ra
• There are many way of passing values to functions, but there is a convention that most programs on the MIPS follow.
• $a0-$a3 (registers 4 to 7) arguments 1-4 of a function.
• $v0-$v1 (registers 2 and 3) results of a function.
li $a0,
li $a1,
li $a3,
jal silly #Now the result of the function is is $v0.
li $v0,
syscall
silly: add $t0,$a0,$a1
sub $v0,$a3,$t0
jr $ra
ra寄存器定位core的更多相关文章
- iOS 苹果自带地图定位Core Location
Core Location是iOS SDK中一个提供设备位置的框架.可以使用三种技术来获取位置:GPS.蜂窝或WiFi.在这些技术中,GPS最为精准,如果有GPS硬件,Core Location将优先 ...
- 【Z】段错误Segment Fault定位,即core dump文件与gdb定位
使用C++开发系统有时会出现段错误,即Segment Fault.此类错误程序直接崩溃,通常没有任何有用信息输出,很难定位bug,因而无从解决问题.今天我们介绍core dump文件,并使用gdb进行 ...
- Core文件作用、设置及用法
http://blog.csdn.net/lanmolei814/article/details/45201693 ====================================== 1.C ...
- Linux上调试core文件(Good)
coredump文件 什么是coredump? 通常情况下coredmp包含了程序运行时的内存,寄存器状态,堆栈指针,内存管理信息等.可以理解为把程序工作的当前状态存储成一个文件.许多程序和操作系统出 ...
- GDB Core,gdb 调试大全,core文件调试
编译: gcc -g -o hello hello.c gdb 调试: 基本 gdb 命令. 命 令 描 述 小结:常用的gdb命令 backtrace 显示程序中的当前位置和表示如何到达当前位置的栈 ...
- 学会用core dump调试程序错误
最来在项目中遇到大型程序出现SIGSEGV ,一直不知道用core dump工具来调试程序,花了近一周的时间,才定位问题,老大很生气,后果很严重,呵呵,事后仔细学习了这块的知识,了解一点core du ...
- gdb core调试
原文链接 http://blog.163.com/lanka83/blog/static/32637615200801793020182/http://blog.csdn.net/taina2008/ ...
- 【转】段错误调试神器 - Core Dump详解
from:http://www.embeddedlinux.org.cn/html/jishuzixun/201307/08-2594.html 段错误调试神器 - Core Dump详解 来源:互联 ...
- Unix 用gdb分析core dump文件
产生core文件条件 用ulimit -c 指定core文件大小来开启core文件的生成,如:ulimit -c unlimited 用gdb分析core文件的条件 可执行程序在编译时,需加入-g参数 ...
随机推荐
- C++ 判断当前系统x64 or x86
BOOL IsWow64(){ BOOL bIsWow64 = FALSE; //IsWow64Process is not available on all supported versions o ...
- Weblogic集群配置__部署润乾应用
◆环境: Windows xp Weblogic:wls1031_ccjk_win32.rar(内部下载:\\192.168.0.38\SystemInstaller\4WebServer\we ...
- oracle 用户系统权限
conn sys as sysdba; create user test identified by test; grant create session to test; grant create ...
- spring shiro 集成
1.向spring项目中添加shiro相关的依赖 <dependency> <groupId>commons-logging</groupId> <artif ...
- ThinkPHP执行调用存储过程添加日志
本文出至:新太潮流网络博客 //PHP代码部分 /** * [LogAdd 操作日志] * @param [string] $userid [用户的ID] * @param [string] $typ ...
- 关于3d打印
3d打印技术是20世纪90年代逐渐兴起的一项先进的制造技术.3D打印——three-dimensional printing,简称3dp.又称三维打印或立体打印,最早由美国麻省理工学院于1993年开发 ...
- Oracle EBS AR 删除应收发票
DECLARE -- Non-scalar parameters require additional processing p_errors arp_trx_validate.mess ...
- Sql语法高级应用之三:存储过程
一.存储过程概述 SQL Server中的存储过程是使用T_SQL编写的代码段.它的目的在于能够方便的从系统表中查询信息,或者完成与更新数据库表相关的管理任务和其他的系统管理任务.T_SQL语句是SQ ...
- [VS2015] [asp.net] 允许远程访问本机正在DEBUG的服务
一.打开并编辑解决方案目录(不是工程目录)下的文件: \.vs\config\applicationhost.config 增加黑体行: <site name="XXXX" ...
- 记开发个人图书收藏清单小程序开发(十)DB开发——新增图书信息
昨晚完成了Web端新增图书信息的功能,现在就差DB的具体实现了. 因为我把Book相关的信息拆分的比较多,所以更新有点小麻烦. 首先,我需要创建一个Book Type的Matter: 然后,将图片路径 ...