[LLVMdev] Pulling line number/file/path information from DbgStopPointInst instructions
Török Edwin
edwintorok at gmail.com
Thu Apr 30 23:44:36 PDT 2009
On 2009-04-30 04:43, Sarah Thompson wrote:
> Hmm... if I do a print() on the result of getFileName(), I get
>
> i8 * getelementptr ([9 x i8]* @.str, i32 0, i32 0)
>
> back, but if I try to dyn_cast this to GetElementPtrInst it fails
> (returning null), so presumably I'm seeing a
> GetElementPtrConstantExpr... so how can I get at that constant i8
> array without casting to a GetElementPtrInst, and with
> GetElementPtrConstantExpr being inaccessible to user code?
>
Look at lib/Analysis/DbgInfoPrinter.cpp in trunk:
void PrintDbgInfo::printStopPoint(const DbgStopPointInst *DSI)
{
if (PrintDirectory) {
std::string dir;
GetConstantStringInfo(DSI->getDirectory(), dir);
Out << dir << "/";
}
std::string file;
GetConstantStringInfo(DSI->getFileName(), file);
Out << file << ":" << DSI->getLine();
if (unsigned Col = DSI->getColumn()) {
Out << ":" << Col;
}
}
There are also some helpers for finding the stoppoints in the same class.
Best regards,
---Edwin
More information about the llvm-dev
mailing list