9213 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
9213 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
9214 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
9214 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
9215 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
9215 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
9216 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
9216 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
9217 |
9217 |
9218 -#include <signal.h> |
|
9219 -#include <sys/stat.h> |
|
9220 -#include <sys/types.h> |
|
9221 -#include <unistd.h> |
|
9222 -#include <stdio.h> |
|
9223 +// The ExceptionHandler object installs signal handlers for a number of |
9218 +// The ExceptionHandler object installs signal handlers for a number of |
9224 +// signals. We rely on the signal handler running on the thread which crashed |
9219 +// signals. We rely on the signal handler running on the thread which crashed |
9225 +// in order to identify it. This is true of the synchronous signals (SEGV etc), |
9220 +// in order to identify it. This is true of the synchronous signals (SEGV etc), |
9226 +// but not true of ABRT. Thus, if you send ABRT to yourself in a program which |
9221 +// but not true of ABRT. Thus, if you send ABRT to yourself in a program which |
9227 +// uses ExceptionHandler, you need to use tgkill to direct it to the current |
9222 +// uses ExceptionHandler, you need to use tgkill to direct it to the current |
9246 +// DoDump (writes minidump) |
9241 +// DoDump (writes minidump) |
9247 +// | |
9242 +// | |
9248 +// V |
9243 +// V |
9249 +// sys_exit |
9244 +// sys_exit |
9250 +// |
9245 +// |
9251 |
9246 + |
9252 -#include <cassert> |
|
9253 -#include <cstdlib> |
|
9254 -#include <ctime> |
|
9255 -#include <linux/limits.h> |
|
9256 +// This code is a little fragmented. Different functions of the ExceptionHandler |
9247 +// This code is a little fragmented. Different functions of the ExceptionHandler |
9257 +// class run in a number of different contexts. Some of them run in a normal |
9248 +// class run in a number of different contexts. Some of them run in a normal |
9258 +// context and are easy to code, others run in a compromised context and the |
9249 +// context and are easy to code, others run in a compromised context and the |
9259 +// restrictions at the top of minidump_writer.cc apply: no libc and use the |
9250 +// restrictions at the top of minidump_writer.cc apply: no libc and use the |
9260 +// alternative malloc. Each function should have comment above it detailing the |
9251 +// alternative malloc. Each function should have comment above it detailing the |
9261 +// context which it runs in. |
9252 +// context which it runs in. |
9262 |
9253 + |
9263 #include "client/linux/handler/exception_handler.h" |
9254 +#include "client/linux/handler/exception_handler.h" |
9264 + |
9255 + |
9265 +#include <errno.h> |
9256 +#include <errno.h> |
9266 +#include <fcntl.h> |
9257 +#include <fcntl.h> |
9267 +#include <linux/limits.h> |
9258 +#include <linux/limits.h> |
9268 +#include <sched.h> |
9259 +#include <sched.h> |
9269 +#include <signal.h> |
9260 #include <signal.h> |
|
9261 -#include <sys/stat.h> |
|
9262 -#include <sys/types.h> |
9270 +#include <stdio.h> |
9263 +#include <stdio.h> |
9271 +#include <sys/mman.h> |
9264 +#include <sys/mman.h> |
9272 +#include <sys/signal.h> |
9265 +#include <sys/signal.h> |
9273 +#include <sys/syscall.h> |
9266 +#include <sys/syscall.h> |
9274 +#include <sys/ucontext.h> |
9267 +#include <sys/ucontext.h> |
9275 +#include <sys/user.h> |
9268 +#include <sys/user.h> |
9276 +#include <sys/wait.h> |
9269 +#include <sys/wait.h> |
9277 +#include <ucontext.h> |
9270 +#include <ucontext.h> |
9278 +#include <unistd.h> |
9271 #include <unistd.h> |
9279 + |
9272 |
|
9273 -#include <cassert> |
|
9274 -#include <cstdlib> |
|
9275 -#include <cstdio> |
|
9276 -#include <ctime> |
|
9277 -#include <linux/limits.h> |
9280 +#include "common/linux/linux_libc_support.h" |
9278 +#include "common/linux/linux_libc_support.h" |
9281 +#include "common/linux/linux_syscall_support.h" |
9279 +#include "common/linux/linux_syscall_support.h" |
9282 +#include "common/linux/memory.h" |
9280 +#include "common/linux/memory.h" |
9283 +#include "client/linux/minidump_writer/minidump_writer.h" |
9281 +#include "client/linux/minidump_writer/minidump_writer.h" |
9284 #include "common/linux/guid_creator.h" |
9282 +#include "common/linux/guid_creator.h" |
|
9283 |
|
9284 -#include "client/linux/handler/exception_handler.h" |
|
9285 -#include "common/linux/guid_creator.h" |
9285 -#include "google_breakpad/common/minidump_format.h" |
9286 -#include "google_breakpad/common/minidump_format.h" |
9286 + |
|
9287 +// A wrapper for the tgkill syscall: send a signal to a specific thread. |
9287 +// A wrapper for the tgkill syscall: send a signal to a specific thread. |
9288 +static int tgkill(pid_t tgid, pid_t tid, int sig) { |
9288 +static int tgkill(pid_t tgid, pid_t tid, int sig) { |
9289 + syscall(__NR_tgkill, tgid, tid, sig); |
9289 + syscall(__NR_tgkill, tgid, tid, sig); |
9290 + return 0; |
9290 + return 0; |
9291 +} |
9291 +} |
11272 -#include <unistd.h> |
11272 -#include <unistd.h> |
11273 -#include <sys/utsname.h> |
11273 -#include <sys/utsname.h> |
11274 -#include <sys/wait.h> |
11274 -#include <sys/wait.h> |
11275 - |
11275 - |
11276 -#include <cstdlib> |
11276 -#include <cstdlib> |
|
11277 -#include <cstdio> |
11277 -#include <ctime> |
11278 -#include <ctime> |
11278 -#include <string.h> |
11279 -#include <string.h> |
11279 -#include <stdio.h> |
|
11280 - |
11280 - |
11281 -#include "common/linux/file_id.h" |
11281 -#include "common/linux/file_id.h" |
11282 -#include "client/linux/handler/linux_thread.h" |
11282 -#include "client/linux/handler/linux_thread.h" |
11283 -#include "client/minidump_file_writer.h" |
11283 -#include "client/minidump_file_writer.h" |
11284 -#include "client/minidump_file_writer-inl.h" |
11284 -#include "client/minidump_file_writer-inl.h" |
40951 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
40951 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
40952 |
40952 |
40953 -#include <a.out.h> |
40953 -#include <a.out.h> |
40954 -#include <cstdarg> |
40954 -#include <cstdarg> |
40955 -#include <cstdlib> |
40955 -#include <cstdlib> |
|
40956 -#include <cstdio> |
40956 +#include <assert.h> |
40957 +#include <assert.h> |
40957 #include <cxxabi.h> |
40958 #include <cxxabi.h> |
40958 -#include <stdio.h> |
|
40959 #include <elf.h> |
40959 #include <elf.h> |
40960 #include <errno.h> |
40960 #include <errno.h> |
40961 #include <fcntl.h> |
40961 #include <fcntl.h> |
40962 #include <link.h> |
40962 #include <link.h> |
40963 +#include <string.h> |
40963 +#include <string.h> |
41934 |
41934 |
41935 } // namespace google_breakpad |
41935 } // namespace google_breakpad |
41936 diff --git a/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.h b/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.h |
41936 diff --git a/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.h b/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.h |
41937 --- a/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.h |
41937 --- a/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.h |
41938 +++ b/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.h |
41938 +++ b/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.h |
41939 @@ -29,20 +29,21 @@ |
41939 @@ -36,14 +36,14 @@ |
41940 // |
|
41941 // dump_symbols.cc: Implements a linux stab debugging format dumper. |
|
41942 // |
|
41943 |
|
41944 #ifndef COMMON_LINUX_DUMP_SYMBOLS_H__ |
|
41945 #define COMMON_LINUX_DUMP_SYMBOLS_H__ |
|
41946 |
|
41947 #include <string> |
41940 #include <string> |
41948 +#include <cstdio> |
41941 #include <cstdio> |
41949 |
41942 |
41950 namespace google_breakpad { |
41943 namespace google_breakpad { |
41951 |
41944 |
41952 class DumpSymbols { |
41945 class DumpSymbols { |
41953 public: |
41946 public: |
65743 toolkit/crashreporter/google-breakpad/src/common/linux/Makefile |
65736 toolkit/crashreporter/google-breakpad/src/common/linux/Makefile |
65744 toolkit/crashreporter/google-breakpad/src/common/mac/Makefile |
65737 toolkit/crashreporter/google-breakpad/src/common/mac/Makefile |
65745 diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in |
65738 diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in |
65746 --- a/toolkit/xre/Makefile.in |
65739 --- a/toolkit/xre/Makefile.in |
65747 +++ b/toolkit/xre/Makefile.in |
65740 +++ b/toolkit/xre/Makefile.in |
65748 @@ -182,16 +182,17 @@ SHARED_LIBRARY_LIBS += \ |
65741 @@ -179,16 +179,17 @@ SHARED_LIBRARY_LIBS += \ |
65749 $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/mac/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \ |
65742 $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/mac/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \ |
65750 $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \ |
65743 $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \ |
65751 $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/mac/$(LIB_PREFIX)breakpad_mac_common_s.$(LIB_SUFFIX) |
65744 $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/mac/$(LIB_PREFIX)breakpad_mac_common_s.$(LIB_SUFFIX) |
65752 endif |
65745 endif |
65753 |
65746 |