Skip to content

Commit 3dcf301

Browse files
committed
runtests: support -gl. Like -g but for lldb.
Follow-up to 63b5748 Invokes the test case via lldb instead of gdb. Since using gdb is such a pain on mac, using lldb is sometimes less quirky. Closes curl#12547
1 parent f58e493 commit 3dcf301

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

tests/runner.pm

+18-4
Original file line numberDiff line numberDiff line change
@@ -945,9 +945,16 @@ sub singletest_run {
945945
if($gdbthis) {
946946
my $gdbinit = "$TESTDIR/gdbinit$testnum";
947947
open(my $gdbcmd, ">", "$LOGDIR/gdbcmd") || die "Failure writing gdb file";
948-
print $gdbcmd "set args $cmdargs\n";
949-
print $gdbcmd "show args\n";
950-
print $gdbcmd "source $gdbinit\n" if -e $gdbinit;
948+
if($gdbthis == 1) {
949+
# gdb mode
950+
print $gdbcmd "set args $cmdargs\n";
951+
print $gdbcmd "show args\n";
952+
print $gdbcmd "source $gdbinit\n" if -e $gdbinit;
953+
}
954+
else {
955+
# lldb mode
956+
print $gdbcmd "set args $cmdargs\n";
957+
}
951958
close($gdbcmd) || die "Failure writing gdb file";
952959
}
953960

@@ -963,11 +970,18 @@ sub singletest_run {
963970
$testnum,
964971
"$gdb --directory $LIBDIR " . shell_quote($DBGCURL) . " -x $LOGDIR/gdbcmd");
965972
}
966-
elsif($gdbthis) {
973+
elsif($gdbthis == 1) {
974+
# gdb
967975
my $GDBW = ($gdbxwin) ? "-w" : "";
968976
runclient("$gdb --directory $LIBDIR " . shell_quote($DBGCURL) . " $GDBW -x $LOGDIR/gdbcmd");
969977
$cmdres=0; # makes it always continue after a debugged run
970978
}
979+
elsif($gdbthis == 2) {
980+
# $gdb is "lldb"
981+
print "runs lldb -- $CURL $cmdargs\n";
982+
runclient("lldb -- $CURL $cmdargs");
983+
$cmdres=0; # makes it always continue after a debugged run
984+
}
971985
else {
972986
# Convert the raw result code into a more useful one
973987
($cmdres, $dumped_core) = normalize_cmdres(runclient("$CMDLINE"));

tests/runtests.1

+5
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ Run the given test(s) with gdb. This is best used on a single test case and
116116
curl built --disable-shared. This then fires up gdb with command line set to
117117
run the specified test case. Simply (set a break-point and) type 'run' to
118118
start.
119+
.IP "-gl"
120+
Run the given test(s) with lldb. This is best used on a single test case and
121+
curl built --disable-shared. This then fires up lldb with command line set to
122+
run the specified test case. Simply (set a break-point and) type 'run' to
123+
start.
119124
.IP "-gw"
120125
Run the given test(s) with gdb as a windowed application.
121126
.IP "-h, --help"

tests/runtests.pl

+4
Original file line numberDiff line numberDiff line change
@@ -2215,6 +2215,10 @@ sub pickrunner {
22152215
# run this test with gdb
22162216
$gdbthis=1;
22172217
}
2218+
elsif ($ARGV[0] eq "-gl") {
2219+
# run this test with lldb
2220+
$gdbthis=2;
2221+
}
22182222
elsif ($ARGV[0] eq "-gw") {
22192223
# run this test with windowed gdb
22202224
$gdbthis=1;

0 commit comments

Comments
 (0)