Lines Matching refs:crash
58 // Ownership of Crash is a bit messy.
61 struct Crash {
62 ~Crash() { event_free(crash_event); }
94 static CrashQueue* for_crash(const Crash* crash) {
95 return (crash->crash_type == kDebuggerdJavaBacktrace) ? for_anrs() : for_tombstones();
132 bool maybe_enqueue_crash(Crash* crash) {
134 queued_requests_.push_back(crash);
141 void maybe_dequeue_crashes(void (*handler)(Crash* crash)) {
143 Crash* next_crash = queued_requests_.front();
191 std::deque<Crash*> queued_requests_;
204 static void perform_request(Crash* crash) {
206 if (!intercept_manager->GetIntercept(crash->crash_pid, crash->crash_type, &output_fd)) {
207 std::tie(output_fd, crash->crash_path) = CrashQueue::for_crash(crash)->get_output();
213 ssize_t rc = send_fd(crash->crash_fd, &response, sizeof(response), std::move(output_fd));
218 PLOG(WARNING) << "crash socket write returned short";
224 event_base* base = event_get_base(crash->crash_event);
225 event_assign(crash->crash_event, base, crash->crash_fd, EV_TIMEOUT | EV_READ,
226 crash_completed_cb, crash);
227 event_add(crash->crash_event, &timeout);
230 CrashQueue::for_crash(crash)->on_crash_started();
234 delete crash;
240 Crash* crash = new Crash();
245 event* crash_event = event_new(base, sockfd, EV_TIMEOUT | EV_READ, crash_request_cb, crash);
246 crash->crash_fd.reset(sockfd);
247 crash->crash_event = crash_event;
253 Crash* crash = static_cast<Crash*>(arg);
258 LOG(WARNING) << "crash request timed out";
261 LOG(WARNING) << "tombstoned received unexpected event from crash socket";
267 PLOG(WARNING) << "failed to read from crash socket";
270 LOG(WARNING) << "crash socket received short read of length " << rc << " (expected "
276 LOG(WARNING) << "unexpected crash packet type, expected kDumpRequest, received "
281 crash->crash_type = request.packet.dump_request.dump_type;
282 if (crash->crash_type < 0 || crash->crash_type > kDebuggerdAnyIntercept) {
283 LOG(WARNING) << "unexpected crash dump type: " << crash->crash_type;
287 if (crash->crash_type != kDebuggerdJavaBacktrace) {
288 crash->crash_pid = request.packet.dump_request.pid;
301 crash->crash_pid = cr.pid;
304 LOG(INFO) << "received crash request for pid " << crash->crash_pid;
306 if (CrashQueue::for_crash(crash)->maybe_enqueue_crash(crash)) {
307 LOG(INFO) << "enqueueing crash request for pid " << crash->crash_pid;
309 perform_request(crash);
315 delete crash;
320 Crash* crash = static_cast<Crash*>(arg);
323 CrashQueue::for_crash(crash)->on_crash_completed();
331 PLOG(WARNING) << "failed to read from crash socket";
334 LOG(WARNING) << "crash socket received short read of length " << rc << " (expected "
340 LOG(WARNING) << "unexpected crash packet type, expected kCompletedDump, received "
345 if (!crash->crash_path.empty()) {
346 if (crash->crash_type == kDebuggerdJavaBacktrace) {
347 LOG(ERROR) << "Traces for pid " << crash->crash_pid << " written to: " << crash->crash_path;
350 // tombstone associated with a given native crash was written. Any changes
352 LOG(ERROR) << "Tombstone written to: " << crash->crash_path;
357 CrashQueue* queue = CrashQueue::for_crash(crash);
358 delete crash;
367 // Don't try to connect to ourselves if we crash.