Skip to content

Commit b2aee8d

Browse files
committed
add return, test
1 parent fda9035 commit b2aee8d

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

lldb/source/Commands/CommandObjectSource.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,8 +785,10 @@ class CommandObjectSourceList : public CommandObjectParsed {
785785
if (sc.block == nullptr) {
786786
// Not an inlined function
787787
auto expected_info = sc.function->GetSourceInfo();
788-
if (!expected_info)
788+
if (!expected_info) {
789789
result.AppendError(llvm::toString(expected_info.takeError()));
790+
return 0;
791+
}
790792
start_file = expected_info->first;
791793
start_line = expected_info->second.GetRangeBase();
792794
end_line = expected_info->second.GetRangeEnd();

lldb/test/Shell/Commands/command-source-list.s

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
# RUN: split-file %s %t
44
# RUN: llvm-mc --triple=x86_64-pc-linux -filetype=obj %t/a.s -o %t/a.o
5-
# RUN: %lldb %t/a.o -o "settings set target.source-map . %t" -s %t/commands -o exit | FileCheck %s
5+
# RUN: %lldb %t/a.o -o "settings set target.source-map . %t" \
6+
# RUN: -o "settings set interpreter.stop-command-source-on-error false" \
7+
# RUN: -s %t/commands -o exit 2>&1 | FileCheck %s
68

79
#--- commands
810
# CASE 0: function at the start of the file
@@ -69,9 +71,14 @@ source list -n func3
6971
# CHECK-NEXT: 9 content of file0.c:9
7072
# CHECK-NEXT: 10 content of file0.c:10
7173

72-
# CASE 4: discontinuous function
74+
# CASE 4: function has no line entry with line!=0
7375
source list -n func4
74-
# CHECK-NEXT: source list -n func4
76+
# CHECK-LABEL: source list -n func4
77+
# CHECK: error: Could not find line information for function "func4".
78+
79+
# CASE 5: discontinuous function
80+
source list -n func5
81+
# CHECK-LABEL: source list -n func5
7582
# CHECK-NEXT: File: file0.c
7683
# CHECK-NEXT: 1 content of file0.c:1
7784
# CHECK-NEXT: 2 content of file0.c:2
@@ -119,18 +126,23 @@ func3:
119126
nop
120127
.Lfunc3_end:
121128

122-
func4.__part.1:
129+
func4:
130+
.loc 0 0
131+
nop
132+
.Lfunc4_end:
133+
134+
func5.__part.1:
123135
.loc 0 1
124136
nop
125-
.Lfunc4.__part.1_end:
137+
.Lfunc5.__part.1_end:
126138

127139
.Lpadding:
128140
nop
129141

130-
func4:
142+
func5:
131143
.loc 0 5
132144
nop
133-
.Lfunc4_end:
145+
.Lfunc5_end:
134146

135147
.Ltext_end:
136148

@@ -188,15 +200,15 @@ func4:
188200
.quad .text # DW_AT_low_pc
189201
.quad .Ltext_end # DW_AT_high_pc
190202
.long .Lline_table_start0 # DW_AT_stmt_list
191-
.rept 4
203+
.rept 5
192204
.byte 2 # Abbrev DW_TAG_subprogram
193205
.quad func\+ # DW_AT_low_pc
194206
.quad .Lfunc\+_end # DW_AT_high_pc
195207
.asciz "func\+" # DW_AT_name
196208
.endr
197209
.byte 3 # Abbrev DW_TAG_subprogram
198210
.long .Ldebug_ranges0
199-
.asciz "func4" # DW_AT_name
211+
.asciz "func5" # DW_AT_name
200212
.byte 0 # End Of Children Mark
201213
.Ldebug_info_end0:
202214

@@ -211,11 +223,11 @@ func4:
211223
.long .Ldebug_ranges0-.Lrnglists_table_base0
212224
.Ldebug_ranges0:
213225
.byte 6 # DW_RLE_start_end
214-
.quad func4
215-
.quad .Lfunc4_end
226+
.quad func5
227+
.quad .Lfunc5_end
216228
.byte 6 # DW_RLE_start_end
217-
.quad func4.__part.1
218-
.quad .Lfunc4.__part.1_end
229+
.quad func5.__part.1
230+
.quad .Lfunc5.__part.1_end
219231
.byte 0 # DW_RLE_end_of_list
220232
.Ldebug_list_header_end0:
221233
.section .debug_line,"",@progbits

0 commit comments

Comments
 (0)