[Lldb-commits] [lldb] 6a4e9cc - [LLDB] Add missing newline to "image lookup" output

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 9 02:44:55 PST 2023


Author: David Spickett
Date: 2023-02-09T10:44:50Z
New Revision: 6a4e9ccb2c6f3340eb01bd374988a55daed2a68d

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

LOG: [LLDB] Add missing newline to "image lookup" output

When using --name, due to a missing newline, multiple symbol results
were not correctly printed:
```
(lldb) image lookup -r -n "As<.*"
2 matches found in <...>/tbi_lisp:
        Address: tbi_lisp<...>
        Summary: tbi_lisp<...> at Symbol.cpp:75        Address: tbi_lisp<...>
        Summary: tbi_lisp<...> at Symbol.cpp:82
```
It should be:
```
(lldb) image lookup -r -n "As<.*"
2 matches found in /home/david.spickett/tbi_lisp/tbi_lisp:
        Address: tbi_lisp<...>
        Summary: tbi_lisp<...> at Symbol.cpp:75
        Address: tbi_lisp<...>
        Summary: tbi_lisp<...> at Symbol.cpp:82
```
With Address/Summary on separate lines.

Reviewed By: clayborg, labath

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

Added: 
    

Modified: 
    lldb/source/Commands/CommandObjectTarget.cpp
    lldb/test/Shell/Commands/command-target-modules-lookup.test

Removed: 
    


################################################################################
diff  --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 3d53de1d2d2bd..490a7e061563a 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -1582,6 +1582,8 @@ static void DumpSymbolContextList(ExecutionContextScope *exe_scope,
       sc.GetAddressRange(eSymbolContextEverything, 0, true, range);
 
       DumpAddress(exe_scope, range.GetBaseAddress(), verbose, all_ranges, strm);
+      if (i != (num_matches - 1))
+        strm.EOL();
     }
   }
   strm.IndentLess();

diff  --git a/lldb/test/Shell/Commands/command-target-modules-lookup.test b/lldb/test/Shell/Commands/command-target-modules-lookup.test
index 5ac211b007946..a3e3837303822 100644
--- a/lldb/test/Shell/Commands/command-target-modules-lookup.test
+++ b/lldb/test/Shell/Commands/command-target-modules-lookup.test
@@ -10,3 +10,10 @@
 # CHECK-NEXT: Summary: [[MODULE]]`someOtherFunc()
 # CHECK-NEXT: Address: [[MODULE]][0x0000000000000038] ([[MODULE]]..text + 56)
 # CHECK-NEXT: Summary: [[MODULE]]`someOtherFunc(double)
+
+# RUN: %lldb %t -b -o "target modules lookup -r -n \".*someFunc\"" | FileCheck %s -DMODULE=%basename_t.tmp --check-prefix CHECKFN
+# CHECKFN:     2 matches found in {{.*}}[[MODULE]]:
+# CHECKFN-NEXT: Address: [[MODULE]][0x0000000000000000] ([[MODULE]]..text + 0)
+# CHECKFN-NEXT: Summary: [[MODULE]]`someFunc(int, int, int)
+# CHECKFN-NEXT: Address: [[MODULE]][0x000000000000001c] ([[MODULE]]..text + 28)
+# CHECKFN-NEXT: Summary: [[MODULE]]`someFunc(char, int)
\ No newline at end of file


        


More information about the lldb-commits mailing list