如何从函数中获取调试信息? [英] How do I get debug information from a function?

查看:90
本文介绍了如何从函数中获取调试信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Clang编译了启用了调试信息的函数.对于Instruction,有一个方便的getDebugLoc(),但是对于Function,没有这样的东西.给定一个Function实例,我如何获取它的调试信息(我猜为DISubProgram形式)?

I've used Clang to compile a function with debug information enabled. For Instructions there's the handy getDebugLoc(), but there's no such thing for Functions. Given a Function instance, how can I get the debug information (I'm guessing in DISubProgram form) for it?

我已经看过该指南条目,说明了如何表示调试信息 ,并且元数据确实包含指向该函数的链接,但是显然没有链接返回.我是否应该遍历模块中的所有元数据?

I've seen the guide entry explaining how that debug information is represented, and the metadata does contain a link back to the function, but there's apparently no link back. Am I supposed to iterate over all the metadata in the module?

推荐答案

我认为目前没有更简单的方法.过去曾经有一个全局元数据节点收集所有功能元数据条目(llvm.dbg.sp),但不久前为了支持llvm.dbg.cu而将其删除,这更紧密地反映了DWARF结构.

I don't think there's currently an easier way. There used to be a global metadata node that collected all function metadata entries (llvm.dbg.sp) but it was removed a while ago in favor of llvm.dbg.cu which reflects the DWARF structure more closely.

我想调试元数据的常见用法不需要​​按功能查找,并且可以删除的所有多余信息,因为节省空间很重要并且IR中的元数据是已经太大了.

I suppose that the common uses of debug metadata don't require by-function lookup, and any extra information that could be removed, was removed, because saving space is important and metadata in IR is already way too big.

这篇关于如何从函数中获取调试信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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