mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-24 04:05:41 +01:00
Changes to get the breakpad client compiling and running on Android using
ndk-7b. Patch by Carlos Valdivia <carlosvaldivia@google.com> Review URL: https://breakpad.appspot.com/363001/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@945 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
ae38954f50
commit
4f291f0307
@ -65,15 +65,14 @@ lib_LIBRARIES += src/client/linux/libbreakpad_client.a
|
||||
src_client_linux_libbreakpad_client_a_SOURCES = \
|
||||
src/client/linux/crash_generation/crash_generation_client.cc \
|
||||
src/client/linux/handler/exception_handler.cc \
|
||||
src/client/linux/log/log.cc \
|
||||
src/client/linux/minidump_writer/linux_dumper.cc \
|
||||
src/client/linux/minidump_writer/linux_core_dumper.cc \
|
||||
src/client/linux/minidump_writer/linux_ptrace_dumper.cc \
|
||||
src/client/linux/minidump_writer/minidump_writer.cc \
|
||||
src/client/minidump_file_writer.cc \
|
||||
src/common/convert_UTF.c \
|
||||
src/common/md5.cc \
|
||||
src/common/string_conversion.cc \
|
||||
src/common/linux/elf_core_dump.cc \
|
||||
src/common/linux/file_id.cc \
|
||||
src/common/linux/guid_creator.cc \
|
||||
src/common/linux/memory_mapped_file.cc \
|
||||
@ -338,7 +337,10 @@ src_client_linux_linux_client_unittest_DEPENDENCIES = \
|
||||
|
||||
if !DISABLE_TOOLS
|
||||
src_tools_linux_core2md_core2md_SOURCES = \
|
||||
src/tools/linux/core2md/core2md.cc
|
||||
src/tools/linux/core2md/core2md.cc \
|
||||
src/client/linux/minidump_writer/linux_core_dumper.cc \
|
||||
src/common/linux/elf_core_dump.cc
|
||||
|
||||
src_tools_linux_core2md_core2md_LDADD = \
|
||||
src/client/linux/libbreakpad_client.a
|
||||
|
||||
|
52
Makefile.in
52
Makefile.in
@ -171,28 +171,26 @@ src_client_linux_libbreakpad_client_a_LIBADD =
|
||||
am__src_client_linux_libbreakpad_client_a_SOURCES_DIST = \
|
||||
src/client/linux/crash_generation/crash_generation_client.cc \
|
||||
src/client/linux/handler/exception_handler.cc \
|
||||
src/client/linux/log/log.cc \
|
||||
src/client/linux/minidump_writer/linux_dumper.cc \
|
||||
src/client/linux/minidump_writer/linux_core_dumper.cc \
|
||||
src/client/linux/minidump_writer/linux_ptrace_dumper.cc \
|
||||
src/client/linux/minidump_writer/minidump_writer.cc \
|
||||
src/client/minidump_file_writer.cc src/common/convert_UTF.c \
|
||||
src/common/md5.cc src/common/string_conversion.cc \
|
||||
src/common/linux/elf_core_dump.cc src/common/linux/file_id.cc \
|
||||
src/common/linux/guid_creator.cc \
|
||||
src/common/linux/file_id.cc src/common/linux/guid_creator.cc \
|
||||
src/common/linux/memory_mapped_file.cc \
|
||||
src/common/linux/safe_readlink.cc
|
||||
am__dirstamp = $(am__leading_dot)dirstamp
|
||||
@LINUX_HOST_TRUE@am_src_client_linux_libbreakpad_client_a_OBJECTS = src/client/linux/crash_generation/crash_generation_client.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/handler/exception_handler.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/log/log.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_dumper.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_core_dumper.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_ptrace_dumper.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/minidump_writer.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/minidump_file_writer.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/common/convert_UTF.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/common/md5.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/common/string_conversion.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/elf_core_dump.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/file_id.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/guid_creator.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/memory_mapped_file.$(OBJEXT) \
|
||||
@ -914,8 +912,12 @@ src_processor_synth_minidump_unittest_OBJECTS = \
|
||||
$(am_src_processor_synth_minidump_unittest_OBJECTS)
|
||||
src_processor_synth_minidump_unittest_LDADD = $(LDADD)
|
||||
am__src_tools_linux_core2md_core2md_SOURCES_DIST = \
|
||||
src/tools/linux/core2md/core2md.cc
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am_src_tools_linux_core2md_core2md_OBJECTS = src/tools/linux/core2md/core2md.$(OBJEXT)
|
||||
src/tools/linux/core2md/core2md.cc \
|
||||
src/client/linux/minidump_writer/linux_core_dumper.cc \
|
||||
src/common/linux/elf_core_dump.cc
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am_src_tools_linux_core2md_core2md_OBJECTS = src/tools/linux/core2md/core2md.$(OBJEXT) \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_core_dumper.$(OBJEXT) \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/common/linux/elf_core_dump.$(OBJEXT)
|
||||
src_tools_linux_core2md_core2md_OBJECTS = \
|
||||
$(am_src_tools_linux_core2md_core2md_OBJECTS)
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@src_tools_linux_core2md_core2md_DEPENDENCIES = src/client/linux/libbreakpad_client.a
|
||||
@ -1223,15 +1225,14 @@ lib_LIBRARIES = $(am__append_1) $(am__append_3)
|
||||
@LINUX_HOST_TRUE@src_client_linux_libbreakpad_client_a_SOURCES = \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/crash_generation/crash_generation_client.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/handler/exception_handler.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/log/log.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_dumper.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_core_dumper.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_ptrace_dumper.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/minidump_writer.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/minidump_file_writer.cc \
|
||||
@LINUX_HOST_TRUE@ src/common/convert_UTF.c \
|
||||
@LINUX_HOST_TRUE@ src/common/md5.cc \
|
||||
@LINUX_HOST_TRUE@ src/common/string_conversion.cc \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/elf_core_dump.cc \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/file_id.cc \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/guid_creator.cc \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/memory_mapped_file.cc \
|
||||
@ -1422,7 +1423,9 @@ TESTS_ENVIRONMENT =
|
||||
@LINUX_HOST_TRUE@ src/libbreakpad.a
|
||||
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@src_tools_linux_core2md_core2md_SOURCES = \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/core2md/core2md.cc
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/core2md/core2md.cc \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_core_dumper.cc \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/common/linux/elf_core_dump.cc
|
||||
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@src_tools_linux_core2md_core2md_LDADD = \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/client/linux/libbreakpad_client.a
|
||||
@ -2209,6 +2212,15 @@ src/client/linux/handler/$(DEPDIR)/$(am__dirstamp):
|
||||
src/client/linux/handler/exception_handler.$(OBJEXT): \
|
||||
src/client/linux/handler/$(am__dirstamp) \
|
||||
src/client/linux/handler/$(DEPDIR)/$(am__dirstamp)
|
||||
src/client/linux/log/$(am__dirstamp):
|
||||
@$(MKDIR_P) src/client/linux/log
|
||||
@: > src/client/linux/log/$(am__dirstamp)
|
||||
src/client/linux/log/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) src/client/linux/log/$(DEPDIR)
|
||||
@: > src/client/linux/log/$(DEPDIR)/$(am__dirstamp)
|
||||
src/client/linux/log/log.$(OBJEXT): \
|
||||
src/client/linux/log/$(am__dirstamp) \
|
||||
src/client/linux/log/$(DEPDIR)/$(am__dirstamp)
|
||||
src/client/linux/minidump_writer/$(am__dirstamp):
|
||||
@$(MKDIR_P) src/client/linux/minidump_writer
|
||||
@: > src/client/linux/minidump_writer/$(am__dirstamp)
|
||||
@ -2218,9 +2230,6 @@ src/client/linux/minidump_writer/$(DEPDIR)/$(am__dirstamp):
|
||||
src/client/linux/minidump_writer/linux_dumper.$(OBJEXT): \
|
||||
src/client/linux/minidump_writer/$(am__dirstamp) \
|
||||
src/client/linux/minidump_writer/$(DEPDIR)/$(am__dirstamp)
|
||||
src/client/linux/minidump_writer/linux_core_dumper.$(OBJEXT): \
|
||||
src/client/linux/minidump_writer/$(am__dirstamp) \
|
||||
src/client/linux/minidump_writer/$(DEPDIR)/$(am__dirstamp)
|
||||
src/client/linux/minidump_writer/linux_ptrace_dumper.$(OBJEXT): \
|
||||
src/client/linux/minidump_writer/$(am__dirstamp) \
|
||||
src/client/linux/minidump_writer/$(DEPDIR)/$(am__dirstamp)
|
||||
@ -2253,9 +2262,6 @@ src/common/linux/$(am__dirstamp):
|
||||
src/common/linux/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) src/common/linux/$(DEPDIR)
|
||||
@: > src/common/linux/$(DEPDIR)/$(am__dirstamp)
|
||||
src/common/linux/elf_core_dump.$(OBJEXT): \
|
||||
src/common/linux/$(am__dirstamp) \
|
||||
src/common/linux/$(DEPDIR)/$(am__dirstamp)
|
||||
src/common/linux/file_id.$(OBJEXT): src/common/linux/$(am__dirstamp) \
|
||||
src/common/linux/$(DEPDIR)/$(am__dirstamp)
|
||||
src/common/linux/guid_creator.$(OBJEXT): \
|
||||
@ -2993,6 +2999,12 @@ src/tools/linux/core2md/$(DEPDIR)/$(am__dirstamp):
|
||||
src/tools/linux/core2md/core2md.$(OBJEXT): \
|
||||
src/tools/linux/core2md/$(am__dirstamp) \
|
||||
src/tools/linux/core2md/$(DEPDIR)/$(am__dirstamp)
|
||||
src/client/linux/minidump_writer/linux_core_dumper.$(OBJEXT): \
|
||||
src/client/linux/minidump_writer/$(am__dirstamp) \
|
||||
src/client/linux/minidump_writer/$(DEPDIR)/$(am__dirstamp)
|
||||
src/common/linux/elf_core_dump.$(OBJEXT): \
|
||||
src/common/linux/$(am__dirstamp) \
|
||||
src/common/linux/$(DEPDIR)/$(am__dirstamp)
|
||||
src/tools/linux/core2md/core2md$(EXEEXT): $(src_tools_linux_core2md_core2md_OBJECTS) $(src_tools_linux_core2md_core2md_DEPENDENCIES) src/tools/linux/core2md/$(am__dirstamp)
|
||||
@rm -f src/tools/linux/core2md/core2md$(EXEEXT)
|
||||
$(CXXLINK) $(src_tools_linux_core2md_core2md_OBJECTS) $(src_tools_linux_core2md_core2md_LDADD) $(LIBS)
|
||||
@ -3091,6 +3103,7 @@ mostlyclean-compile:
|
||||
-rm -f src/client/linux/crash_generation/crash_generation_client.$(OBJEXT)
|
||||
-rm -f src/client/linux/handler/exception_handler.$(OBJEXT)
|
||||
-rm -f src/client/linux/handler/src_client_linux_linux_client_unittest-exception_handler_unittest.$(OBJEXT)
|
||||
-rm -f src/client/linux/log/log.$(OBJEXT)
|
||||
-rm -f src/client/linux/minidump_writer/linux_core_dumper.$(OBJEXT)
|
||||
-rm -f src/client/linux/minidump_writer/linux_dumper.$(OBJEXT)
|
||||
-rm -f src/client/linux/minidump_writer/linux_ptrace_dumper.$(OBJEXT)
|
||||
@ -3312,6 +3325,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/crash_generation/$(DEPDIR)/crash_generation_client.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/handler/$(DEPDIR)/exception_handler.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/handler/$(DEPDIR)/src_client_linux_linux_client_unittest-exception_handler_unittest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/log/$(DEPDIR)/log.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/minidump_writer/$(DEPDIR)/linux_core_dumper.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/minidump_writer/$(DEPDIR)/linux_dumper.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/minidump_writer/$(DEPDIR)/linux_ptrace_dumper.Po@am__quote@
|
||||
@ -5810,6 +5824,8 @@ distclean-generic:
|
||||
-rm -f src/client/linux/crash_generation/$(am__dirstamp)
|
||||
-rm -f src/client/linux/handler/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f src/client/linux/handler/$(am__dirstamp)
|
||||
-rm -f src/client/linux/log/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f src/client/linux/log/$(am__dirstamp)
|
||||
-rm -f src/client/linux/minidump_writer/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f src/client/linux/minidump_writer/$(am__dirstamp)
|
||||
-rm -f src/common/$(DEPDIR)/$(am__dirstamp)
|
||||
@ -5850,7 +5866,7 @@ clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf src/client/$(DEPDIR) src/client/linux/crash_generation/$(DEPDIR) src/client/linux/handler/$(DEPDIR) src/client/linux/minidump_writer/$(DEPDIR) src/common/$(DEPDIR) src/common/dwarf/$(DEPDIR) src/common/linux/$(DEPDIR) src/common/linux/tests/$(DEPDIR) src/common/tests/$(DEPDIR) src/processor/$(DEPDIR) src/testing/gtest/src/$(DEPDIR) src/testing/src/$(DEPDIR) src/third_party/libdisasm/$(DEPDIR) src/tools/linux/core2md/$(DEPDIR) src/tools/linux/dump_syms/$(DEPDIR) src/tools/linux/md2core/$(DEPDIR) src/tools/linux/symupload/$(DEPDIR)
|
||||
-rm -rf src/client/$(DEPDIR) src/client/linux/crash_generation/$(DEPDIR) src/client/linux/handler/$(DEPDIR) src/client/linux/log/$(DEPDIR) src/client/linux/minidump_writer/$(DEPDIR) src/common/$(DEPDIR) src/common/dwarf/$(DEPDIR) src/common/linux/$(DEPDIR) src/common/linux/tests/$(DEPDIR) src/common/tests/$(DEPDIR) src/processor/$(DEPDIR) src/testing/gtest/src/$(DEPDIR) src/testing/src/$(DEPDIR) src/third_party/libdisasm/$(DEPDIR) src/tools/linux/core2md/$(DEPDIR) src/tools/linux/dump_syms/$(DEPDIR) src/tools/linux/md2core/$(DEPDIR) src/tools/linux/symupload/$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-hdr distclean-tags
|
||||
@ -5898,7 +5914,7 @@ installcheck-am:
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -rf src/client/$(DEPDIR) src/client/linux/crash_generation/$(DEPDIR) src/client/linux/handler/$(DEPDIR) src/client/linux/minidump_writer/$(DEPDIR) src/common/$(DEPDIR) src/common/dwarf/$(DEPDIR) src/common/linux/$(DEPDIR) src/common/linux/tests/$(DEPDIR) src/common/tests/$(DEPDIR) src/processor/$(DEPDIR) src/testing/gtest/src/$(DEPDIR) src/testing/src/$(DEPDIR) src/third_party/libdisasm/$(DEPDIR) src/tools/linux/core2md/$(DEPDIR) src/tools/linux/dump_syms/$(DEPDIR) src/tools/linux/md2core/$(DEPDIR) src/tools/linux/symupload/$(DEPDIR)
|
||||
-rm -rf src/client/$(DEPDIR) src/client/linux/crash_generation/$(DEPDIR) src/client/linux/handler/$(DEPDIR) src/client/linux/log/$(DEPDIR) src/client/linux/minidump_writer/$(DEPDIR) src/common/$(DEPDIR) src/common/dwarf/$(DEPDIR) src/common/linux/$(DEPDIR) src/common/linux/tests/$(DEPDIR) src/common/tests/$(DEPDIR) src/processor/$(DEPDIR) src/testing/gtest/src/$(DEPDIR) src/testing/src/$(DEPDIR) src/third_party/libdisasm/$(DEPDIR) src/tools/linux/core2md/$(DEPDIR) src/tools/linux/dump_syms/$(DEPDIR) src/tools/linux/md2core/$(DEPDIR) src/tools/linux/symupload/$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
|
@ -33,7 +33,11 @@
|
||||
#ifndef GOOGLE_BREAKPAD_CLIENT_LINUX_ANDROID_LINK_H_
|
||||
#define GOOGLE_BREAKPAD_CLIENT_LINUX_ANDROID_LINK_H_
|
||||
|
||||
#include <sys/exec_elf.h>
|
||||
// TODO(zhenghao): exec_elf.h conflicts with linux/elf.h.
|
||||
// But we still need ELFSIZE.
|
||||
//#include <sys/exec_elf.h>
|
||||
#include <machine/exec.h>
|
||||
#define ELFSIZE ARCH_ELFSIZE
|
||||
|
||||
#ifndef ElfW
|
||||
#define ElfW(type) _ElfW (Elf, ELFSIZE, type)
|
||||
|
@ -90,6 +90,7 @@
|
||||
|
||||
#include "common/linux/linux_libc_support.h"
|
||||
#include "common/memory.h"
|
||||
#include "client/linux/log/log.h"
|
||||
#include "client/linux/minidump_writer/linux_dumper.h"
|
||||
#include "client/linux/minidump_writer/minidump_writer.h"
|
||||
#include "common/linux/guid_creator.h"
|
||||
@ -391,14 +392,20 @@ bool ExceptionHandler::GenerateDump(CrashContext *context) {
|
||||
// is the write() and read() calls will fail with EBADF
|
||||
static const char no_pipe_msg[] = "ExceptionHandler::GenerateDump \
|
||||
sys_pipe failed:";
|
||||
sys_write(2, no_pipe_msg, sizeof(no_pipe_msg) - 1);
|
||||
sys_write(2, strerror(errno), strlen(strerror(errno)));
|
||||
sys_write(2, "\n", 1);
|
||||
logger::write(no_pipe_msg, sizeof(no_pipe_msg) - 1);
|
||||
logger::write(strerror(errno), strlen(strerror(errno)));
|
||||
logger::write("\n", 1);
|
||||
}
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
const pid_t child = clone(
|
||||
ThreadEntry, stack, CLONE_FILES | CLONE_FS | CLONE_UNTRACED,
|
||||
&thread_arg);
|
||||
#else
|
||||
const pid_t child = sys_clone(
|
||||
ThreadEntry, stack, CLONE_FILES | CLONE_FS | CLONE_UNTRACED,
|
||||
&thread_arg, NULL, NULL, NULL);
|
||||
#endif
|
||||
int r, status;
|
||||
// Allow the child to ptrace us
|
||||
sys_prctl(PR_SET_PTRACER, child);
|
||||
@ -412,9 +419,9 @@ bool ExceptionHandler::GenerateDump(CrashContext *context) {
|
||||
|
||||
if (r == -1) {
|
||||
static const char msg[] = "ExceptionHandler::GenerateDump waitpid failed:";
|
||||
sys_write(2, msg, sizeof(msg) - 1);
|
||||
sys_write(2, strerror(errno), strlen(strerror(errno)));
|
||||
sys_write(2, "\n", 1);
|
||||
logger::write(msg, sizeof(msg) - 1);
|
||||
logger::write(strerror(errno), strlen(strerror(errno)));
|
||||
logger::write("\n", 1);
|
||||
}
|
||||
|
||||
bool success = r != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0;
|
||||
@ -434,9 +441,9 @@ void ExceptionHandler::SendContinueSignalToChild() {
|
||||
if(r == -1) {
|
||||
static const char msg[] = "ExceptionHandler::SendContinueSignalToChild \
|
||||
sys_write failed:";
|
||||
sys_write(2, msg, sizeof(msg) - 1);
|
||||
sys_write(2, strerror(errno), strlen(strerror(errno)));
|
||||
sys_write(2, "\n", 1);
|
||||
logger::write(msg, sizeof(msg) - 1);
|
||||
logger::write(strerror(errno), strlen(strerror(errno)));
|
||||
logger::write("\n", 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -449,9 +456,9 @@ void ExceptionHandler::WaitForContinueSignal() {
|
||||
if(r == -1) {
|
||||
static const char msg[] = "ExceptionHandler::WaitForContinueSignal \
|
||||
sys_read failed:";
|
||||
sys_write(2, msg, sizeof(msg) - 1);
|
||||
sys_write(2, strerror(errno), strlen(strerror(errno)));
|
||||
sys_write(2, "\n", 1);
|
||||
logger::write(msg, sizeof(msg) - 1);
|
||||
logger::write(strerror(errno), strlen(strerror(errno)));
|
||||
logger::write("\n", 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
48
src/client/linux/log/log.cc
Normal file
48
src/client/linux/log/log.cc
Normal file
@ -0,0 +1,48 @@
|
||||
// Copyright (c) 2012 Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "client/linux/log/log.h"
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include <android/log.h>
|
||||
#else
|
||||
#include "third_party/lss/linux_syscall_support.h"
|
||||
#endif
|
||||
|
||||
namespace logger {
|
||||
|
||||
int write(const char* buf, size_t nbytes) {
|
||||
#if defined(__ANDROID__)
|
||||
return __android_log_write(ANDROID_LOG_WARN, "google-breakpad", buf);
|
||||
#else
|
||||
return sys_write(2, buf, nbytes);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace logger
|
41
src/client/linux/log/log.h
Normal file
41
src/client/linux/log/log.h
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2012, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef CLIENT_LINUX_LOG_LOG_H_
|
||||
#define CLIENT_LINUX_LOG_LOG_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace logger {
|
||||
|
||||
int write(const char* buf, size_t nbytes);
|
||||
|
||||
} // namespace logger
|
||||
|
||||
#endif // CLIENT_LINUX_LOG_LOG_H_
|
@ -46,19 +46,19 @@
|
||||
#include "client/linux/minidump_writer/minidump_writer.h"
|
||||
#include "client/minidump_file_writer-inl.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#if !defined(__ANDROID__)
|
||||
#include <link.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#if !defined(__ANDROID__)
|
||||
#include <sys/ucontext.h>
|
||||
#include <sys/user.h>
|
||||
#endif
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -72,10 +72,11 @@
|
||||
#include "client/linux/handler/exception_handler.h"
|
||||
#include "client/linux/minidump_writer/line_reader.h"
|
||||
#include "client/linux/minidump_writer/linux_dumper.h"
|
||||
#include "client/linux/minidump_writer/linux_core_dumper.h"
|
||||
#include "client/linux/minidump_writer/linux_ptrace_dumper.h"
|
||||
#include "client/linux/minidump_writer/minidump_extension_linux.h"
|
||||
#include "client/minidump_file_writer.h"
|
||||
#include "common/linux/linux_libc_support.h"
|
||||
#include "google_breakpad/common/minidump_format.h"
|
||||
#include "third_party/lss/linux_syscall_support.h"
|
||||
|
||||
// Minidump defines register structures which are different from the raw
|
||||
@ -1336,12 +1337,10 @@ bool WriteMinidump(const char* filename, pid_t crashing_process,
|
||||
return writer.Dump();
|
||||
}
|
||||
|
||||
bool WriteMinidumpFromCore(const char* filename,
|
||||
const char* core_path,
|
||||
const char* procfs_override) {
|
||||
MappingList mappings;
|
||||
LinuxCoreDumper dumper(0, core_path, procfs_override);
|
||||
MinidumpWriter writer(filename, NULL, mappings, &dumper);
|
||||
bool WriteMinidump(const char* filename,
|
||||
const MappingList& mappings,
|
||||
LinuxDumper* dumper) {
|
||||
MinidumpWriter writer(filename, NULL, mappings, dumper);
|
||||
if (!writer.Init())
|
||||
return false;
|
||||
return writer.Dump();
|
||||
|
@ -36,12 +36,19 @@
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
#include "client/linux/minidump_writer/linux_dumper.h"
|
||||
#include "google_breakpad/common/minidump_format.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
class ExceptionHandler;
|
||||
|
||||
struct MappingEntry {
|
||||
MappingInfo first;
|
||||
u_int8_t second[sizeof(MDGUID)];
|
||||
};
|
||||
|
||||
// A list of <MappingInfo, GUID>
|
||||
typedef std::pair<struct MappingInfo, u_int8_t[sizeof(MDGUID)]> MappingEntry;
|
||||
typedef std::list<MappingEntry> MappingList;
|
||||
|
||||
// Write a minidump to the filesystem. This function does not malloc nor use
|
||||
@ -62,11 +69,9 @@ bool WriteMinidump(const char* filename, pid_t crashing_process,
|
||||
const void* blob, size_t blob_size,
|
||||
const MappingList& mappings);
|
||||
|
||||
// Write a minidump to the filesystem. Same as above, but uses the given
|
||||
// core file and procfs directory to generate the minidump post mortem.
|
||||
bool WriteMinidumpFromCore(const char* filename,
|
||||
const char* core_path,
|
||||
const char* procfs_override);
|
||||
bool WriteMinidump(const char* filename,
|
||||
const MappingList& mappings,
|
||||
LinuxDumper* dumper);
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
|
@ -440,7 +440,11 @@ void DwarfCUToModule::FuncHandler::Finish() {
|
||||
func->address = low_pc_;
|
||||
func->size = high_pc_ - low_pc_;
|
||||
func->parameter_size = 0;
|
||||
cu_context_->functions.push_back(func);
|
||||
if (func->address) {
|
||||
// If the function address is zero this is a sign that this function
|
||||
// description is just empty debug data and should just be discarded.
|
||||
cu_context_->functions.push_back(func);
|
||||
}
|
||||
} else if (inline_) {
|
||||
AbstractOrigin origin(name_);
|
||||
cu_context_->file_context->file_private->origins[offset_] = origin;
|
||||
|
@ -36,10 +36,11 @@
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
#include <elf.h>
|
||||
#if defined(__ANDROID__)
|
||||
#include <linux/elf.h>
|
||||
#include "client/linux/android_link.h"
|
||||
#else
|
||||
#include <elf.h>
|
||||
#include <link.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
@ -34,6 +34,9 @@
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#if defined(__ANDROID__)
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
#include "common/memory_range.h"
|
||||
@ -59,7 +62,10 @@ bool MemoryMappedFile::Map(const char* path) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#if defined(__ANDROID__)
|
||||
struct stat st;
|
||||
if (fstat(fd, &st) != 0) {
|
||||
#elif defined(__x86_64__)
|
||||
struct kernel_stat st;
|
||||
if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
|
||||
#else
|
||||
|
@ -32,12 +32,24 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "client/linux/minidump_writer/minidump_writer.h"
|
||||
#include "client/linux/minidump_writer/linux_core_dumper.h"
|
||||
|
||||
using google_breakpad::MappingList;
|
||||
using google_breakpad::LinuxCoreDumper;
|
||||
|
||||
static int ShowUsage(const char* argv0) {
|
||||
fprintf(stderr, "Usage: %s <core file> <procfs dir> <output>\n", argv0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool WriteMinidumpFromCore(const char* filename,
|
||||
const char* core_path,
|
||||
const char* procfs_override) {
|
||||
MappingList mappings;
|
||||
LinuxCoreDumper dumper(0, core_path, procfs_override);
|
||||
return google_breakpad::WriteMinidump(filename, mappings, &dumper);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc != 4) {
|
||||
return ShowUsage(argv[0]);
|
||||
@ -46,9 +58,9 @@ int main(int argc, char *argv[]) {
|
||||
const char* core_file = argv[1];
|
||||
const char* procfs_dir = argv[2];
|
||||
const char* minidump_file = argv[3];
|
||||
if (!google_breakpad::WriteMinidumpFromCore(minidump_file,
|
||||
core_file,
|
||||
procfs_dir)) {
|
||||
if (!WriteMinidumpFromCore(minidump_file,
|
||||
core_file,
|
||||
procfs_dir)) {
|
||||
fprintf(stderr, "Unable to generate minidump.\n");
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user