我该怎么办DW_OP_call_frame_cfa [英] What do I do with DW_OP_call_frame_cfa

查看:142
本文介绍了我该怎么办DW_OP_call_frame_cfa的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用libdwarf计算正在运行的程序中局部变量的位置.我曾经能够通过执行DW_OP_fbreg来做到这一点,该DW_OP_fbreg最终将映射到该函数的框架基址的寄存器.在较新的矮人标准中,帧基为DW_OP_call_frame_cfa.我似乎找不到任何可以告诉我如何执行DW_OP_call_frame_cfa并返回框架基本位置的信息.关于CFA表的引用很多,谁会恢复哪些寄存器,但我不知道如何获取该信息以及如何应用它.有人可以填补空白吗?

I'm trying to calculate the locations of local variables inside a running program using libdwarf. I used to be able to do this by executing DW_OP_fbreg which would ultimately map to a register that would the frame base for that function. In the newer dwarf standard the frame base is DW_OP_call_frame_cfa. I can't seem to find any information that tells me how to execute DW_OP_call_frame_cfa and come back with a frame base location. There's a lot of references to a CFA table and who restores what registers but I don't know how to get at that information and how to apply it. Can someone fill in the gaps?

推荐答案

DW_OP_call_frame_cfa意味着您必须使用呼叫帧信息来计算CFA;然后将其压入表达式堆栈.

DW_OP_call_frame_cfa means that you have to use the call frame information to compute the CFA; then push this on the expression stack.

有关此说明,请参见DWARF 4标准的第6.4节(呼叫帧信息").本质上,您现在必须阅读.debug_frame部分并根据6.4中所述的规则对其进行解码.这相当于为另一种小字节码语言编写另一个解释器.并可能还会重用DWARF表达式解释器.

See section 6.4 ("Call Frame Information") of the DWARF 4 standard for an explanation of this. Essentially you must now read the .debug_frame section and decode it according to the rules described in 6.4. This amounts to writing another interpreter for another little bytecode language; and possibly reusing the DWARF expression interpreter as well.

此操作码基本上是DWARF中的空间优化.编译器已经发出了调用帧信息,并且此操作码还使他们可以重用它来计算变量位置.

This opcode is basically a space optimization in DWARF. Compilers were already emitting the call frame information, and this opcode lets them reuse it to compute variable locations as well.

这篇关于我该怎么办DW_OP_call_frame_cfa的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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