35
35
command script add -f {python_command}.connect_command connect\n\
36
36
command script add -s asynchronous -f {python_command}.run_command run\n\
37
37
command script add -s asynchronous -f {python_command}.autoexit_command autoexit\n\
38
+ command script add -s asynchronous -f {python_command}.safequit_command safequit\n\
38
39
connect\n\
39
40
")
40
41
@@ -44,6 +45,12 @@ const char* lldb_prep_interactive_cmds = "\
44
45
run\n\
45
46
" ;
46
47
48
+ const char * lldb_prep_noninteractive_justlaunch_cmds = "\
49
+ run\n\
50
+ detach\n\
51
+ safequit\n\
52
+ " ;
53
+
47
54
const char * lldb_prep_noninteractive_cmds = "\
48
55
run\n\
49
56
autoexit\n\
@@ -88,7 +95,15 @@ def run_command(debugger, command, result, internal_dict):\n\
88
95
error = lldb.SBError()\n\
89
96
lldb.target.modules[0].SetPlatformFileSpec(lldb.SBFileSpec(device_app))\n\
90
97
lldb.target.Launch(lldb.SBLaunchInfo(shlex.split('{args}')), error)\n\
91
- print str(error)\n\
98
+ lockedstr = ': Locked'\n\
99
+ if lockedstr in str(error):\n\
100
+ print('\\nDevice Locked\\n')\n\
101
+ sys.exit(254)\n\
102
+ else:\n\
103
+ print(str(error))\n\
104
+ \n\
105
+ def safequit_command(debugger, command, result, internal_dict):\n\
106
+ sys.exit(0);\n\
92
107
\n\
93
108
def autoexit_command(debugger, command, result, internal_dict):\n\
94
109
process = lldb.target.process\n\
@@ -135,6 +150,7 @@ char *target_filename = NULL;
135
150
char * upload_pathname = NULL ;
136
151
char * bundle_id = NULL ;
137
152
bool interactive = true;
153
+ bool justlaunch = false;
138
154
char * app_path = NULL ;
139
155
char * device_id = NULL ;
140
156
char * args = NULL ;
@@ -688,7 +704,12 @@ void write_lldb_prep_cmds(AMDeviceRef device, CFURLRef disk_app_url) {
688
704
// Write additional commands based on mode we're running in
689
705
const char * extra_cmds ;
690
706
if (!interactive )
691
- extra_cmds = lldb_prep_noninteractive_cmds ;
707
+ {
708
+ if (justlaunch )
709
+ extra_cmds = lldb_prep_noninteractive_justlaunch_cmds ;
710
+ else
711
+ extra_cmds = lldb_prep_noninteractive_cmds ;
712
+ }
692
713
else if (nostart )
693
714
extra_cmds = lldb_prep_no_cmds ;
694
715
else
@@ -1335,6 +1356,7 @@ void usage(const char* app) {
1335
1356
" -x, --gdbexec <file> GDB commands script file\n"
1336
1357
" -n, --nostart do not start the app when debugging\n"
1337
1358
" -I, --noninteractive start in non interactive mode (quit when app crashes or exits)\n"
1359
+ " -L, --justlaunch just launch the app and exit lldb\n"
1338
1360
" -v, --verbose enable verbose output\n"
1339
1361
" -m, --noinstall directly start debugging without app install (-d not required)\n"
1340
1362
" -p, --port <number> port used for device, default: 12345 \n"
@@ -1363,6 +1385,7 @@ int main(int argc, char *argv[]) {
1363
1385
{ "unbuffered" , no_argument , NULL , 'u' },
1364
1386
{ "nostart" , no_argument , NULL , 'n' },
1365
1387
{ "noninteractive" , no_argument , NULL , 'I' },
1388
+ { "justlaunch" , no_argument , NULL , 'L' },
1366
1389
{ "detect" , no_argument , NULL , 'c' },
1367
1390
{ "version" , no_argument , NULL , 'V' },
1368
1391
{ "noinstall" , no_argument , NULL , 'm' },
@@ -1376,7 +1399,7 @@ int main(int argc, char *argv[]) {
1376
1399
};
1377
1400
char ch ;
1378
1401
1379
- while ((ch = getopt_long (argc , argv , "VmcdvunlrIi :b:a:t:g:x:p:1:2:o:" , longopts , NULL )) != -1 )
1402
+ while ((ch = getopt_long (argc , argv , "VmcdvunlrILi :b:a:t:g:x:p:1:2:o:" , longopts , NULL )) != -1 )
1380
1403
{
1381
1404
switch (ch ) {
1382
1405
case 'm' :
@@ -1410,6 +1433,10 @@ int main(int argc, char *argv[]) {
1410
1433
case 'I' :
1411
1434
interactive = false;
1412
1435
break ;
1436
+ case 'L' :
1437
+ interactive = false;
1438
+ justlaunch = true;
1439
+ break ;
1413
1440
case 'c' :
1414
1441
detect_only = true;
1415
1442
break ;
0 commit comments