@@ -1231,77 +1231,74 @@ class CommandObjectPlatformProcessList : public CommandObjectParsed {
12311231 }
12321232
12331233 if (platform_sp) {
1234- Status error;
1235- if (platform_sp) {
1236- Stream &ostrm = result.GetOutputStream ();
1237-
1238- lldb::pid_t pid = m_options.match_info .GetProcessInfo ().GetProcessID ();
1239- if (pid != LLDB_INVALID_PROCESS_ID) {
1240- ProcessInstanceInfo proc_info;
1241- if (platform_sp->GetProcessInfo (pid, proc_info)) {
1242- ProcessInstanceInfo::DumpTableHeader (ostrm, m_options.show_args ,
1243- m_options.verbose );
1244- proc_info.DumpAsTableRow (ostrm, platform_sp->GetUserIDResolver (),
1245- m_options.show_args , m_options.verbose );
1246- result.SetStatus (eReturnStatusSuccessFinishResult);
1247- } else {
1248- result.AppendErrorWithFormat (
1249- " no process found with pid = %" PRIu64 " \n " , pid);
1250- }
1234+ Stream &ostrm = result.GetOutputStream ();
1235+
1236+ lldb::pid_t pid = m_options.match_info .GetProcessInfo ().GetProcessID ();
1237+ if (pid != LLDB_INVALID_PROCESS_ID) {
1238+ ProcessInstanceInfo proc_info;
1239+ if (platform_sp->GetProcessInfo (pid, proc_info)) {
1240+ ProcessInstanceInfo::DumpTableHeader (ostrm, m_options.show_args ,
1241+ m_options.verbose );
1242+ proc_info.DumpAsTableRow (ostrm, platform_sp->GetUserIDResolver (),
1243+ m_options.show_args , m_options.verbose );
1244+ result.SetStatus (eReturnStatusSuccessFinishResult);
12511245 } else {
1252- ProcessInstanceInfoList proc_infos;
1253- const uint32_t matches =
1254- platform_sp->FindProcesses (m_options.match_info , proc_infos);
1255- const char *match_desc = nullptr ;
1256- const char *match_name =
1257- m_options.match_info .GetProcessInfo ().GetName ();
1258- if (match_name && match_name[0 ]) {
1259- switch (m_options.match_info .GetNameMatchType ()) {
1260- case NameMatch::Ignore:
1261- break ;
1262- case NameMatch::Equals:
1263- match_desc = " matched" ;
1264- break ;
1265- case NameMatch::Contains:
1266- match_desc = " contained" ;
1267- break ;
1268- case NameMatch::StartsWith:
1269- match_desc = " started with" ;
1270- break ;
1271- case NameMatch::EndsWith:
1272- match_desc = " ended with" ;
1273- break ;
1274- case NameMatch::RegularExpression:
1275- match_desc = " matched the regular expression" ;
1276- break ;
1277- }
1246+ result.AppendErrorWithFormat (
1247+ " no process found with pid = %" PRIu64 " \n " , pid);
1248+ }
1249+ } else {
1250+ ProcessInstanceInfoList proc_infos;
1251+ const uint32_t matches =
1252+ platform_sp->FindProcesses (m_options.match_info , proc_infos);
1253+ const char *match_desc = nullptr ;
1254+ const char *match_name =
1255+ m_options.match_info .GetProcessInfo ().GetName ();
1256+ if (match_name && match_name[0 ]) {
1257+ switch (m_options.match_info .GetNameMatchType ()) {
1258+ case NameMatch::Ignore:
1259+ break ;
1260+ case NameMatch::Equals:
1261+ match_desc = " matched" ;
1262+ break ;
1263+ case NameMatch::Contains:
1264+ match_desc = " contained" ;
1265+ break ;
1266+ case NameMatch::StartsWith:
1267+ match_desc = " started with" ;
1268+ break ;
1269+ case NameMatch::EndsWith:
1270+ match_desc = " ended with" ;
1271+ break ;
1272+ case NameMatch::RegularExpression:
1273+ match_desc = " matched the regular expression" ;
1274+ break ;
12781275 }
1276+ }
12791277
1280- if (matches == 0 ) {
1281- if (match_desc)
1282- result.AppendErrorWithFormatv (
1283- " no processes were found that {0} \" {1}\" on the \" {2}\" "
1284- " platform\n " ,
1285- match_desc, match_name, platform_sp->GetName ());
1286- else
1287- result.AppendErrorWithFormatv (
1288- " no processes were found on the \" {0}\" platform\n " ,
1289- platform_sp->GetName ());
1290- } else {
1291- result.AppendMessageWithFormatv (
1292- " {0} matching process{1} found on \" {2}\" " , matches,
1293- matches > 1 ? " es were" : " was" , platform_sp->GetName ());
1294- if (match_desc)
1295- result.AppendMessageWithFormat (" whose name %s \" %s\" " ,
1296- match_desc, match_name);
1297- result.AppendMessageWithFormat (" \n " );
1298- ProcessInstanceInfo::DumpTableHeader (ostrm, m_options.show_args ,
1299- m_options.verbose );
1300- for (uint32_t i = 0 ; i < matches; ++i) {
1301- proc_infos[i].DumpAsTableRow (
1302- ostrm, platform_sp->GetUserIDResolver (), m_options.show_args ,
1303- m_options.verbose );
1304- }
1278+ if (matches == 0 ) {
1279+ if (match_desc)
1280+ result.AppendErrorWithFormatv (
1281+ " no processes were found that {0} \" {1}\" on the \" {2}\" "
1282+ " platform\n " ,
1283+ match_desc, match_name, platform_sp->GetName ());
1284+ else
1285+ result.AppendErrorWithFormatv (
1286+ " no processes were found on the \" {0}\" platform\n " ,
1287+ platform_sp->GetName ());
1288+ } else {
1289+ result.AppendMessageWithFormatv (
1290+ " {0} matching process{1} found on \" {2}\" " , matches,
1291+ matches > 1 ? " es were" : " was" , platform_sp->GetName ());
1292+ if (match_desc)
1293+ result.AppendMessageWithFormat (" whose name %s \" %s\" " , match_desc,
1294+ match_name);
1295+ result.AppendMessageWithFormat (" \n " );
1296+ ProcessInstanceInfo::DumpTableHeader (ostrm, m_options.show_args ,
1297+ m_options.verbose );
1298+ for (uint32_t i = 0 ; i < matches; ++i) {
1299+ proc_infos[i].DumpAsTableRow (
1300+ ostrm, platform_sp->GetUserIDResolver (), m_options.show_args ,
1301+ m_options.verbose );
13051302 }
13061303 }
13071304 }
0 commit comments