[Lldb-commits] [lldb] f4991bf - [lldb] Improve display of absolute symbol lookup

Martin Storsjö via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 27 03:26:40 PDT 2022


Author: Alvin Wong
Date: 2022-09-27T13:09:59+03:00
New Revision: f4991bfa891eaf9f36aa3b79da6fed4228b69de9

URL: https://github.com/llvm/llvm-project/commit/f4991bfa891eaf9f36aa3b79da6fed4228b69de9
DIFF: https://github.com/llvm/llvm-project/commit/f4991bfa891eaf9f36aa3b79da6fed4228b69de9.diff

LOG: [lldb] Improve display of absolute symbol lookup

When running `target module lookup` command, show the name of absolute
symbols. Also fix indentation issue after printing an absolute symbol.

Reviewed By: clayborg, DavidSpickett

Differential Revision: https://reviews.llvm.org/D134516

Added: 
    

Modified: 
    lldb/source/Commands/CommandObjectTarget.cpp
    lldb/test/Shell/SymbolFile/absolute-symbol.test

Removed: 
    


################################################################################
diff  --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index deb7f84f70b70..59b7dfd74e852 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -1549,12 +1549,16 @@ static uint32_t LookupSymbolInModule(CommandInterpreter &interpreter,
           strm.EOL();
         } else {
           strm.IndentMore();
+          strm.Indent("    Name: ");
+          strm.PutCString(symbol->GetDisplayName().GetStringRef());
+          strm.EOL();
           strm.Indent("    Value: ");
           strm.Printf("0x%16.16" PRIx64 "\n", symbol->GetRawValue());
           if (symbol->GetByteSizeIsValid()) {
             strm.Indent("    Size: ");
             strm.Printf("0x%16.16" PRIx64 "\n", symbol->GetByteSize());
           }
+          strm.IndentLess();
         }
       }
     }

diff  --git a/lldb/test/Shell/SymbolFile/absolute-symbol.test b/lldb/test/Shell/SymbolFile/absolute-symbol.test
index 11feb1f89c10a..edcda7119d567 100644
--- a/lldb/test/Shell/SymbolFile/absolute-symbol.test
+++ b/lldb/test/Shell/SymbolFile/absolute-symbol.test
@@ -1,6 +1,7 @@
 # RUN: yaml2obj %s -o %t.o
 # RUN: %lldb -b -o 'target modules lookup -s absolute_symbol' %t.o | FileCheck %s
 # CHECK: 1 symbols match 'absolute_symbol'
+# CHECK:   Name: absolute_symbol
 # CHECK:   Value: 0x0000000012345678
 # Created from:
 #   .globl absolute_symbol


        


More information about the lldb-commits mailing list