在x86平台调试龙芯平台(mips64el)程序

39 篇文章 0 订阅

os:ubuntu 18.04 x64

使用qemu 作为模拟器,gdb 为作为调试器。

  1. 安装相关软件
    sudo apt install gdb-multiarch qemu qemu-user gcc-multilib gcc-multilib-mips64-linux-gnuabi64

  2. 测试代码

$ cat code.c 
#include<stdio.h>

int main()
{
    printf("Hello world!\n");
    return 0;
}

3.编译调试

$ mips64-linux-gnuabi64-gcc code.c -static -g3
And start emulation in qemu with debug session:

$ qemu-mips64 -g 1234 ./a.out
In gdb-multiarch use the following routine:

symbol-file a.out
set arch mips:isa64
target remote :1234
b main
c
And here is your goal:

(gdb) x/5i main
   0x120003850 <main>:  daddiu  sp,sp,-32
   0x120003854 <main+4>:    sd  ra,24(sp)
   0x120003858 <main+8>:    sd  s8,16(sp)
   0x12000385c <main+12>:   sd  gp,8(sp)
   0x120003860 <main+16>:   move    s8,sp

4.更详细的请查看 gdb set arch等指令的用法

5.参考链接
[1]. https://stackoverflow.com/questions/59906042/how-to-debug-mips-interactively

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值