Lines Matching refs:crash

120   static CrashQueue* for_crash(const Crash* crash) {  in for_crash()  argument
121 return (crash->crash_type == kDebuggerdJavaBacktrace) ? for_anrs() : for_tombstones(); in for_crash()
124 static CrashQueue* for_crash(const std::unique_ptr<Crash>& crash) { in for_crash() argument
125 return for_crash(crash.get()); in for_crash()
208 bool maybe_enqueue_crash(std::unique_ptr<Crash>&& crash) { in maybe_enqueue_crash() argument
210 queued_requests_.emplace_back(std::move(crash)); in maybe_enqueue_crash()
217 void maybe_dequeue_crashes(void (*handler)(std::unique_ptr<Crash> crash)) { in maybe_dequeue_crashes() argument
284 static void perform_request(std::unique_ptr<Crash> crash) { in perform_request() argument
287 intercept_manager->GetIntercept(crash->crash_pid, crash->crash_type, &output_fd); in perform_request()
289 if (crash->crash_type == kDebuggerdTombstoneProto) { in perform_request()
290 crash->output.proto = CrashArtifact::devnull(); in perform_request()
293 if (auto o = CrashQueue::for_crash(crash.get())->get_output(crash->crash_type); o) { in perform_request()
294 crash->output = std::move(*o); in perform_request()
295 output_fd.reset(dup(crash->output.text.fd)); in perform_request()
297 LOG(ERROR) << "failed to get crash output for type " << crash->crash_type; in perform_request()
305 if (crash->output.proto) { in perform_request()
306 rc = SendFileDescriptors(crash->crash_socket_fd, &response, sizeof(response), output_fd.get(), in perform_request()
307 crash->output.proto->fd.get()); in perform_request()
309 rc = SendFileDescriptors(crash->crash_socket_fd, &response, sizeof(response), output_fd.get()); in perform_request()
325 event_base* base = event_get_base(crash->crash_event); in perform_request()
327 event_assign(crash->crash_event, base, crash->crash_socket_fd, EV_TIMEOUT | EV_READ, in perform_request()
328 crash_completed_cb, crash.get()); in perform_request()
329 event_add(crash->crash_event, &timeout); in perform_request()
330 CrashQueue::for_crash(crash)->on_crash_started(); in perform_request()
333 crash.release(); in perform_request()
339 Crash* crash = new Crash(); in crash_accept_cb() local
344 event* crash_event = event_new(base, sockfd, EV_TIMEOUT | EV_READ, crash_request_cb, crash); in crash_accept_cb()
345 crash->crash_socket_fd.reset(sockfd); in crash_accept_cb()
346 crash->crash_event = crash_event; in crash_accept_cb()
351 std::unique_ptr<Crash> crash(static_cast<Crash*>(arg)); in crash_request_cb() local
378 crash->crash_type = request.packet.dump_request.dump_type; in crash_request_cb()
379 if (crash->crash_type < 0 || crash->crash_type > kDebuggerdTombstoneProto) { in crash_request_cb()
380 LOG(WARNING) << "unexpected crash dump type: " << crash->crash_type; in crash_request_cb()
384 if (crash->crash_type != kDebuggerdJavaBacktrace) { in crash_request_cb()
385 crash->crash_pid = request.packet.dump_request.pid; in crash_request_cb()
398 crash->crash_pid = cr.pid; in crash_request_cb()
401 pid_t crash_pid = crash->crash_pid; in crash_request_cb()
404 if (CrashQueue::for_crash(crash)->maybe_enqueue_crash(std::move(crash))) { in crash_request_cb()
407 perform_request(std::move(crash)); in crash_request_cb()
431 static void crash_completed(borrowed_fd sockfd, std::unique_ptr<Crash> crash) { in crash_completed() argument
433 CrashQueue* queue = CrashQueue::for_crash(crash); in crash_completed()
451 if (crash->output.text.fd == -1) { in crash_completed()
458 if (rename_tombstone_fd(crash->output.text.fd, queue->dir_fd(), paths.text)) { in crash_completed()
459 if (crash->crash_type == kDebuggerdJavaBacktrace) { in crash_completed()
460 LOG(ERROR) << "Traces for pid " << crash->crash_pid << " written to: " << paths.text; in crash_completed()
469 if (crash->output.proto && crash->output.proto->fd != -1) { in crash_completed()
473 rename_tombstone_fd(crash->output.proto->fd, queue->dir_fd(), *paths.proto); in crash_completed()
478 if (crash->output.text.temporary_path) { in crash_completed()
479 rc = unlinkat(queue->dir_fd().get(), crash->output.text.temporary_path->c_str(), 0); in crash_completed()
484 if (crash->output.proto && crash->output.proto->temporary_path) { in crash_completed()
485 rc = unlinkat(queue->dir_fd().get(), crash->output.proto->temporary_path->c_str(), 0); in crash_completed()
493 std::unique_ptr<Crash> crash(static_cast<Crash*>(arg)); in crash_completed_cb() local
494 CrashQueue* queue = CrashQueue::for_crash(crash); in crash_completed_cb()
499 crash_completed(sockfd, std::move(crash)); in crash_completed_cb()