gdb:在source和asm中显示相应的行 [英] gdb: show corresponding lines in source and asm

查看:58
本文介绍了gdb:在source和asm中显示相应的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在TUI模式下运行gdb时,显示源代码和汇编代码,是否可以突出显示映射到选定源代码行的指令集?

解决方案

您可以使用GDB仪表板部分完成它.

When running gdb in TUI mode, showing source and assembly, is there an option to highlight the set of instructions mapping to a selected source line?

解决方案

You can partially do it with GDB Dashboard.

https://github.com/cyrus-and/gdb-dashboard

From below screenshot you can see that the 1st call to operator<< in this line of code:

std::cout << a << std::endl;

is mapped to 4 assembly instructions:

0x00000000004011a2  main()+28 mov    -0x4(%rbp),%eax
0x00000000004011a5  main()+31 mov    %eax,%esi
0x00000000004011a7  main()+33 mov    $0x404060,%edi
0x00000000004011ac  main()+38 callq  0x401070 <_ZNSolsEi@plt>

They are highlighted with green color in Assembly section.

You can move to 2nd call to operator<< in the same line executing ni command several times and you will see the second mapping to 3 assembly instructions:

0x00000000004011b1  main()+43 mov    $0x401030,%esi
0x00000000004011b6  main()+48 mov    %rax,%rdi
0x00000000004011b9  main()+51 callq  0x401050 <_ZNSolsEPFRSoS_E@plt>

这篇关于gdb:在source和asm中显示相应的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆