Skip to content

Commit a426753

Browse files
alvinhochunmstorsjo
authored andcommitted
[lldb] Add newline in output of target modules lookup
This adds a line break between each result address in the output of the lldb command `target modules lookup`. Before this change, a new address result will be printed on the same line as the summary of the last result, making the output difficult to view. Also adds a test for this command. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D134111
1 parent 8427c83 commit a426753

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

lldb/source/Commands/CommandObjectTarget.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,7 @@ static uint32_t LookupSymbolInModule(CommandInterpreter &interpreter,
15461546
DumpAddress(
15471547
interpreter.GetExecutionContext().GetBestExecutionContextScope(),
15481548
symbol->GetAddressRef(), verbose, all_ranges, strm);
1549+
strm.EOL();
15491550
} else {
15501551
strm.IndentMore();
15511552
strm.Indent(" Value: ");
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
--- !ELF
2+
FileHeader:
3+
Class: ELFCLASS64
4+
Data: ELFDATA2LSB
5+
Type: ET_REL
6+
Machine: EM_AARCH64
7+
SectionHeaderStringTable: .strtab
8+
Sections:
9+
- Name: .text
10+
Type: SHT_PROGBITS
11+
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
12+
AddressAlign: 0x4
13+
- Type: SectionHeaderTable
14+
Sections:
15+
- Name: .text
16+
- Name: .strtab
17+
- Name: .symtab
18+
Symbols:
19+
- Name: _Z8someFunciii
20+
Type: STT_FUNC
21+
Section: .text
22+
Binding: STB_GLOBAL
23+
Size: 0x1C
24+
- Name: _Z8someFuncci
25+
Type: STT_FUNC
26+
Section: .text
27+
Binding: STB_GLOBAL
28+
Value: 0x1C
29+
Size: 0x18
30+
- Name: _Z13someOtherFuncv
31+
Type: STT_FUNC
32+
Section: .text
33+
Binding: STB_GLOBAL
34+
Value: 0x34
35+
Size: 0x4
36+
- Name: _Z13someOtherFuncd
37+
Type: STT_FUNC
38+
Section: .text
39+
Binding: STB_GLOBAL
40+
Value: 0x38
41+
Size: 0x10
42+
- Name: _Z18ignoreThisFunctionv
43+
Type: STT_FUNC
44+
Section: .text
45+
Binding: STB_GLOBAL
46+
Value: 0x48
47+
Size: 0x8
48+
...
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# RUN: yaml2obj %S/Inputs/symbols.yaml -o %t
2+
3+
# RUN: %lldb %t -b -o "target modules lookup -A -r -s some" | FileCheck %s -DMODULE=%basename_t.tmp --implicit-check-not ignoreThisFunction
4+
# CHECK: 4 symbols match the regular expression 'some' in {{.*}}[[MODULE]]:
5+
# CHECK-NEXT: Address: [[MODULE]][0x0000000000000000] ([[MODULE]]..text + 0)
6+
# CHECK-NEXT: Summary: [[MODULE]]`someFunc(int, int, int)
7+
# CHECK-NEXT: Address: [[MODULE]][0x000000000000001c] ([[MODULE]]..text + 28)
8+
# CHECK-NEXT: Summary: [[MODULE]]`someFunc(char, int)
9+
# CHECK-NEXT: Address: [[MODULE]][0x0000000000000034] ([[MODULE]]..text + 52)
10+
# CHECK-NEXT: Summary: [[MODULE]]`someOtherFunc()
11+
# CHECK-NEXT: Address: [[MODULE]][0x0000000000000038] ([[MODULE]]..text + 56)
12+
# CHECK-NEXT: Summary: [[MODULE]]`someOtherFunc(double)

0 commit comments

Comments
 (0)