@@ -150,6 +150,8 @@ class CommandObjectPlatformSelect : public CommandObjectParsed {
150
150
{
151
151
m_option_group.Append (&m_platform_options, LLDB_OPT_SET_ALL, 1 );
152
152
m_option_group.Finalize ();
153
+ CommandArgumentData platform_arg{eArgTypePlatform, eArgRepeatPlain};
154
+ m_arguments.push_back ({platform_arg});
153
155
}
154
156
155
157
~CommandObjectPlatformSelect () override = default ;
@@ -271,7 +273,10 @@ class CommandObjectPlatformConnect : public CommandObjectParsed {
271
273
: CommandObjectParsed(
272
274
interpreter, " platform connect" ,
273
275
" Select the current platform by providing a connection URL." ,
274
- " platform connect <connect-url>" , 0 ) {}
276
+ " platform connect <connect-url>" , 0 ) {
277
+ CommandArgumentData platform_arg{eArgTypeConnectURL, eArgRepeatPlain};
278
+ m_arguments.push_back ({platform_arg});
279
+ }
275
280
276
281
~CommandObjectPlatformConnect () override = default ;
277
282
@@ -415,7 +420,10 @@ class CommandObjectPlatformMkDir : public CommandObjectParsed {
415
420
CommandObjectPlatformMkDir (CommandInterpreter &interpreter)
416
421
: CommandObjectParsed(interpreter, " platform mkdir" ,
417
422
" Make a new directory on the remote end." , nullptr ,
418
- 0 ) {}
423
+ 0 ) {
424
+ CommandArgumentData thread_arg{eArgTypePath, eArgRepeatPlain};
425
+ m_arguments.push_back ({thread_arg});
426
+ }
419
427
420
428
~CommandObjectPlatformMkDir () override = default ;
421
429
@@ -461,7 +469,10 @@ class CommandObjectPlatformFOpen : public CommandObjectParsed {
461
469
public:
462
470
CommandObjectPlatformFOpen (CommandInterpreter &interpreter)
463
471
: CommandObjectParsed(interpreter, " platform file open" ,
464
- " Open a file on the remote end." , nullptr , 0 ) {}
472
+ " Open a file on the remote end." , nullptr , 0 ) {
473
+ CommandArgumentData path_arg{eArgTypePath, eArgRepeatPlain};
474
+ m_arguments.push_back ({path_arg});
475
+ }
465
476
466
477
~CommandObjectPlatformFOpen () override = default ;
467
478
@@ -521,7 +532,10 @@ class CommandObjectPlatformFClose : public CommandObjectParsed {
521
532
public:
522
533
CommandObjectPlatformFClose (CommandInterpreter &interpreter)
523
534
: CommandObjectParsed(interpreter, " platform file close" ,
524
- " Close a file on the remote end." , nullptr , 0 ) {}
535
+ " Close a file on the remote end." , nullptr , 0 ) {
536
+ CommandArgumentData path_arg{eArgTypeUnsignedInteger, eArgRepeatPlain};
537
+ m_arguments.push_back ({path_arg});
538
+ }
525
539
526
540
~CommandObjectPlatformFClose () override = default ;
527
541
@@ -562,7 +576,10 @@ class CommandObjectPlatformFRead : public CommandObjectParsed {
562
576
CommandObjectPlatformFRead (CommandInterpreter &interpreter)
563
577
: CommandObjectParsed(interpreter, " platform file read" ,
564
578
" Read data from a file on the remote end." , nullptr ,
565
- 0 ) {}
579
+ 0 ) {
580
+ CommandArgumentData path_arg{eArgTypeUnsignedInteger, eArgRepeatPlain};
581
+ m_arguments.push_back ({path_arg});
582
+ }
566
583
567
584
~CommandObjectPlatformFRead () override = default ;
568
585
@@ -655,7 +672,10 @@ class CommandObjectPlatformFWrite : public CommandObjectParsed {
655
672
CommandObjectPlatformFWrite (CommandInterpreter &interpreter)
656
673
: CommandObjectParsed(interpreter, " platform file write" ,
657
674
" Write data to a file on the remote end." , nullptr ,
658
- 0 ) {}
675
+ 0 ) {
676
+ CommandArgumentData path_arg{eArgTypeUnsignedInteger, eArgRepeatPlain};
677
+ m_arguments.push_back ({path_arg});
678
+ }
659
679
660
680
~CommandObjectPlatformFWrite () override = default ;
661
681
@@ -1070,6 +1090,10 @@ class CommandObjectPlatformPutFile : public CommandObjectParsed {
1070
1090
Relative source file paths are resolved against lldb's local working directory.
1071
1091
1072
1092
Omitting the destination places the file in the platform working directory.)" );
1093
+ CommandArgumentData source_arg{eArgTypePath, eArgRepeatPlain};
1094
+ CommandArgumentData path_arg{eArgTypePath, eArgRepeatOptional};
1095
+ m_arguments.push_back ({source_arg});
1096
+ m_arguments.push_back ({path_arg});
1073
1097
}
1074
1098
1075
1099
~CommandObjectPlatformPutFile () override = default ;
@@ -1121,6 +1145,8 @@ class CommandObjectPlatformProcessLaunch : public CommandObjectParsed {
1121
1145
eCommandRequiresTarget | eCommandTryTargetAPILock) {
1122
1146
m_all_options.Append (&m_options);
1123
1147
m_all_options.Finalize ();
1148
+ CommandArgumentData run_arg_arg{eArgTypeRunArgs, eArgRepeatStar};
1149
+ m_arguments.push_back ({run_arg_arg});
1124
1150
}
1125
1151
1126
1152
~CommandObjectPlatformProcessLaunch () override = default ;
@@ -1229,83 +1255,78 @@ class CommandObjectPlatformProcessList : public CommandObjectParsed {
1229
1255
1230
1256
if (platform_sp) {
1231
1257
Status error;
1232
- if (args.GetArgumentCount () == 0 ) {
1233
- if (platform_sp) {
1234
- Stream &ostrm = result.GetOutputStream ();
1235
-
1236
- lldb::pid_t pid =
1237
- m_options.match_info .GetProcessInfo ().GetProcessID ();
1238
- if (pid != LLDB_INVALID_PROCESS_ID) {
1239
- ProcessInstanceInfo proc_info;
1240
- if (platform_sp->GetProcessInfo (pid, proc_info)) {
1241
- ProcessInstanceInfo::DumpTableHeader (ostrm, m_options.show_args ,
1242
- m_options.verbose );
1243
- proc_info.DumpAsTableRow (ostrm, platform_sp->GetUserIDResolver (),
1244
- m_options.show_args , m_options.verbose );
1245
- result.SetStatus (eReturnStatusSuccessFinishResult);
1246
- } else {
1247
- result.AppendErrorWithFormat (
1248
- " no process found with pid = %" PRIu64 " \n " , pid);
1249
- }
1258
+ if (platform_sp) {
1259
+ Stream &ostrm = result.GetOutputStream ();
1260
+
1261
+ lldb::pid_t pid = m_options.match_info .GetProcessInfo ().GetProcessID ();
1262
+ if (pid != LLDB_INVALID_PROCESS_ID) {
1263
+ ProcessInstanceInfo proc_info;
1264
+ if (platform_sp->GetProcessInfo (pid, proc_info)) {
1265
+ ProcessInstanceInfo::DumpTableHeader (ostrm, m_options.show_args ,
1266
+ m_options.verbose );
1267
+ proc_info.DumpAsTableRow (ostrm, platform_sp->GetUserIDResolver (),
1268
+ m_options.show_args , m_options.verbose );
1269
+ result.SetStatus (eReturnStatusSuccessFinishResult);
1250
1270
} else {
1251
- ProcessInstanceInfoList proc_infos;
1252
- const uint32_t matches =
1253
- platform_sp->FindProcesses (m_options.match_info , proc_infos);
1254
- const char *match_desc = nullptr ;
1255
- const char *match_name =
1256
- m_options.match_info .GetProcessInfo ().GetName ();
1257
- if (match_name && match_name[0 ]) {
1258
- switch (m_options.match_info .GetNameMatchType ()) {
1259
- case NameMatch::Ignore:
1260
- break ;
1261
- case NameMatch::Equals:
1262
- match_desc = " matched" ;
1263
- break ;
1264
- case NameMatch::Contains:
1265
- match_desc = " contained" ;
1266
- break ;
1267
- case NameMatch::StartsWith:
1268
- match_desc = " started with" ;
1269
- break ;
1270
- case NameMatch::EndsWith:
1271
- match_desc = " ended with" ;
1272
- break ;
1273
- case NameMatch::RegularExpression:
1274
- match_desc = " matched the regular expression" ;
1275
- break ;
1276
- }
1271
+ result.AppendErrorWithFormat (
1272
+ " no process found with pid = %" PRIu64 " \n " , pid);
1273
+ }
1274
+ } else {
1275
+ ProcessInstanceInfoList proc_infos;
1276
+ const uint32_t matches =
1277
+ platform_sp->FindProcesses (m_options.match_info , proc_infos);
1278
+ const char *match_desc = nullptr ;
1279
+ const char *match_name =
1280
+ m_options.match_info .GetProcessInfo ().GetName ();
1281
+ if (match_name && match_name[0 ]) {
1282
+ switch (m_options.match_info .GetNameMatchType ()) {
1283
+ case NameMatch::Ignore:
1284
+ break ;
1285
+ case NameMatch::Equals:
1286
+ match_desc = " matched" ;
1287
+ break ;
1288
+ case NameMatch::Contains:
1289
+ match_desc = " contained" ;
1290
+ break ;
1291
+ case NameMatch::StartsWith:
1292
+ match_desc = " started with" ;
1293
+ break ;
1294
+ case NameMatch::EndsWith:
1295
+ match_desc = " ended with" ;
1296
+ break ;
1297
+ case NameMatch::RegularExpression:
1298
+ match_desc = " matched the regular expression" ;
1299
+ break ;
1277
1300
}
1301
+ }
1278
1302
1279
- if (matches == 0 ) {
1280
- if (match_desc)
1281
- result.AppendErrorWithFormatv (
1282
- " no processes were found that {0} \" {1}\" on the \" {2}\" "
1283
- " platform\n " ,
1284
- match_desc, match_name, platform_sp->GetName ());
1285
- else
1286
- result.AppendErrorWithFormatv (
1287
- " no processes were found on the \" {0}\" platform\n " ,
1288
- platform_sp->GetName ());
1289
- } else {
1290
- result.AppendMessageWithFormatv (
1291
- " {0} matching process{1} found on \" {2}\" " , matches,
1292
- matches > 1 ? " es were" : " was" , platform_sp->GetName ());
1293
- if (match_desc)
1294
- result.AppendMessageWithFormat (" whose name %s \" %s\" " ,
1295
- match_desc, match_name);
1296
- result.AppendMessageWithFormat (" \n " );
1297
- ProcessInstanceInfo::DumpTableHeader (ostrm, m_options.show_args ,
1298
- m_options.verbose );
1299
- for (uint32_t i = 0 ; i < matches; ++i) {
1300
- proc_infos[i].DumpAsTableRow (
1301
- ostrm, platform_sp->GetUserIDResolver (),
1302
- m_options.show_args , m_options.verbose );
1303
- }
1303
+ if (matches == 0 ) {
1304
+ if (match_desc)
1305
+ result.AppendErrorWithFormatv (
1306
+ " no processes were found that {0} \" {1}\" on the \" {2}\" "
1307
+ " platform\n " ,
1308
+ match_desc, match_name, platform_sp->GetName ());
1309
+ else
1310
+ result.AppendErrorWithFormatv (
1311
+ " no processes were found on the \" {0}\" platform\n " ,
1312
+ platform_sp->GetName ());
1313
+ } else {
1314
+ result.AppendMessageWithFormatv (
1315
+ " {0} matching process{1} found on \" {2}\" " , matches,
1316
+ matches > 1 ? " es were" : " was" , platform_sp->GetName ());
1317
+ if (match_desc)
1318
+ result.AppendMessageWithFormat (" whose name %s \" %s\" " ,
1319
+ match_desc, match_name);
1320
+ result.AppendMessageWithFormat (" \n " );
1321
+ ProcessInstanceInfo::DumpTableHeader (ostrm, m_options.show_args ,
1322
+ m_options.verbose );
1323
+ for (uint32_t i = 0 ; i < matches; ++i) {
1324
+ proc_infos[i].DumpAsTableRow (
1325
+ ostrm, platform_sp->GetUserIDResolver (), m_options.show_args ,
1326
+ m_options.verbose );
1304
1327
}
1305
1328
}
1306
1329
}
1307
- } else {
1308
- result.AppendError (" invalid args: process list takes only options\n " );
1309
1330
}
1310
1331
} else {
1311
1332
result.AppendError (" no platform is selected\n " );
@@ -1737,7 +1758,10 @@ class CommandObjectPlatformShell : public CommandObjectRaw {
1737
1758
CommandObjectPlatformShell (CommandInterpreter &interpreter)
1738
1759
: CommandObjectRaw(interpreter, " platform shell" ,
1739
1760
" Run a shell command on the current platform." ,
1740
- " platform shell <shell-command>" , 0 ) {}
1761
+ " platform shell <shell-command>" , 0 ) {
1762
+ CommandArgumentData thread_arg{eArgTypeNone, eArgRepeatStar};
1763
+ m_arguments.push_back ({thread_arg});
1764
+ }
1741
1765
1742
1766
~CommandObjectPlatformShell () override = default ;
1743
1767
@@ -1824,7 +1848,12 @@ class CommandObjectPlatformInstall : public CommandObjectParsed {
1824
1848
: CommandObjectParsed(
1825
1849
interpreter, " platform target-install" ,
1826
1850
" Install a target (bundle or executable file) to the remote end." ,
1827
- " platform target-install <local-thing> <remote-sandbox>" , 0 ) {}
1851
+ " platform target-install <local-thing> <remote-sandbox>" , 0 ) {
1852
+ CommandArgumentData local_arg{eArgTypePath, eArgRepeatPlain};
1853
+ CommandArgumentData remote_arg{eArgTypePath, eArgRepeatPlain};
1854
+ m_arguments.push_back ({local_arg});
1855
+ m_arguments.push_back ({remote_arg});
1856
+ }
1828
1857
1829
1858
~CommandObjectPlatformInstall () override = default ;
1830
1859
0 commit comments