<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<font face="Courier New, Courier, monospace">Hi,<br>
<br>
If I have an instance of DISubprogram, can I get the debug info of
local variables of the function, including parameters?<br>
<br>
I tried to use the getVariables() function defined in
DISubprogram, but it seemed to return an empty DIArray node when I
ran my pass alone using opt. Do I need to enable any other
analysis passes in order to populate the data?<br>
<br>
My related snippet of code is like the following:<br>
<br>
NamedMDNode *M_Nodes = M.getNamedMetadata("llvm.dbg.cu");<br>
for (unsigned i = 0, e = M_Nodes->getNumOperands(); i != e;
++i) {<br>
DIArray SPs = CU.getSubprograms();<br>
for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++ i)
{<br>
DISubprogram SP(SPs.getElement(i));<br>
DIArray Vars = SP.getVariables();<br>
for (unsigned i2 = 0, e2 = Vars.getNumElements(); i2 !=
e2; ++i2) {<br>
DIVariable DV(Vars.getElement(i));<br>
DV.print(errs()); errs() << " : ";
DV.getType().dump();<br>
}<br>
}<br>
}<br>
<br>
In addition, can I use DebegInfo to get the list of parameters
(var names and types) of a subprogram? or I have to parse the
underlying metadata and build the relationship?<br>
<br>
Thanks,<br>
Lu<br>
<br>
</font>
</body>
</html>