@@ -120,6 +120,7 @@ def __init__(self, **kwds):
120
120
self .debug = False
121
121
self .only_errors = False
122
122
self .gdb = False
123
+ self .lldb = False
123
124
self .valgrind = False
124
125
self .massif = False
125
126
self .cachegrind = False
@@ -365,7 +366,7 @@ def __init__(self, options, args):
365
366
# account and check compatibility of the user's specified
366
367
# options.
367
368
if options .timeout < 0 :
368
- if options .gdb or options .debug :
369
+ if options .gdb or options .lldb or options . debug :
369
370
# Interactive debuggers: "infinite" timeout
370
371
options .timeout = 0
371
372
elif options .valgrind or options .massif or options .cachegrind or options .omega :
@@ -1142,7 +1143,7 @@ def _optional_tags_string(self):
1142
1143
1143
1144
def _assemble_cmd (self ):
1144
1145
"""
1145
- Assembles a shell command used in running tests under gdb or valgrind.
1146
+ Assembles a shell command used in running tests under gdb, lldb, or valgrind.
1146
1147
1147
1148
EXAMPLES::
1148
1149
@@ -1154,7 +1155,7 @@ def _assemble_cmd(self):
1154
1155
cmd = "sage-runtests --serial "
1155
1156
opt = dict_difference (self .options .__dict__ , DocTestDefaults ().__dict__ )
1156
1157
if "all" in opt :
1157
- raise ValueError ("You cannot run gdb/valgrind on the whole sage library" )
1158
+ raise ValueError ("You cannot run gdb/lldb/ valgrind on the whole sage library" )
1158
1159
for o in ("all" , "long" , "force_lib" , "verbose" , "failed" , "new" ):
1159
1160
if o in opt :
1160
1161
cmd += "--%s " % o
@@ -1167,7 +1168,7 @@ def _assemble_cmd(self):
1167
1168
1168
1169
def run_val_gdb (self , testing = False ):
1169
1170
"""
1170
- Spawns a subprocess to run tests under the control of gdb or valgrind.
1171
+ Spawns a subprocess to run tests under the control of gdb, lldb, or valgrind.
1171
1172
1172
1173
INPUT:
1173
1174
@@ -1205,6 +1206,10 @@ def run_val_gdb(self, testing=False):
1205
1206
flags = ""
1206
1207
if opt .logfile :
1207
1208
sage_cmd += f" --logfile { shlex .quote (opt .logfile )} "
1209
+ elif opt .lldb :
1210
+ sage_cmd = sage_cmd .replace ('sage-runtests' , '$(command -v sage-runtests)' )
1211
+ cmd = f'''exec lldb --one-line "process launch" --one-line "cont" -- { sys .executable } '''
1212
+ flags = ""
1208
1213
else :
1209
1214
if opt .logfile is None :
1210
1215
default_log = os .path .join (DOT_SAGE , "valgrind" )
@@ -1325,7 +1330,7 @@ def run(self):
1325
1330
1326
1331
"""
1327
1332
opt = self .options
1328
- L = (opt .gdb , opt .valgrind , opt .massif , opt .cachegrind , opt .omega )
1333
+ L = (opt .gdb , opt .lldb , opt . valgrind , opt .massif , opt .cachegrind , opt .omega )
1329
1334
if any (L ):
1330
1335
if L .count (True ) > 1 :
1331
1336
self .log ("You may only specify one of gdb, valgrind/memcheck, massif, cachegrind, omega" )
0 commit comments