| OLD | NEW |
| 1 // Copyright (c) 2009, Google Inc. | 1 // Copyright (c) 2009, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 // This code is a little fragmented. Different functions of the ExceptionHandler | 59 // This code is a little fragmented. Different functions of the ExceptionHandler |
| 60 // class run in a number of different contexts. Some of them run in a normal | 60 // class run in a number of different contexts. Some of them run in a normal |
| 61 // context and are easy to code, others run in a compromised context and the | 61 // context and are easy to code, others run in a compromised context and the |
| 62 // restrictions at the top of minidump_writer.cc apply: no libc and use the | 62 // restrictions at the top of minidump_writer.cc apply: no libc and use the |
| 63 // alternative malloc. Each function should have comment above it detailing the | 63 // alternative malloc. Each function should have comment above it detailing the |
| 64 // context which it runs in. | 64 // context which it runs in. |
| 65 | 65 |
| 66 #include "breakpad/linux/exception_handler.h" | 66 #include "breakpad/linux/exception_handler.h" |
| 67 | 67 |
| 68 #include <unistd.h> | 68 #include <errno.h> |
| 69 #include <fcntl.h> | 69 #include <fcntl.h> |
| 70 #include <linux/limits.h> |
| 71 #include <sched.h> |
| 72 #include <signal.h> |
| 70 #include <sys/mman.h> | 73 #include <sys/mman.h> |
| 71 #include <errno.h> | |
| 72 #include <signal.h> | |
| 73 #include <sys/signal.h> | 74 #include <sys/signal.h> |
| 75 #include <sys/syscall.h> |
| 74 #include <sys/ucontext.h> | 76 #include <sys/ucontext.h> |
| 75 #include <sys/user.h> | 77 #include <sys/user.h> |
| 76 #include <sys/syscall.h> | |
| 77 #include <sys/wait.h> | 78 #include <sys/wait.h> |
| 78 #include <sched.h> | 79 #include <unistd.h> |
| 79 | 80 |
| 80 #include "breakpad/linux/linux_syscall_support.h" | 81 #include "breakpad/linux/linux_syscall_support.h" |
| 81 #include "breakpad/linux/memory.h" | 82 #include "breakpad/linux/memory.h" |
| 82 #include "breakpad/linux/minidump_writer.h" | 83 #include "breakpad/linux/minidump_writer.h" |
| 83 #include "common/linux/guid_creator.h" | 84 #include "common/linux/guid_creator.h" |
| 84 | 85 |
| 85 // A wrapper for the tgkill syscall: send a signal to a specific thread. | 86 // A wrapper for the tgkill syscall: send a signal to a specific thread. |
| 86 static int tgkill(pid_t tgid, pid_t tid, int sig) { | 87 static int tgkill(pid_t tgid, pid_t tid, int sig) { |
| 87 syscall(__NR_tgkill, tgid, tid, sig); | 88 syscall(__NR_tgkill, tgid, tid, sig); |
| 88 } | 89 } |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 300 |
| 300 // This function runs in a compromised context: see the top of the file. | 301 // This function runs in a compromised context: see the top of the file. |
| 301 // Runs on the cloned process. | 302 // Runs on the cloned process. |
| 302 bool ExceptionHandler::DoDump(pid_t crashing_process, const void* context, | 303 bool ExceptionHandler::DoDump(pid_t crashing_process, const void* context, |
| 303 size_t context_size) { | 304 size_t context_size) { |
| 304 return google_breakpad::WriteMinidump( | 305 return google_breakpad::WriteMinidump( |
| 305 next_minidump_path_c_, crashing_process, context, context_size); | 306 next_minidump_path_c_, crashing_process, context, context_size); |
| 306 } | 307 } |
| 307 | 308 |
| 308 } // namespace google_breakpad | 309 } // namespace google_breakpad |
| OLD | NEW |