Add DIContext::getLineInfoForAddressRange() function and test. This function allows a caller to obtain a table of line information for a function using the function's address and size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173537 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Kaylor
2013-01-26 00:28:05 +00:00
parent 32a5795822
commit e27a787760
8 changed files with 191 additions and 8 deletions

View File

@ -163,8 +163,14 @@ static int printLineInfoForInput() {
outs() << "Function: " << Name << ", Size = " << Size << "\n";
DILineInfo Result = Context->getLineInfoForAddress(Addr);
outs() << " Line info:" << Result.getFileName() << ", line:" << Result.getLine() << "\n";
DILineInfoTable Lines = Context->getLineInfoForAddressRange(Addr, Size);
DILineInfoTable::iterator Begin = Lines.begin();
DILineInfoTable::iterator End = Lines.end();
for (DILineInfoTable::iterator It = Begin; It != End; ++It) {
outs() << " Line info @ " << It->first - Addr << ": "
<< It->second.getFileName()
<< ", line:" << It->second.getLine() << "\n";
}
}
}
}