mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
llvm-dwarfdump: Add an option to print out line info for a specific address
Usage: $ llvm-dwarfdump -address=0x0000000100000ed4 a.out.dSYM/Contents/Resources/DWARF/a.out xxx.c:6:0 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139850 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -35,6 +35,10 @@ static cl::list<std::string>
|
|||||||
InputFilenames(cl::Positional, cl::desc("<input object files>"),
|
InputFilenames(cl::Positional, cl::desc("<input object files>"),
|
||||||
cl::ZeroOrMore);
|
cl::ZeroOrMore);
|
||||||
|
|
||||||
|
static cl::opt<unsigned long long>
|
||||||
|
Address("address", cl::init(-1ULL),
|
||||||
|
cl::desc("Print line information for a given address"));
|
||||||
|
|
||||||
static void DumpInput(const StringRef &Filename) {
|
static void DumpInput(const StringRef &Filename) {
|
||||||
OwningPtr<MemoryBuffer> Buff;
|
OwningPtr<MemoryBuffer> Buff;
|
||||||
|
|
||||||
@@ -45,10 +49,6 @@ static void DumpInput(const StringRef &Filename) {
|
|||||||
|
|
||||||
OwningPtr<ObjectFile> Obj(ObjectFile::createObjectFile(Buff.take()));
|
OwningPtr<ObjectFile> Obj(ObjectFile::createObjectFile(Buff.take()));
|
||||||
|
|
||||||
outs() << '\n';
|
|
||||||
outs() << Filename
|
|
||||||
<< ":\tfile format " << Obj->getFileFormatName() << "\n\n";
|
|
||||||
|
|
||||||
StringRef DebugInfoSection;
|
StringRef DebugInfoSection;
|
||||||
StringRef DebugAbbrevSection;
|
StringRef DebugAbbrevSection;
|
||||||
StringRef DebugLineSection;
|
StringRef DebugLineSection;
|
||||||
@@ -85,7 +85,17 @@ static void DumpInput(const StringRef &Filename) {
|
|||||||
DebugArangesSection,
|
DebugArangesSection,
|
||||||
DebugLineSection,
|
DebugLineSection,
|
||||||
DebugStringSection));
|
DebugStringSection));
|
||||||
|
if (Address == -1ULL) {
|
||||||
|
outs() << Filename
|
||||||
|
<< ":\tfile format " << Obj->getFileFormatName() << "\n\n";
|
||||||
|
// Dump the complete DWARF structure.
|
||||||
dictx->dump(outs());
|
dictx->dump(outs());
|
||||||
|
} else {
|
||||||
|
// Print line info for the specified address.
|
||||||
|
DILineInfo dli = dictx->getLineInfoForAddress(Address);
|
||||||
|
outs() << (dli.getFileName() ? dli.getFileName() : "<unknown>") << ':'
|
||||||
|
<< dli.getLine() << ':' << dli.getColumn() << '\n';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
Reference in New Issue
Block a user