MCPcopy Create free account
hub / github.com/apitrace/apitrace / command

Function command

cli/cli_pickle.cpp:241–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239};
240
241static int
242command(int argc, char *argv[])
243{
244 bool symbolic = false;
245
246 int opt;
247 while ((opt = getopt_long(argc, argv, shortOptions, longOptions, NULL)) != -1) {
248 switch (opt) {
249 case 'h':
250 usage();
251 return 0;
252 case 's':
253 symbolic = true;
254 break;
255 case CALLS_OPT:
256 calls.merge(optarg);
257 break;
258 default:
259 std::cerr << "error: unexpected option `" << (char)opt << "`\n";
260 usage();
261 return 1;
262 }
263 }
264
265 os::setBinaryMode(stdout);
266
267 std::cout.sync_with_stdio(false);
268
269 PickleWriter writer(std::cout);
270 PickleVisitor visitor(writer, symbolic);
271
272 for (int i = optind; i < argc; ++i) {
273 trace::Parser parser;
274
275 if (!parser.open(argv[i])) {
276 return 1;
277 }
278
279 trace::Call *call;
280 while ((call = parser.parse_call())) {
281 if (call->no > calls.getLast()) {
282 delete call;
283 break;
284 }
285 if (calls.contains(*call)) {
286 writer.begin();
287 visitor.visit(call);
288 writer.end();
289 }
290 delete call;
291 }
292 }
293
294 return 0;
295}
296
297const Command pickle_command = {
298 "pickle",

Callers

nothing calls this directly

Calls 10

setBinaryModeFunction · 0.85
mergeMethod · 0.80
getLastMethod · 0.80
usageFunction · 0.70
openMethod · 0.45
parse_callMethod · 0.45
containsMethod · 0.45
beginMethod · 0.45
visitMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected