From 172d5978c835377307f80b2845f1f11276f5ec24 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Fri, 25 Jan 2013 17:06:42 +0000 Subject: Rename variable to be more comprehensible and follow naming convention git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173460 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tools/llvm-dwarfdump/llvm-dwarfdump.cpp') diff --git a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 34302fa..ccaf466 100644 --- a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -69,13 +69,13 @@ static void DumpInput(const StringRef &Filename) { } OwningPtr Obj(ObjectFile::createObjectFile(Buff.take())); - OwningPtr dictx(DIContext::getDWARFContext(Obj.get())); + OwningPtr DICtx(DIContext::getDWARFContext(Obj.get())); 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. int SpecFlags = DILineInfoSpecifier::FileLineInfo | @@ -84,7 +84,7 @@ static void DumpInput(const StringRef &Filename) { SpecFlags |= DILineInfoSpecifier::FunctionName; if (PrintInlining) { DIInliningInfo InliningInfo = - dictx->getInliningInfoForAddress(Address, SpecFlags); + DICtx->getInliningInfoForAddress(Address, SpecFlags); uint32_t n = InliningInfo.getNumberOfFrames(); if (n == 0) { // Print one empty debug line info in any case. @@ -96,7 +96,7 @@ static void DumpInput(const StringRef &Filename) { } } } else { - DILineInfo dli = dictx->getLineInfoForAddress(Address, SpecFlags); + DILineInfo dli = DICtx->getLineInfoForAddress(Address, SpecFlags); PrintDILineInfo(dli); } } -- cgit v1.1 From 939a4e8b693820d161f362317f7dba9057e66cc7 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Fri, 25 Jan 2013 20:26:43 +0000 Subject: Add command-line flags for DWARF dumping. Flags for dumping specific DWARF sections added in lib/DebugInfo and llvm-dwarfdump. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173480 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'tools/llvm-dwarfdump/llvm-dwarfdump.cpp') diff --git a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index ccaf466..0687500 100644 --- a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -52,6 +52,23 @@ static cl::opt PrintInlining("inlining", cl::init(false), cl::desc("Print all inlined frames for a given address")); +static cl::opt +DumpType("debug-dump", cl::init(DIDT_All), + cl::desc("Dump of debug sections:"), + cl::values( + clEnumValN(DIDT_All, "all", "Dump all debug sections"), + clEnumValN(DIDT_Abbrev, "abbrev", ".debug_abbrev"), + clEnumValN(DIDT_AbbrevDwo, "abbrev.dwo", ".debug_abbrev.dwo"), + clEnumValN(DIDT_Aranges, "aranges", ".debug_aranges"), + clEnumValN(DIDT_Info, "info", ".debug_info"), + clEnumValN(DIDT_InfoDwo, "info.dwo", ".debug_info.dwo"), + clEnumValN(DIDT_Line, "line", ".debug_line"), + clEnumValN(DIDT_Ranges, "ranges", ".debug_ranges"), + clEnumValN(DIDT_Str, "str", ".debug_str"), + clEnumValN(DIDT_StrDwo, "str.dwo", ".debug_str.dwo"), + clEnumValN(DIDT_StrOffsetsDwo, "str_offsets.dwo", ".debug_str_offsets.dwo"), + clEnumValEnd)); + static void PrintDILineInfo(DILineInfo dli) { if (PrintFunctions) outs() << (dli.getFunctionName() ? dli.getFunctionName() : "") @@ -75,7 +92,7 @@ static void DumpInput(const StringRef &Filename) { outs() << Filename << ":\tfile format " << Obj->getFileFormatName() << "\n\n"; // Dump the complete DWARF structure. - DICtx->dump(outs()); + DICtx->dump(outs(), DumpType); } else { // Print line info for the specified address. int SpecFlags = DILineInfoSpecifier::FileLineInfo | -- cgit v1.1 From a965baca3c7ce1ced00446cff1c6395d03dfed52 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Fri, 25 Jan 2013 20:53:41 +0000 Subject: When encountering an unknown file format, ObjectFile::createObjectFile should politely report it instead of running into llvm_unreachable. Also patch llvm-dwarfdump to actually check whether the file it's attempting to dump is a valid object file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173489 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tools/llvm-dwarfdump/llvm-dwarfdump.cpp') diff --git a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 0687500..6041510 100644 --- a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -86,6 +86,11 @@ static void DumpInput(const StringRef &Filename) { } OwningPtr Obj(ObjectFile::createObjectFile(Buff.take())); + if (!Obj) { + errs() << Filename << ": Unknown object file format\n"; + return; + } + OwningPtr DICtx(DIContext::getDWARFContext(Obj.get())); if (Address == -1ULL) { -- cgit v1.1 From 60bdc5b16e2fc17be184b515a00c2e2a2eb40b89 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Tue, 5 Feb 2013 23:30:58 +0000 Subject: Initial support for DWARF CFI parsing and dumping in LLVM git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174463 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tools/llvm-dwarfdump/llvm-dwarfdump.cpp') diff --git a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 6041510..290f3a6 100644 --- a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -63,6 +63,7 @@ DumpType("debug-dump", cl::init(DIDT_All), clEnumValN(DIDT_Info, "info", ".debug_info"), clEnumValN(DIDT_InfoDwo, "info.dwo", ".debug_info.dwo"), clEnumValN(DIDT_Line, "line", ".debug_line"), + clEnumValN(DIDT_Frames, "frames", ".debug_frame"), clEnumValN(DIDT_Ranges, "ranges", ".debug_ranges"), clEnumValN(DIDT_Str, "str", ".debug_str"), clEnumValN(DIDT_StrDwo, "str.dwo", ".debug_str.dwo"), -- cgit v1.1 From e38825f490b898644089d5cd9cb90cec681bded8 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Tue, 12 Feb 2013 16:20:28 +0000 Subject: Add support for the pubnames section to llvm-dwarfdump. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174976 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tools/llvm-dwarfdump/llvm-dwarfdump.cpp') diff --git a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 290f3a6..8094856 100644 --- a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -65,6 +65,7 @@ DumpType("debug-dump", cl::init(DIDT_All), clEnumValN(DIDT_Line, "line", ".debug_line"), clEnumValN(DIDT_Frames, "frames", ".debug_frame"), clEnumValN(DIDT_Ranges, "ranges", ".debug_ranges"), + clEnumValN(DIDT_Pubnames, "pubnames", ".debug_pubnames"), clEnumValN(DIDT_Str, "str", ".debug_str"), clEnumValN(DIDT_StrDwo, "str.dwo", ".debug_str.dwo"), clEnumValN(DIDT_StrOffsetsDwo, "str_offsets.dwo", ".debug_str_offsets.dwo"), -- cgit v1.1