blob: 42ede898c86dc4a522d2c508356f6496e27a7ee5 [file] [log] [blame]
Greg Claytonb1888f22011-03-19 01:12:21 +00001//===-- CommandObjectPlatform.cpp -------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "CommandObjectPlatform.h"
11
12// C Includes
13// C++ Includes
14// Other libraries and framework includes
15// Project includes
16#include "lldb/Core/DataExtractor.h"
17#include "lldb/Core/Debugger.h"
18#include "lldb/Core/PluginManager.h"
19#include "lldb/Interpreter/Args.h"
20#include "lldb/Interpreter/CommandInterpreter.h"
21#include "lldb/Interpreter/CommandReturnObject.h"
22#include "lldb/Target/ExecutionContext.h"
23#include "lldb/Target/Platform.h"
24
25using namespace lldb;
26using namespace lldb_private;
27
28//----------------------------------------------------------------------
29// "platform create <platform-name>"
30//----------------------------------------------------------------------
31class CommandObjectPlatformCreate : public CommandObject
32{
33public:
34 CommandObjectPlatformCreate (CommandInterpreter &interpreter) :
35 CommandObject (interpreter,
36 "platform create",
37 "Create a platform instance by name and select it as the current platform.",
38 "platform create <platform-name>",
39 0)
40 {
41 }
42
43 virtual
44 ~CommandObjectPlatformCreate ()
45 {
46 }
47
48 virtual bool
49 Execute (Args& args, CommandReturnObject &result)
50 {
51 Error error;
52 if (args.GetArgumentCount() == 1)
53 {
54 PlatformSP platform_sp (Platform::Create (args.GetArgumentAtIndex (0), error));
55
56 if (platform_sp)
57 {
58 m_interpreter.GetDebugger().GetPlatformList().Append (platform_sp, true);
59 if (m_options.os_version_major != UINT32_MAX)
60 {
61 platform_sp->SetOSVersion (m_options.os_version_major,
62 m_options.os_version_minor,
63 m_options.os_version_update);
64 }
65
66 platform_sp->GetStatus (result.GetOutputStream());
67 }
68 }
69 else
70 {
Greg Clayton24bc5d92011-03-30 18:16:51 +000071 result.AppendError ("platform create takes a platform name as an argument\n");
Greg Claytonb1888f22011-03-19 01:12:21 +000072 result.SetStatus (eReturnStatusFailed);
73 }
74 return result.Succeeded();
75 }
76
77 virtual Options *
78 GetOptions ()
79 {
80 return &m_options;
81 }
82
83protected:
84
85 class CommandOptions : public Options
86 {
87 public:
88
89 CommandOptions () :
90 os_version_major (UINT32_MAX),
91 os_version_minor (UINT32_MAX),
92 os_version_update (UINT32_MAX)
93 {
94 }
95
96 virtual
97 ~CommandOptions ()
98 {
99 }
100
101 virtual Error
102 SetOptionValue (int option_idx, const char *option_arg)
103 {
104 Error error;
105 char short_option = (char) m_getopt_table[option_idx].val;
106
107 switch (short_option)
108 {
109 case 'v':
110 if (Args::StringToVersion (option_arg,
111 os_version_major,
112 os_version_minor,
113 os_version_update) == option_arg)
114 {
115 error.SetErrorStringWithFormat ("invalid version string '%s'", option_arg);
116 }
117 break;
118
119 default:
120 error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option);
121 break;
122 }
123
124 return error;
125 }
126
127 void
128 ResetOptionValues ()
129 {
130 os_version_major = UINT32_MAX;
131 os_version_minor = UINT32_MAX;
132 os_version_update = UINT32_MAX;
133 }
134
Greg Claytonb3448432011-03-24 21:19:54 +0000135 const OptionDefinition*
Greg Claytonb1888f22011-03-19 01:12:21 +0000136 GetDefinitions ()
137 {
138 return g_option_table;
139 }
140
141 // Options table: Required for subclasses of Options.
142
Greg Claytonb3448432011-03-24 21:19:54 +0000143 static OptionDefinition g_option_table[];
Greg Claytonb1888f22011-03-19 01:12:21 +0000144
145 // Instance variables to hold the values for command options.
146
147 uint32_t os_version_major;
148 uint32_t os_version_minor;
149 uint32_t os_version_update;
150 };
151 CommandOptions m_options;
152};
153
Greg Claytonb3448432011-03-24 21:19:54 +0000154OptionDefinition
Greg Claytonb1888f22011-03-19 01:12:21 +0000155CommandObjectPlatformCreate::CommandOptions::g_option_table[] =
156{
157 { LLDB_OPT_SET_ALL, false, "sdk-version", 'v', required_argument, NULL, 0, eArgTypeNone, "Specify the initial SDK version to use prior to connecting." },
158 { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
159};
160
161//----------------------------------------------------------------------
162// "platform list"
163//----------------------------------------------------------------------
164class CommandObjectPlatformList : public CommandObject
165{
166public:
167 CommandObjectPlatformList (CommandInterpreter &interpreter) :
168 CommandObject (interpreter,
169 "platform list",
170 "List all platforms that are available.",
171 NULL,
172 0)
173 {
174 }
175
176 virtual
177 ~CommandObjectPlatformList ()
178 {
179 }
180
181 virtual bool
182 Execute (Args& args, CommandReturnObject &result)
183 {
184 Stream &ostrm = result.GetOutputStream();
185 ostrm.Printf("Available platforms:\n");
186
187 PlatformSP host_platform_sp (Platform::GetDefaultPlatform());
188 ostrm.Printf ("%s: %s\n",
189 host_platform_sp->GetShortPluginName(),
190 host_platform_sp->GetDescription());
191
192 uint32_t idx;
193 for (idx = 0; 1; ++idx)
194 {
195 const char *plugin_name = PluginManager::GetPlatformPluginNameAtIndex (idx);
196 if (plugin_name == NULL)
197 break;
198 const char *plugin_desc = PluginManager::GetPlatformPluginDescriptionAtIndex (idx);
199 if (plugin_desc == NULL)
200 break;
201 ostrm.Printf("%s: %s\n", plugin_name, plugin_desc);
202 }
203
204 if (idx == 0)
205 {
Greg Clayton58e26e02011-03-24 04:28:38 +0000206 result.AppendError ("no platforms are available\n");
Greg Claytonb1888f22011-03-19 01:12:21 +0000207 result.SetStatus (eReturnStatusFailed);
208 }
Johnny Chen08150312011-03-30 21:19:59 +0000209 else
210 result.SetStatus (eReturnStatusSuccessFinishResult);
Greg Claytonb1888f22011-03-19 01:12:21 +0000211 return result.Succeeded();
212 }
213};
214
215//----------------------------------------------------------------------
216// "platform status"
217//----------------------------------------------------------------------
218class CommandObjectPlatformStatus : public CommandObject
219{
220public:
221 CommandObjectPlatformStatus (CommandInterpreter &interpreter) :
222 CommandObject (interpreter,
223 "platform status",
224 "Display status for the currently selected platform.",
225 NULL,
226 0)
227 {
228 }
229
230 virtual
231 ~CommandObjectPlatformStatus ()
232 {
233 }
234
235 virtual bool
236 Execute (Args& args, CommandReturnObject &result)
237 {
238 Stream &ostrm = result.GetOutputStream();
239
240 PlatformSP selected_platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
241 if (selected_platform_sp)
242 {
243 selected_platform_sp->GetStatus (ostrm);
244 result.SetStatus (eReturnStatusSuccessFinishResult);
245 }
246 else
247 {
Greg Clayton58e26e02011-03-24 04:28:38 +0000248 result.AppendError ("no platform us currently selected\n");
Greg Claytonb1888f22011-03-19 01:12:21 +0000249 result.SetStatus (eReturnStatusFailed);
250 }
251 return result.Succeeded();
252 }
253};
254
255
256//----------------------------------------------------------------------
257// "platform select <platform-name>"
258//----------------------------------------------------------------------
259class CommandObjectPlatformSelect : public CommandObject
260{
261public:
262 CommandObjectPlatformSelect (CommandInterpreter &interpreter) :
263 CommandObject (interpreter,
264 "platform select",
265 "Select a platform by name to be the currently selected platform.",
266 "platform select <platform-name>",
267 0)
268 {
269 }
270
271 virtual
272 ~CommandObjectPlatformSelect ()
273 {
274 }
275
276 virtual bool
277 Execute (Args& args, CommandReturnObject &result)
278 {
Greg Clayton58e26e02011-03-24 04:28:38 +0000279 result.AppendError ("command not implemented\n");
Greg Claytonb1888f22011-03-19 01:12:21 +0000280 result.SetStatus (eReturnStatusFailed);
281 return result.Succeeded();
282 }
283};
284
285
Greg Claytoncb8977d2011-03-23 00:09:55 +0000286//----------------------------------------------------------------------
287// "platform connect <connect-url>"
288//----------------------------------------------------------------------
289class CommandObjectPlatformConnect : public CommandObject
290{
291public:
292 CommandObjectPlatformConnect (CommandInterpreter &interpreter) :
293 CommandObject (interpreter,
294 "platform connect",
295 "Connect a platform by name to be the currently selected platform.",
296 "platform connect <connect-url>",
297 0)
298 {
299 }
300
301 virtual
302 ~CommandObjectPlatformConnect ()
303 {
304 }
305
306 virtual bool
307 Execute (Args& args, CommandReturnObject &result)
308 {
309 Stream &ostrm = result.GetOutputStream();
310
Greg Claytoncb8977d2011-03-23 00:09:55 +0000311 PlatformSP selected_platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
312 if (selected_platform_sp)
313 {
314 Error error (selected_platform_sp->ConnectRemote (args));
315 if (error.Success())
316 {
Greg Claytoncb8977d2011-03-23 00:09:55 +0000317 selected_platform_sp->GetStatus (ostrm);
318 result.SetStatus (eReturnStatusSuccessFinishResult);
319 }
320 else
321 {
Greg Clayton58e26e02011-03-24 04:28:38 +0000322 result.AppendErrorWithFormat ("%s\n", error.AsCString());
Greg Claytoncb8977d2011-03-23 00:09:55 +0000323 result.SetStatus (eReturnStatusFailed);
324 }
325 }
326 else
327 {
Greg Clayton58e26e02011-03-24 04:28:38 +0000328 result.AppendError ("no platform us currently selected\n");
Greg Claytoncb8977d2011-03-23 00:09:55 +0000329 result.SetStatus (eReturnStatusFailed);
330 }
331 return result.Succeeded();
332 }
333};
334
335//----------------------------------------------------------------------
336// "platform disconnect"
337//----------------------------------------------------------------------
338class CommandObjectPlatformDisconnect : public CommandObject
339{
340public:
341 CommandObjectPlatformDisconnect (CommandInterpreter &interpreter) :
342 CommandObject (interpreter,
343 "platform disconnect",
344 "Disconnect a platform by name to be the currently selected platform.",
345 "platform disconnect",
346 0)
347 {
348 }
349
350 virtual
351 ~CommandObjectPlatformDisconnect ()
352 {
353 }
354
355 virtual bool
356 Execute (Args& args, CommandReturnObject &result)
357 {
358 PlatformSP selected_platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
359 if (selected_platform_sp)
360 {
361 if (args.GetArgumentCount() == 0)
362 {
363 Error error;
364
365 if (selected_platform_sp->IsConnected())
366 {
367 // Cache the instance name if there is one since we are
368 // about to disconnect and the name might go with it.
Greg Clayton58e26e02011-03-24 04:28:38 +0000369 const char *hostname_cstr = selected_platform_sp->GetHostname();
370 std::string hostname;
371 if (hostname_cstr)
372 hostname.assign (hostname_cstr);
Greg Claytoncb8977d2011-03-23 00:09:55 +0000373
374 error = selected_platform_sp->DisconnectRemote ();
375 if (error.Success())
376 {
377 Stream &ostrm = result.GetOutputStream();
Greg Clayton58e26e02011-03-24 04:28:38 +0000378 if (hostname.empty())
Greg Claytoncb8977d2011-03-23 00:09:55 +0000379 ostrm.Printf ("Disconnected from \"%s\"\n", selected_platform_sp->GetShortPluginName());
380 else
Greg Clayton58e26e02011-03-24 04:28:38 +0000381 ostrm.Printf ("Disconnected from \"%s\"\n", hostname.c_str());
Greg Claytoncb8977d2011-03-23 00:09:55 +0000382 result.SetStatus (eReturnStatusSuccessFinishResult);
383 }
384 else
385 {
Greg Clayton58e26e02011-03-24 04:28:38 +0000386 result.AppendErrorWithFormat ("%s", error.AsCString());
Greg Claytoncb8977d2011-03-23 00:09:55 +0000387 result.SetStatus (eReturnStatusFailed);
388 }
389 }
390 else
391 {
392 // Not connected...
Greg Clayton58e26e02011-03-24 04:28:38 +0000393 result.AppendErrorWithFormat ("not connected to '%s'", selected_platform_sp->GetShortPluginName());
Greg Claytoncb8977d2011-03-23 00:09:55 +0000394 result.SetStatus (eReturnStatusFailed);
395 }
396 }
397 else
398 {
399 // Bad args
400 result.AppendError ("\"platform disconnect\" doesn't take any arguments");
401 result.SetStatus (eReturnStatusFailed);
402 }
403 }
404 else
405 {
Greg Clayton58e26e02011-03-24 04:28:38 +0000406 result.AppendError ("no platform is currently selected");
Greg Claytoncb8977d2011-03-23 00:09:55 +0000407 result.SetStatus (eReturnStatusFailed);
408 }
409 return result.Succeeded();
410 }
411};
412
413
Greg Clayton24bc5d92011-03-30 18:16:51 +0000414//----------------------------------------------------------------------
415// "platform process list"
416//----------------------------------------------------------------------
417class CommandObjectPlatformProcessList : public CommandObject
418{
419public:
420 CommandObjectPlatformProcessList (CommandInterpreter &interpreter) :
421 CommandObject (interpreter,
422 "platform process list",
423 "List processes on a remote platform by name, pid, or many other matching attributes.",
424 "platform process list",
425 0)
426 {
427 }
428
429 virtual
430 ~CommandObjectPlatformProcessList ()
431 {
432 }
433
434 virtual bool
435 Execute (Args& args, CommandReturnObject &result)
436 {
437 PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
438
439 if (platform_sp)
440 {
441 Error error;
442 if (args.GetArgumentCount() == 0)
443 {
444
445 if (platform_sp)
446 {
447 lldb::pid_t pid = m_options.match_info.GetProcessInfo().GetProcessID();
448 if (pid != LLDB_INVALID_PROCESS_ID)
449 {
450 ProcessInfo proc_info;
451 if (platform_sp->GetProcessInfo (pid, proc_info))
452 {
453 proc_info.Dump (result.GetOutputStream(), platform_sp.get());
454 result.SetStatus (eReturnStatusSuccessFinishResult);
455 }
456 else
457 {
458 result.AppendErrorWithFormat ("no process found with pid = %i\n", pid);
459 result.SetStatus (eReturnStatusFailed);
460 }
461 }
462 else
463 {
464 ProcessInfoList proc_infos;
465 const uint32_t matches = platform_sp->FindProcesses (m_options.match_info, proc_infos);
466 if (matches == 0)
467 {
468 const char *match_desc = NULL;
469 const char *match_name = m_options.match_info.GetProcessInfo().GetName();
470 if (match_name && match_name[0])
471 {
472 switch (m_options.match_info.GetNameMatchType())
473 {
474 case eNameMatchIgnore: break;
475 case eNameMatchEquals: match_desc = "match"; break;
476 case eNameMatchContains: match_desc = "contains"; break;
477 case eNameMatchStartsWith: match_desc = "starts with"; break;
478 case eNameMatchEndsWith: match_desc = "end with"; break;
479 case eNameMatchRegularExpression: match_desc = "match the regular expression"; break;
480 }
481 }
482 if (match_desc)
483 result.AppendErrorWithFormat ("no processes were found that %s \"%s\" on the \"%s\" platform\n",
484 match_desc,
485 match_name,
486 platform_sp->GetShortPluginName());
487 else
488 result.AppendErrorWithFormat ("no processes were found on the \"%s\" platform\n", platform_sp->GetShortPluginName());
489 result.SetStatus (eReturnStatusFailed);
490 }
491 else
492 {
493 Stream &ostrm = result.GetOutputStream();
494
495 ProcessInfo::DumpTableHeader (ostrm, platform_sp.get());
496 for (uint32_t i=0; i<matches; ++i)
497 {
498 proc_infos.GetProcessInfoAtIndex(i).DumpAsTableRow(ostrm, platform_sp.get());
499 }
500 }
501 }
502 }
503 }
504 else
505 {
506 result.AppendError ("invalid args: process list takes only options\n");
507 result.SetStatus (eReturnStatusFailed);
508 }
509 }
510 else
511 {
512 result.AppendError ("no platform is selected\n");
513 result.SetStatus (eReturnStatusFailed);
514 }
515 return result.Succeeded();
516 }
517
518 virtual Options *
519 GetOptions ()
520 {
521 return &m_options;
522 }
523
524protected:
525
526 class CommandOptions : public Options
527 {
528 public:
529
530 CommandOptions () :
531 match_info ()
532 {
533 }
534
535 virtual
536 ~CommandOptions ()
537 {
538 }
539
540 virtual Error
541 SetOptionValue (int option_idx, const char *option_arg)
542 {
543 Error error;
544 char short_option = (char) m_getopt_table[option_idx].val;
545 bool success = false;
546
547 switch (short_option)
548 {
549 case 'p':
550 match_info.GetProcessInfo().SetProcessID (Args::StringToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success));
551 if (!success)
552 error.SetErrorStringWithFormat("invalid process ID string: '%s'", option_arg);
553 break;
554
555 case 'P':
556 match_info.GetProcessInfo().SetParentProcessID (Args::StringToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success));
557 if (!success)
558 error.SetErrorStringWithFormat("invalid parent process ID string: '%s'", option_arg);
559 break;
560
561 case 'u':
562 match_info.GetProcessInfo().SetRealUserID (Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success));
563 if (!success)
564 error.SetErrorStringWithFormat("invalid user ID string: '%s'", option_arg);
565 break;
566
567 case 'U':
568 match_info.GetProcessInfo().SetEffectiveUserID (Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success));
569 if (!success)
570 error.SetErrorStringWithFormat("invalid effective user ID string: '%s'", option_arg);
571 break;
572
573 case 'g':
574 match_info.GetProcessInfo().SetRealGroupID (Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success));
575 if (!success)
576 error.SetErrorStringWithFormat("invalid group ID string: '%s'", option_arg);
577 break;
578
579 case 'G':
580 match_info.GetProcessInfo().SetEffectiveGroupID (Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success));
581 if (!success)
582 error.SetErrorStringWithFormat("invalid effective group ID string: '%s'", option_arg);
583 break;
584
585 case 'a':
586 match_info.GetProcessInfo().GetArchitecture().SetTriple (option_arg);
587 break;
588
589 case 'n':
590 match_info.GetProcessInfo().SetName (option_arg);
591 if (match_info.GetNameMatchType() == eNameMatchIgnore)
592 match_info.SetNameMatchType (eNameMatchEquals);
593 break;
594
595 case 'e':
596 match_info.SetNameMatchType (eNameMatchEndsWith);
597 break;
598
599 case 's':
600 match_info.SetNameMatchType (eNameMatchStartsWith);
601 break;
602
603 case 'c':
604 match_info.SetNameMatchType (eNameMatchContains);
605 break;
606
607 case 'r':
608 match_info.SetNameMatchType (eNameMatchRegularExpression);
609 break;
610
611 default:
612 error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
613 break;
614 }
615
616 return error;
617 }
618
619 void
620 ResetOptionValues ()
621 {
622 match_info.Clear();
623 }
624
625 const OptionDefinition*
626 GetDefinitions ()
627 {
628 return g_option_table;
629 }
630
631 // Options table: Required for subclasses of Options.
632
633 static OptionDefinition g_option_table[];
634
635 // Instance variables to hold the values for command options.
636
637 ProcessInfoMatch match_info;
638 };
639 CommandOptions m_options;
640};
641
642OptionDefinition
643CommandObjectPlatformProcessList::CommandOptions::g_option_table[] =
644{
645{ LLDB_OPT_SET_1, false, "pid" , 'p', required_argument, NULL, 0, eArgTypePid , "List the process info for a specific process ID." },
646{ LLDB_OPT_SET_2|
647 LLDB_OPT_SET_3|
648 LLDB_OPT_SET_4|
649 LLDB_OPT_SET_5, true , "name" , 'n', required_argument, NULL, 0, eArgTypeProcessName , "Find processes that match the supplied name." },
650{ LLDB_OPT_SET_2, false, "ends-with" , 'e', no_argument , NULL, 0, eArgTypeNone , "Process names must end with the name supplied with the --name option." },
651{ LLDB_OPT_SET_3, false, "starts-with" , 's', no_argument , NULL, 0, eArgTypeNone , "Process names must start with the name supplied with the --name option." },
652{ LLDB_OPT_SET_4, false, "contains" , 'c', no_argument , NULL, 0, eArgTypeNone , "Process names must contain the name supplied with the --name option." },
653{ LLDB_OPT_SET_5, false, "regex" , 'r', no_argument , NULL, 0, eArgTypeNone , "Process names must match name supplied with the --name option as a regular expression." },
654{ LLDB_OPT_SET_2|
655 LLDB_OPT_SET_3|
656 LLDB_OPT_SET_4|
657 LLDB_OPT_SET_5|
658 LLDB_OPT_SET_6, false, "parent" , 'P', required_argument, NULL, 0, eArgTypePid , "Find processes that have a matching parent process ID." },
659{ LLDB_OPT_SET_2|
660 LLDB_OPT_SET_3|
661 LLDB_OPT_SET_4|
662 LLDB_OPT_SET_5|
663 LLDB_OPT_SET_6, false, "uid" , 'u', required_argument, NULL, 0, eArgTypeNone , "Find processes that have a matching user ID." },
664{ LLDB_OPT_SET_2|
665 LLDB_OPT_SET_3|
666 LLDB_OPT_SET_4|
667 LLDB_OPT_SET_5|
668 LLDB_OPT_SET_6, false, "euid" , 'U', required_argument, NULL, 0, eArgTypeNone , "Find processes that have a matching effective user ID." },
669{ LLDB_OPT_SET_2|
670 LLDB_OPT_SET_3|
671 LLDB_OPT_SET_4|
672 LLDB_OPT_SET_5|
673 LLDB_OPT_SET_6, false, "gid" , 'g', required_argument, NULL, 0, eArgTypeNone , "Find processes that have a matching group ID." },
674{ LLDB_OPT_SET_2|
675 LLDB_OPT_SET_3|
676 LLDB_OPT_SET_4|
677 LLDB_OPT_SET_5|
678 LLDB_OPT_SET_6, false, "egid" , 'G', required_argument, NULL, 0, eArgTypeNone , "Find processes that have a matching effective group ID." },
679{ LLDB_OPT_SET_2|
680 LLDB_OPT_SET_3|
681 LLDB_OPT_SET_4|
682 LLDB_OPT_SET_5|
683 LLDB_OPT_SET_6, false, "arch" , 'a', required_argument, NULL, 0, eArgTypeArchitecture , "Find processes that have a matching architecture." },
684{ 0 , false, NULL , 0 , 0 , NULL, 0, eArgTypeNone , NULL }
685};
686
687class CommandObjectPlatformProcess : public CommandObjectMultiword
688{
689public:
690 //------------------------------------------------------------------
691 // Constructors and Destructors
692 //------------------------------------------------------------------
693 CommandObjectPlatformProcess (CommandInterpreter &interpreter) :
694 CommandObjectMultiword (interpreter,
695 "platform process",
696 "A set of commands to query, launch and attach to platform processes",
697 "platform process [attach|launch|list] ...")
698 {
699// LoadSubCommand ("attach", CommandObjectSP (new CommandObjectPlatformProcessAttach (interpreter)));
700// LoadSubCommand ("launch", CommandObjectSP (new CommandObjectPlatformProcessLaunch (interpreter)));
701 LoadSubCommand ("list" , CommandObjectSP (new CommandObjectPlatformProcessList (interpreter)));
702
703 }
704
705 virtual
706 ~CommandObjectPlatformProcess ()
707 {
708 }
709
710private:
711 //------------------------------------------------------------------
712 // For CommandObjectPlatform only
713 //------------------------------------------------------------------
714 DISALLOW_COPY_AND_ASSIGN (CommandObjectPlatformProcess);
715};
Greg Claytonb1888f22011-03-19 01:12:21 +0000716
717//----------------------------------------------------------------------
718// CommandObjectPlatform constructor
719//----------------------------------------------------------------------
720CommandObjectPlatform::CommandObjectPlatform(CommandInterpreter &interpreter) :
721 CommandObjectMultiword (interpreter,
722 "platform",
723 "A set of commands to manage and create platforms.",
Greg Claytoncb8977d2011-03-23 00:09:55 +0000724 "platform [connect|create|disconnect|list|status|select] ...")
Greg Claytonb1888f22011-03-19 01:12:21 +0000725{
726 LoadSubCommand ("create", CommandObjectSP (new CommandObjectPlatformCreate (interpreter)));
727 LoadSubCommand ("list" , CommandObjectSP (new CommandObjectPlatformList (interpreter)));
728 LoadSubCommand ("select", CommandObjectSP (new CommandObjectPlatformSelect (interpreter)));
729 LoadSubCommand ("status", CommandObjectSP (new CommandObjectPlatformStatus (interpreter)));
Greg Claytoncb8977d2011-03-23 00:09:55 +0000730 LoadSubCommand ("connect", CommandObjectSP (new CommandObjectPlatformConnect (interpreter)));
731 LoadSubCommand ("disconnect", CommandObjectSP (new CommandObjectPlatformDisconnect (interpreter)));
Greg Clayton24bc5d92011-03-30 18:16:51 +0000732 LoadSubCommand ("process", CommandObjectSP (new CommandObjectPlatformProcess (interpreter)));
Greg Claytonb1888f22011-03-19 01:12:21 +0000733}
734
735
736//----------------------------------------------------------------------
737// Destructor
738//----------------------------------------------------------------------
739CommandObjectPlatform::~CommandObjectPlatform()
740{
741}