OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/crash_handler_host_linux.h" | 5 #include "chrome/browser/crash_handler_host_linux.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/syscall.h> | 10 #include <sys/syscall.h> |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 // We expect the crashing thread to be in sys_read(), waiting for use to | 249 // We expect the crashing thread to be in sys_read(), waiting for use to |
250 // write to |signal_fd|. Most newer kernels where we have the different pid | 250 // write to |signal_fd|. Most newer kernels where we have the different pid |
251 // namespaces also have /proc/[pid]/syscall, so we can look through | 251 // namespaces also have /proc/[pid]/syscall, so we can look through |
252 // |actual_crashing_pid|'s thread group and find the thread that's in the | 252 // |actual_crashing_pid|'s thread group and find the thread that's in the |
253 // read syscall with the right arguments. | 253 // read syscall with the right arguments. |
254 | 254 |
255 std::string expected_syscall_data; | 255 std::string expected_syscall_data; |
256 // /proc/[pid]/syscall is formatted as follows: | 256 // /proc/[pid]/syscall is formatted as follows: |
257 // syscall_number arg1 ... arg6 sp pc | 257 // syscall_number arg1 ... arg6 sp pc |
258 // but we just check syscall_number through arg3. | 258 // but we just check syscall_number through arg3. |
259 StringAppendF(&expected_syscall_data, "%d 0x%x %p 0x1 ", | 259 base::StringAppendF(&expected_syscall_data, "%d 0x%x %p 0x1 ", |
260 SYS_read, tid_fd, tid_buf_addr); | 260 SYS_read, tid_fd, tid_buf_addr); |
261 pid_t crashing_tid = | 261 pid_t crashing_tid = |
262 base::FindThreadIDWithSyscall(crashing_pid, expected_syscall_data); | 262 base::FindThreadIDWithSyscall(crashing_pid, expected_syscall_data); |
263 if (crashing_tid == -1) { | 263 if (crashing_tid == -1) { |
264 // We didn't find the thread we want. Maybe it didn't reach sys_read() | 264 // We didn't find the thread we want. Maybe it didn't reach sys_read() |
265 // yet, or the kernel doesn't support /proc/[pid]/syscall or the thread | 265 // yet, or the kernel doesn't support /proc/[pid]/syscall or the thread |
266 // went away. We'll just take a guess here and assume the crashing | 266 // went away. We'll just take a guess here and assume the crashing |
267 // thread is the thread group leader. | 267 // thread is the thread group leader. |
268 crashing_tid = crashing_pid; | 268 crashing_tid = crashing_pid; |
269 } | 269 } |
270 | 270 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 RendererCrashHandlerHostLinux::RendererCrashHandlerHostLinux() { | 361 RendererCrashHandlerHostLinux::RendererCrashHandlerHostLinux() { |
362 InitCrashUploaderThread(); | 362 InitCrashUploaderThread(); |
363 } | 363 } |
364 | 364 |
365 RendererCrashHandlerHostLinux::~RendererCrashHandlerHostLinux() { | 365 RendererCrashHandlerHostLinux::~RendererCrashHandlerHostLinux() { |
366 } | 366 } |
367 | 367 |
368 void RendererCrashHandlerHostLinux::SetProcessType() { | 368 void RendererCrashHandlerHostLinux::SetProcessType() { |
369 process_type_ = "renderer"; | 369 process_type_ = "renderer"; |
370 } | 370 } |
OLD | NEW |