MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / fbtrace

Function fbtrace

src/jrd/trace/TraceCmdLine.cpp:120–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118{
119
120void fbtrace(UtilSvc* uSvc, TraceSvcIntf* traceSvc)
121{
122 UtilSvc::ArgvType& argv = uSvc->argv;
123 const int argc = argv.getCount();
124
125 bool version = false, help = false;
126 // search for "action" switch, set NULL into recognized argv
127
128 const Switches actSwitches(trace_action_in_sw_table, FB_NELEM(trace_action_in_sw_table),
129 false, true);
130
131 const Switches::in_sw_tab_t* action_sw = NULL;
132 for (int itr = 1; itr < argc; ++itr)
133 {
134 if (!uSvc->isService() && strcmp(argv[itr], "-?") == 0)
135 {
136 help = true;
137 argv[itr] = NULL;
138 break;
139 }
140
141 const Switches::in_sw_tab_t* sw = actSwitches.findSwitch(argv[itr]);
142 if (sw)
143 {
144 if (sw->in_sw == IN_SW_TRACE_VERSION)
145 {
146 version = true;
147 argv[itr] = NULL;
148 continue;
149 }
150 if (action_sw)
151 usage(uSvc, isc_trace_conflict_acts, action_sw->in_sw_name, sw->in_sw_name);
152 else
153 action_sw = sw;
154
155 argv[itr] = NULL;
156 }
157 }
158
159 if (version)
160 {
161 printMsg(1, SafeArg() << FB_VERSION);
162 if (!action_sw)
163 exit(FINI_OK);
164 }
165
166 if (!action_sw)
167 {
168 if (help)
169 usage(uSvc, 0);
170 else
171 usage(uSvc, isc_trace_act_notfound);
172 }
173
174 // search for action's parameters, set NULL into recognized argv
175 const Switches optSwitches(trace_option_in_sw_table, FB_NELEM(trace_option_in_sw_table),
176 false, true);
177 TraceSession session(*getDefaultMemoryPool());

Callers 2

CLIB_ROUTINE mainFunction · 0.85
TRACE_mainFunction · 0.85

Calls 15

getDefaultMemoryPoolFunction · 0.85
fetchPasswordFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
OsErrorClass · 0.85
findSwitchMethod · 0.80
usageFunction · 0.70
printMsgFunction · 0.70
SafeArgClass · 0.50
getCountMethod · 0.45
isServiceMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected