]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdCommands.cpp
Merge ^/head r274961 through r276301.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdCommands.cpp
1 //===-- MICmdCommands.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 //++
11 // File:                MICmdCommands.cpp
12 //
13 // Overview:    MI command are registered with the MI command factory.
14 //
15 //                              To implement new MI commands derive a new command class from the command base 
16 //                              class. To enable the new command for interpretation add the new command class
17 //                              to the command factory. The files of relevance are:
18 //                                      MICmdCommands.cpp
19 //                                      MICmdBase.h / .cpp
20 //                                      MICmdCmd.h / .cpp
21 //
22 // Environment: Compilers:      Visual C++ 12.
23 //                                                      gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
24 //                              Libraries:      See MIReadmetxt. 
25 //
26 // Copyright:   None.
27 //--
28
29 // In-house headers:
30 #include "MICmdCommands.h"
31 #include "MICmdFactory.h"
32 #include "MICmdCmd.h"
33 #include "MICmdCmdBreak.h"
34 #include "MICmdCmdData.h"
35 #include "MICmdCmdEnviro.h"
36 #include "MICmdCmdExec.h"
37 #include "MICmdCmdFile.h"
38 #include "MICmdCmdGdbInfo.h"
39 #include "MICmdCmdGdbSet.h"
40 #include "MICmdCmdGdbThread.h"
41 #include "MICmdCmdMiscellanous.h"
42 #include "MICmdCmdStack.h"
43 #include "MICmdCmdSupportInfo.h"
44 #include "MICmdCmdSupportList.h"
45 #include "MICmdCmdTarget.h"
46 #include "MICmdCmdThread.h"
47 #include "MICmdCmdTrace.h"
48 #include "MICmdCmdVar.h"
49
50 namespace MICmnCommands
51 {
52         template< typename T >
53         static bool Register( void );
54 }
55
56 //++ ------------------------------------------------------------------------------------
57 // Details:     Command to command factory registration function. 
58 // Type:        Template function.
59 // Args:        typename T      - A command type class.
60 // Return:      bool  - True = yes command is registered, false = command failed to register.
61 // Throws:      None.
62 //--
63 template< typename T >                                                                                  
64 static bool MICmnCommands::Register( void  )                                                            
65 {                                                                                                                                       
66         static CMICmdFactory & rCmdFactory = CMICmdFactory::Instance();
67         const CMIUtilString strMiCmd = T().GetMiCmd();                          
68         CMICmdFactory::CmdCreatorFnPtr fn = T().GetCmdCreatorFn();      
69         return rCmdFactory.CmdRegister( strMiCmd, fn );                         
70 }                                                                                                                                       
71
72 //++ ------------------------------------------------------------------------------------
73 // Details:     Register commands with MI command factory
74 // Type:        Function.
75 // Args:        None.
76 // Return:      bool  - True = yes all commands are registered, 
77 //                                      false = one or more commands failed to register.
78 // Throws:      None.
79 //--
80 bool MICmnCommands::RegisterAll( void )
81 {
82         bool bOk = MIstatus::success;
83
84         bOk &= Register< CMICmdCmdSupportInfoMiCmdQuery >();
85         bOk &= Register< CMICmdCmdBreakAfter >();
86         bOk &= Register< CMICmdCmdBreakCondition >();
87         bOk &= Register< CMICmdCmdBreakDelete >();
88         bOk &= Register< CMICmdCmdBreakDisable >();
89         bOk &= Register< CMICmdCmdBreakEnable >();
90         bOk &= Register< CMICmdCmdBreakInsert >();
91         bOk &= Register< CMICmdCmdDataDisassemble >();
92         bOk &= Register< CMICmdCmdDataEvaluateExpression >();
93         bOk &= Register< CMICmdCmdDataReadMemoryBytes >();
94         bOk &= Register< CMICmdCmdDataReadMemory >();
95         bOk &= Register< CMICmdCmdDataListRegisterNames >();
96         bOk &= Register< CMICmdCmdDataListRegisterValues >();
97         bOk &= Register< CMICmdCmdDataWriteMemory >();
98         bOk &= Register< CMICmdCmdEnablePrettyPrinting >();
99         bOk &= Register< CMICmdCmdEnvironmentCd >();
100         bOk &= Register< CMICmdCmdExecContinue >();
101         bOk &= Register< CMICmdCmdExecInterrupt >();
102         bOk &= Register< CMICmdCmdExecFinish >();
103         bOk &= Register< CMICmdCmdExecNext >();
104         bOk &= Register< CMICmdCmdExecNextInstruction >();
105         bOk &= Register< CMICmdCmdExecRun >();
106         bOk &= Register< CMICmdCmdExecStep >();
107         bOk &= Register< CMICmdCmdExecStepInstruction >();
108         bOk &= Register< CMICmdCmdFileExecAndSymbols >();
109         bOk &= Register< CMICmdCmdGdbExit >();
110         bOk &= Register< CMICmdCmdGdbInfo >();
111         bOk &= Register< CMICmdCmdGdbSet >();
112         bOk &= Register< CMICmdCmdGdbThread >();
113         bOk &= Register< CMICmdCmdInferiorTtySet >();
114         bOk &= Register< CMICmdCmdInterpreterExec >();
115         bOk &= Register< CMICmdCmdListThreadGroups >();
116         bOk &= Register< CMICmdCmdSource >();
117         bOk &= Register< CMICmdCmdStackInfoDepth >();
118         bOk &= Register< CMICmdCmdStackListFrames >();
119         bOk &= Register< CMICmdCmdStackListArguments >();
120         bOk &= Register< CMICmdCmdStackListLocals >();
121         bOk &= Register< CMICmdCmdSupportListFeatures >();
122         bOk &= Register< CMICmdCmdTargetSelect >();
123         bOk &= Register< CMICmdCmdThreadInfo >();
124         bOk &= Register< CMICmdCmdVarAssign >();
125         bOk &= Register< CMICmdCmdVarCreate >();
126         bOk &= Register< CMICmdCmdVarDelete >();
127         bOk &= Register< CMICmdCmdVarEvaluateExpression >();
128         bOk &= Register< CMICmdCmdVarInfoPathExpression >();
129         bOk &= Register< CMICmdCmdVarListChildren >();
130         bOk &= Register< CMICmdCmdVarSetFormat >();
131         bOk &= Register< CMICmdCmdVarShowAttributes >();
132         bOk &= Register< CMICmdCmdVarUpdate >();
133
134         return bOk;
135 }