From f66ff1afd2e0f7f16ac2f8d40984cf799f3f099b Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Mon, 8 Nov 2010 19:49:25 +0000 Subject: Delete an old Makefile and fix lots of lint errors. Review URL: http://breakpad.appspot.com/225001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@727 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/client/linux/Makefile | 115 --------------------- .../crash_generation/crash_generation_server.cc | 30 +++--- .../linux/handler/exception_handler_unittest.cc | 10 +- .../linux/minidump_writer/minidump_writer.cc | 31 +++--- 4 files changed, 37 insertions(+), 149 deletions(-) delete mode 100644 src/client/linux/Makefile (limited to 'src/client/linux') diff --git a/src/client/linux/Makefile b/src/client/linux/Makefile deleted file mode 100644 index 1a5e8a72..00000000 --- a/src/client/linux/Makefile +++ /dev/null @@ -1,115 +0,0 @@ -CXX=g++ -CC=gcc - -CXXFLAGS=-gstabs+ -I../../ -I../../testing/gtest/include -I../../testing -I../../third_party/linux/include -I../../testing/include -I../../testing/gtest -D_REENTRANT -Wall -CFLAGS=$(CXXFLAGS) -LDFLAGS=-lpthread - -OBJ_DIR=. -BIN_DIR=. - - -# Source vars for components - -# Google Test (meant to be included in each test source list) -GOOGLETEST_CC_SRC=../../testing/gtest/src/gtest_main.cc \ - ../../testing/gtest/src/gtest-all.cc \ - ../../testing/src/gmock-all.cc - -# Google Logging -GOOGLELOG_LIB=../../third_party/glog/glog/src/glog/libglog.a - -# Google Flags lib -GOOGLEFLAGS_LIB=../../third_party/linux/lib/gflags/libgflags.a - -# Client exception handling & minidump writing library -LIB_CC_SRC= \ - crash_generation/crash_generation_client.cc \ - crash_generation/crash_generation_server.cc \ - handler/exception_handler.cc \ - minidump_writer/linux_dumper.cc \ - minidump_writer/minidump_writer.cc \ - ../minidump_file_writer.cc \ - ../../common/linux/file_id.cc \ - ../../common/linux/guid_creator.cc \ - ../../common/string_conversion.cc -LIB_C_SRC = ../../common/convert_UTF.c -LIB_CC_OBJ=$(patsubst %.cc, $(OBJ_DIR)/%.o,$(LIB_CC_SRC)) -LIB_C_OBJ=$(patsubst %.c, $(OBJ_DIR)/%.o, $(LIB_C_SRC)) - -DUMPER_HELPER_TEST_C_SRC=minidump_writer/linux_dumper_unittest_helper.cc - -DUMPER_HELPER_TEST_C_OBJ=$(patsubst %.cc, $(OBJ_DIR)/%.o, \ - $(DUMPER_HELPER_TEST_C_SRC)) - -# Unit tests for client library - -TEST_CC_SRC=handler/exception_handler_unittest.cc \ - minidump_writer/directory_reader_unittest.cc \ - minidump_writer/line_reader_unittest.cc \ - minidump_writer/linux_dumper_unittest.cc \ - minidump_writer/minidump_writer_unittest.cc \ - $(GOOGLETEST_CC_SRC) - -TEST_CC_OBJ=$(patsubst %.cc, $(OBJ_DIR)/%.o,$(TEST_CC_SRC)) - -# Library for crash dump uploader -SENDER_LIBRARY_SRC=../../common/linux/google_crashdump_uploader.cc ../../common/linux/libcurl_wrapper.cc -SENDER_LIBRARY_OBJ=$(patsubst %.cc, $(OBJ_DIR)/%.o,$(SENDER_LIBRARY_SRC)) -SENDER_LDFLAGS=-ldl - -# Unit test for crash dump uploader -SENDER_TEST_SRC=../../common/linux/google_crashdump_uploader_test.cc \ - $(GOOGLETEST_CC_SRC) - -SENDER_TEST_OBJ=$(patsubst %.cc, $(OBJ_DIR)/%.o,$(SENDER_TEST_SRC)) - -# CLI tool for crash dump uploaer -SENDER_TOOL_SRC=sender/google_crash_report_sender.cc -SENDER_TOOL_OBJ=$(patsubst %.cc, $(OBJ_DIR)/%.o,$(SENDER_TOOL_SRC)) - -# Vars for binary targets -BREAKPAD_LIBRARY=$(BIN_DIR)/libbreakpad.a -SENDER_LIBRARY=$(BIN_DIR)/libcrash_sender.a -# Client unit test binary -UNITTEST_BIN=$(BIN_DIR)/linux_client_test -# Uploader unit test binary -SENDER_UNITTEST_BIN=$(BIN_DIR)/google_crashdump_uploader_test -# Sender CLI tool binary -SENDER_CLI_TOOL_BIN=$(BIN_DIR)/google_crashdump_uploader - -DUMPER_HELPER_TEST_BIN=$(BIN_DIR)/linux_dumper_unittest_helper - -.PHONY:all clean - -all:$(BREAKPAD_LIBRARY) $(UNITTEST_BIN) #$(SENDER_LIBRARY) $(SENDER_UNITTEST_BIN) $(SENDER_CLI_TOOL_BIN) - -check:$(UNITTEST_BIN) $(SENDER_UNITTEST_BIN) - $(UNITTEST_BIN) - $(SENDER_UNITTEST_BIN) - -$(BIN_DIR)/libbreakpad.a:$(LIB_CC_OBJ) $(LIB_C_OBJ) - $(AR) rcs $@ $^ - -$(BIN_DIR)/linux_dumper_unittest_helper:$(DUMPER_HELPER_TEST_C_OBJ) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ - -$(BIN_DIR)/linux_client_test:$(TEST_CC_OBJ) $(BREAKPAD_LIBRARY) $(DUMPER_HELPER_TEST_BIN) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(TEST_CC_OBJ) $(BREAKPAD_LIBRARY) -o $@ - -$(BIN_DIR)/libcrash_sender.a:$(SENDER_LIBRARY_OBJ) - $(AR) rcs $@ $^ - -$(BIN_DIR)/google_crashdump_uploader_test:$(SENDER_TEST_OBJ) $(SENDER_LIBRARY) \ - $(GOOGLELOG_LIB) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(SENDER_LDFLAGS) $^ -o $@ - -$(BIN_DIR)/google_crashdump_uploader:$(SENDER_TOOL_OBJ) $(SENDER_LIBRARY) \ - $(GOOGLELOG_LIB) $(GOOGLEFLAGS_LIB) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(SENDER_LDFLAGS) $^ -o $@ - -clean: - rm -f $(UNITTEST_BIN) $(BREAKPAD_LIBRARY) $(LIB_CC_OBJ) $(LIB_C_OBJ) \ - $(TEST_CC_OBJ) $(SENDER_LIBRARY_OBJ) $(SENDER_LIBRARY) \ - $(SENDER_TOOL_OBJ) $(SENDER_CLI_TOOL_BIN) $(SENDER_UNITTEST_BIN) \ - $(DUMPER_HELPER_TEST_BIN) core diff --git a/src/client/linux/crash_generation/crash_generation_server.cc b/src/client/linux/crash_generation/crash_generation_server.cc index ff380aa5..2f7edb69 100644 --- a/src/client/linux/crash_generation/crash_generation_server.cc +++ b/src/client/linux/crash_generation/crash_generation_server.cc @@ -39,6 +39,8 @@ #include #include +#include + #include "client/linux/crash_generation/crash_generation_server.h" #include "client/linux/crash_generation/client_info.h" #include "client/linux/handler/exception_handler.h" @@ -142,15 +144,15 @@ FindProcessHoldingSocket(pid_t* pid_out, ino_t socket_inode) ino_t fd_inode; if (GetInodeForProcPath(&fd_inode, buf) - && fd_inode == socket_inode) { - if (already_found) { - closedir(fd); - return false; - } - - already_found = true; - *pid_out = current_pid; - break; + && fd_inode == socket_inode) { + if (already_found) { + closedir(fd); + return false; + } + + already_found = true; + *pid_out = current_pid; + break; } } @@ -224,11 +226,11 @@ CrashGenerationServer::Stop() { assert(pthread_self() != thread_); - if (!started_) - return; + if (!started_) + return; HANDLE_EINTR(write(control_pipe_out_, &kCommandQuit, 1)); - + void* dummy; pthread_join(thread_, &dummy); @@ -280,7 +282,7 @@ CrashGenerationServer::Run() if (EINTR == errno) { continue; } else { - return; + return; } } @@ -463,4 +465,4 @@ CrashGenerationServer::ThreadMain(void *arg) return NULL; } -} // namespace google_breakpad +} // namespace google_breakpad diff --git a/src/client/linux/handler/exception_handler_unittest.cc b/src/client/linux/handler/exception_handler_unittest.cc index e1186698..988de063 100644 --- a/src/client/linux/handler/exception_handler_unittest.cc +++ b/src/client/linux/handler/exception_handler_unittest.cc @@ -27,8 +27,6 @@ // (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 - #include #include #include @@ -38,6 +36,8 @@ #include #include +#include + #include "breakpad_googletest_includes.h" #include "client/linux/handler/exception_handler.h" #include "client/linux/minidump_writer/minidump_writer.h" @@ -170,7 +170,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemory) { // of the block of memory, because the minidump should contain 128 // bytes on either side of the instruction pointer. memcpy(memory + kOffset, instructions, sizeof(instructions)); - + // Now execute the instructions, which should crash. typedef void (*void_function)(void); void_function memory_function = @@ -294,7 +294,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMinBound) { // of the block of memory, because the minidump should contain 128 // bytes on either side of the instruction pointer. memcpy(memory + kOffset, instructions, sizeof(instructions)); - + // Now execute the instructions, which should crash. typedef void (*void_function)(void); void_function memory_function = @@ -418,7 +418,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) { // of the block of memory, because the minidump should contain 128 // bytes on either side of the instruction pointer. memcpy(memory + kOffset, instructions, sizeof(instructions)); - + // Now execute the instructions, which should crash. typedef void (*void_function)(void); void_function memory_function = diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc index 9deed20b..bb365a1e 100644 --- a/src/client/linux/minidump_writer/minidump_writer.cc +++ b/src/client/linux/minidump_writer/minidump_writer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009, Google Inc. +// Copyright (c) 2010, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -46,8 +46,6 @@ #include "client/linux/minidump_writer/minidump_writer.h" #include "client/minidump_file_writer-inl.h" -#include - #include #include #if !defined(__ANDROID__) @@ -61,6 +59,8 @@ #endif #include +#include + #include "client/minidump_file_writer.h" #include "google_breakpad/common/minidump_format.h" #include "google_breakpad/common/minidump_cpu_amd64.h" @@ -252,9 +252,9 @@ static void CPUFillFromThreadInfo(MDRawContextAMD64 *out, out->flt_save.tag_word = info.fpregs.ftw; out->flt_save.error_opcode = info.fpregs.fop; out->flt_save.error_offset = info.fpregs.rip; - out->flt_save.error_selector = 0; // We don't have this. + out->flt_save.error_selector = 0; // We don't have this. out->flt_save.data_offset = info.fpregs.rdp; - out->flt_save.data_selector = 0; // We don't have this. + out->flt_save.data_selector = 0; // We don't have this. out->flt_save.mx_csr = info.fpregs.mxcsr; out->flt_save.mx_csr_mask = info.fpregs.mxcr_mask; memcpy(&out->flt_save.float_registers, &info.fpregs.st_space, 8 * 16); @@ -300,7 +300,7 @@ static void CPUFillFromUContext(MDRawContextAMD64 *out, const ucontext *uc, out->flt_save.error_opcode = fpregs->fop; out->flt_save.error_offset = fpregs->rip; out->flt_save.data_offset = fpregs->rdp; - out->flt_save.error_selector = 0; // We don't have this. + out->flt_save.error_selector = 0; // We don't have this. out->flt_save.data_selector = 0; // We don't have this. out->flt_save.mx_csr = fpregs->mxcsr; out->flt_save.mx_csr_mask = fpregs->mxcr_mask; @@ -322,7 +322,7 @@ static void CPUFillFromThreadInfo(MDRawContextARM *out, #if !defined(__ANDROID__) out->float_save.fpscr = info.fpregs.fpsr | (static_cast(info.fpregs.fpcr) << 32); - //TODO: sort this out, actually collect floating point registers + // TODO: sort this out, actually collect floating point registers memset(&out->float_save.regs, 0, sizeof(out->float_save.regs)); memset(&out->float_save.extra, 0, sizeof(out->float_save.extra)); #endif @@ -352,7 +352,7 @@ static void CPUFillFromUContext(MDRawContextARM *out, const ucontext *uc, out->cpsr = uc->uc_mcontext.arm_cpsr; - //TODO: fix this after fixing ExceptionHandler + // TODO: fix this after fixing ExceptionHandler out->float_save.fpscr = 0; memset(&out->float_save.regs, 0, sizeof(out->float_save.regs)); memset(&out->float_save.extra, 0, sizeof(out->float_save.extra)); @@ -375,7 +375,7 @@ class MinidumpWriter { #if !defined(__ARM_EABI__) float_state_(&context->float_state), #else - //TODO: fix this after fixing ExceptionHandler + // TODO: fix this after fixing ExceptionHandler float_state_(NULL), #endif crashing_tid_(context->tid), @@ -409,8 +409,9 @@ class MinidumpWriter { if (dyn.d_tag == DT_DEBUG) { r_debug = (struct r_debug*)dyn.d_un.d_ptr; continue; - } else if (dyn.d_tag == DT_NULL) + } else if (dyn.d_tag == DT_NULL) { break; + } } #endif @@ -677,7 +678,7 @@ class MinidumpWriter { ip_memory_d.start_of_memory_range = std::max(mapping.start_addr, uintptr_t(ip - (kIPMemorySize / 2))); - uintptr_t end_of_range = + uintptr_t end_of_range = std::min(uintptr_t(ip + (kIPMemorySize / 2)), uintptr_t(mapping.start_addr + mapping.size)); ip_memory_d.memory.data_size = @@ -742,8 +743,8 @@ class MinidumpWriter { } static bool ShouldIncludeMapping(const MappingInfo& mapping) { - if (mapping.name[0] == 0 || // we only want modules with filenames. - mapping.offset || // we only want to include one mapping per shared lib. + if (mapping.name[0] == 0 || // only want modules with filenames. + mapping.offset || // only want to include one mapping per shared lib. mapping.size < 4096) { // too small to get a signature for. return false; } @@ -1084,7 +1085,7 @@ class MinidumpWriter { } } -popline: + popline: line_reader->PopLine(line_len); } sys_close(fd); @@ -1140,7 +1141,7 @@ popline: if (r < 1) break; - + total += r; bufptr->len += r; if (bufptr->len == kBufSize) { -- cgit v1.2.1