如何在C中获取全局变量的初始化信息? [英] How to get the initialization information of a global variable in C?

查看:186
本文介绍了如何在C中获取全局变量的初始化信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试提取C中全局变量的所有初始化信息。使用之前发布的Phoenix,我可以使用AsNonLocalVariable-> GlobalVariable-> Location-> AsDataInstruction-> FixupList来获取初始化语句。在最近的发布中,我发现GlobalVariable的Location字段似乎总是为null,那么如何获取全局变量的初始化信息?

I'm trying to extract all the initialization information of the global variables in C. With the previous release of Phoenix, I can use AsNonLocalVariable->GlobalVariable->Location->AsDataInstruction->FixupList to get the initialization statement. In the recent release, I found the Location field of GlobalVariable seems always to be null, so how to get the initialization information of global variables?

推荐答案

I有一个类似的问题是由填充位置之前在通行列表中提前运行引起的。有人建议我使用Phx.Utility.GetInitialValue。以下行为我解决了(我可以访问修正)。

Phx.IR。 DataInstruction dataInstruction = Phx。 Utility .GetInitialValueNoDereference(globalVariableSymbol, ref biasByteOffset);

I had a similar problem that was caused by running early in the pass list, before the Location was populated. It was suggested that I use Phx.Utility.GetInitialValue. The following line solved it for me (I could access the fixups).

Phx.IR.DataInstruction dataInstruction = Phx.Utility.GetInitialValueNoDereference(globalVariableSymbol, ref biasByteOffset);


这篇关于如何在C中获取全局变量的初始化信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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