blob: 8dc6172fc4d3c32a1e6fc49be5bafc86f965b7e0 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <fuchsia/crash/cpp/fidl.h>
#include <lib/async-loop/cpp/loop.h>
#include <lib/fidl/cpp/binding_set.h>
#include <lib/sys/cpp/component_context.h>
#include <lib/syslog/cpp/logger.h>
#include <utility>
#include "src/developer/crashpad_agent/crashpad_agent.h"
int main(int argc, const char** argv) {
syslog::InitLogger({"crash"});
async::Loop loop(&kAsyncLoopConfigAttachToThread);
auto context = sys::ComponentContext::Create();
std::unique_ptr<fuchsia::crash::CrashpadAgent> agent =
fuchsia::crash::CrashpadAgent::TryCreate(loop.dispatcher(),
context->svc());
if (!agent) {
return EXIT_FAILURE;
}
fidl::BindingSet<fuchsia::crash::Analyzer> bindings;
context->outgoing()->AddPublicService(bindings.GetHandler(agent.get()));
loop.Run();
return EXIT_SUCCESS;
}