[llvm] r312252 - [llvm-dwarfdump] Brief mode only dumps debug_info by default

Robinson, Paul via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 10:51:26 PDT 2017


Do you get .debug_info.dwo with brief mode?
--paulr

> -----Original Message-----
> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On Behalf
> Of Jonas Devlieghere via llvm-commits
> Sent: Thursday, August 31, 2017 9:45 AM
> To: llvm-commits at lists.llvm.org
> Subject: [llvm] r312252 - [llvm-dwarfdump] Brief mode only dumps
> debug_info by default
> 
> Author: jdevlieghere
> Date: Thu Aug 31 09:44:47 2017
> New Revision: 312252
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=312252&view=rev
> Log:
> [llvm-dwarfdump] Brief mode only dumps debug_info by default
> 
> This patch changes the default behavior in brief mode to only show the
> debug_info section. This is undoubtedly the most popular and likely the
> one you'd want in brief mode.
> 
> Non-brief mode behavior is not affected and still defaults to all.
> 
> Differential revision: https://reviews.llvm.org/D37334
> 
> Modified:
>     llvm/trunk/test/tools/llvm-dwarfdump/X86/brief.s
>     llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
> 
> Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/brief.s
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-
> dwarfdump/X86/brief.s?rev=312252&r1=312251&r2=312252&view=diff
> ==========================================================================
> ====
> --- llvm/trunk/test/tools/llvm-dwarfdump/X86/brief.s (original)
> +++ llvm/trunk/test/tools/llvm-dwarfdump/X86/brief.s Thu Aug 31 09:44:47
> 2017
> @@ -2,12 +2,19 @@
>  # RUN: | llvm-dwarfdump -debug-dump=info -brief - \
>  # RUN: | FileCheck %s
> 
> +# CHECK-NOT: .debug_abbrev contents:
> +#
> +# CHECK: .debug_info contents:
>  # CHECK: DW_TAG_compile_unit
>  # CHECK-NOT: DW_FORM
> -# CHECK: DW_AT
> +# CHECK: DW_AT_name        ("brief.c")
> +# CHECK: DW_AT_name      ("main")
> +# CHECK: DW_AT_name      ("int")
>  # CHECK-NOT: debug_str
>  # CHECK-NOT: DW_AT_type {{.*}} =>
> -
> +#
> +# CHECK-NOT: {{.*}} contents:
> +#
>  # This test is meant to verify that -brief hides DW_FORMs and
> abbreviation
>  # codes from .debug_info section. Furthermore it verifies that it also
> hides
>  # .debug_str and die reference offsets into the CU.
> 
> Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-
> dwarfdump/llvm-dwarfdump.cpp?rev=312252&r1=312251&r2=312252&view=diff
> ==========================================================================
> ====
> --- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)
> +++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Thu Aug 31 09:44:47
> 2017
> @@ -41,7 +41,7 @@ InputFilenames(cl::Positional, cl::desc(
>                 cl::ZeroOrMore);
> 
>  static cl::opt<DIDumpType> DumpType(
> -    "debug-dump", cl::init(DIDT_All), cl::desc("Dump of debug
> sections:"),
> +    "debug-dump", cl::init(DIDT_Null), cl::desc("Dump of debug
> sections:"),
>      cl::values(
>          clEnumValN(DIDT_All, "all", "Dump all debug sections"),
>          clEnumValN(DIDT_Abbrev, "abbrev", ".debug_abbrev"),
> @@ -154,12 +154,12 @@ static bool VerifyInput(StringRef Filena
>    MemoryBuffer::getFileOrSTDIN(Filename);
>    error(Filename, BuffOrErr.getError());
>    std::unique_ptr<MemoryBuffer> Buff = std::move(BuffOrErr.get());
> -
> +
>    Expected<std::unique_ptr<Binary>> BinOrErr =
>    object::createBinary(Buff->getMemBufferRef());
>    if (!BinOrErr)
>      error(Filename, errorToErrorCode(BinOrErr.takeError()));
> -
> +
>    bool Result = true;
>    if (auto *Obj = dyn_cast<ObjectFile>(BinOrErr->get()))
>      Result = VerifyObjectFile(*Obj, Filename);
> @@ -217,6 +217,15 @@ int main(int argc, char **argv) {
> 
>    cl::ParseCommandLineOptions(argc, argv, "llvm dwarf dumper\n");
> 
> +  // Defaults to dumping all sections, unless brief mode is specified in
> which
> +  // case only the .debug_info section in dumped.
> +  if (DumpType == DIDT_Null) {
> +    if (Brief)
> +      DumpType = DIDT_Info;
> +    else
> +      DumpType = DIDT_All;
> +  }
> +
>    // Defaults to a.out if no filenames specified.
>    if (InputFilenames.size() == 0)
>      InputFilenames.push_back("a.out");
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list