Skip to content

Commit 76065f0

Browse files
committed
[lldb] Fix indentation when printing stop hooks
Fix the format (i.e., indentation) when printing stop hooks via `target stop-hook list`.
1 parent be2ae26 commit 76065f0

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

lldb/source/Target/Target.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3992,6 +3992,7 @@ void Target::StopHook::GetDescription(Stream &s,
39923992
s.SetIndentLevel(indent_level + 2);
39933993
}
39943994
GetSubclassDescription(s, level);
3995+
s.SetIndentLevel(indent_level);
39953996
}
39963997

39973998
void Target::StopHookCommandLine::GetSubclassDescription(
@@ -4002,7 +4003,7 @@ void Target::StopHookCommandLine::GetSubclassDescription(
40024003
s.PutCString(m_commands.GetStringAtIndex(0));
40034004
return;
40044005
}
4005-
s.Indent("Commands: \n");
4006+
s.Indent("Commands:\n");
40064007
s.SetIndentLevel(s.GetIndentLevel() + 4);
40074008
uint32_t num_commands = m_commands.GetSize();
40084009
for (uint32_t i = 0; i < num_commands; i++) {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Test format (e.g., indentation) when printing the list of stop hooks.
2+
#
3+
# RUN: %lldb -b -s %s | FileCheck %s --match-full-lines --strict-whitespace
4+
5+
# Create some stop hooks
6+
target stop-hook add -o 'print "Hello"' --auto-continue true --at-initial-stop true
7+
target stop-hook add -o 'print "world,"' -o 'print "nice"' --file 'my_file'
8+
target stop-hook add -o 'print "weather!"' --classname 'MyClass' --thread-name 'my_thread'
9+
10+
# Print hooks
11+
target stop-hook list
12+
13+
# CHECK:(lldb) target stop-hook list
14+
# CHECK:Hook: 1
15+
# CHECK: State: enabled
16+
# CHECK: AutoContinue on
17+
# CHECK: Commands:
18+
# CHECK: print "Hello"
19+
# CHECK-EMPTY:
20+
# CHECK:Hook: 2
21+
# CHECK: State: enabled
22+
# CHECK: Specifier:
23+
# CHECK: File: my_file.
24+
# CHECK: Commands:
25+
# CHECK: print "world,"
26+
# CHECK: print "nice"
27+
# CHECK-EMPTY:
28+
# CHECK:Hook: 3
29+
# CHECK: State: enabled
30+
# CHECK: Specifier:
31+
# CHECK: Class name: MyClass.
32+
# CHECK: Thread:
33+
# CHECK: thread name: "my_thread"
34+
# CHECK: Commands:
35+
# CHECK: print "weather!"
36+
# CHECK-EMPTY:

0 commit comments

Comments
 (0)