bug 465329 - sync to breakpad revision 299 (just the mozilla changes). r=bsmedberg

This commit is contained in:
Ted Mielczarek 2008-11-25 12:03:26 -05:00
parent 8dfdaa783d
commit 1a681d9ca9
8 changed files with 92 additions and 151 deletions

View File

@ -54,9 +54,12 @@ DIRS = \
$(NULL)
ifeq ($(OS_ARCH),WINNT)
DIRS += google-breakpad/src/common/windows \
google-breakpad/src/client/windows \
$(NULL)
DIRS += \
google-breakpad/src/common/windows \
google-breakpad/src/client/windows/handler \
google-breakpad/src/client/windows/sender \
google-breakpad/src/client/windows/crash_generation \
$(NULL)
endif
ifeq ($(OS_ARCH),Darwin)

View File

@ -0,0 +1,60 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla Breakpad integration
#
# The Initial Developer of the Original Code is
# The Mozilla Foundation
# Portions created by the Initial Developer are Copyright (C) 2008
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ted Mielczarek <ted.mielczarek@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = crash_generation
LIBRARY_NAME = crash_generation_s
LOCAL_INCLUDES = -I$(srcdir)/../../..
DEFINES += -DUNICODE -D_UNICODE
#XXX: We're not currently building the other parts,
# which would only be needed on the server side of the equation.
CPPSRCS = \
crash_generation_client.cc \
$(NULL)
# need static lib
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk

View File

@ -47,6 +47,8 @@ HOST_LIBRARY_NAME = host_breakpad_mac_common_s
LOCAL_INCLUDES = -I$(srcdir)/../..
DIRS = dwarf
# This is a little weird, but we're building a host and a target lib here.
# The host lib is used for dump_syms, and the target lib for the
# crash reporter client. Therefore, we don't need all the srcs in both.

View File

@ -14,11 +14,12 @@
# The Original Code is Mozilla Breakpad integration
#
# The Initial Developer of the Original Code is
# Ted Mielczarek <ted.mielczarek@gmail.com>
# Portions created by the Initial Developer are Copyright (C) 2006
# The Mozilla Foundation
# Portions created by the Initial Developer are Copyright (C) 2008
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ted Mielczarek <ted.mielczarek@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -34,13 +35,27 @@
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../../../..
DEPTH = ../../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = handler sender
MODULE = breakpad_mac_dwarf
HOST_LIBRARY_NAME = host_breakpad_mac_dwarf_s
LOCAL_INCLUDES = -I$(srcdir)/../../..
HOST_CPPSRCS = \
bytereader.cc \
dwarf2reader.cc \
functioninfo.cc \
$(NULL)
HOST_CXXFLAGS += -funsigned-char
# need static lib
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk

View File

@ -48,12 +48,13 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../../../common/mac \
$(NULL)
HOST_CMSRCS = \
dump_syms_tool.m \
HOST_CMMSRCS = \
dump_syms_tool.mm \
$(NULL)
HOST_LIBS += \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/mac/$(LIB_PREFIX)host_breakpad_mac_common_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/mac/dwarf/$(LIB_PREFIX)host_breakpad_mac_dwarf_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/$(LIB_PREFIX)host_breakpad_common_s.$(LIB_SUFFIX) \
$(NULL)

View File

@ -1,142 +0,0 @@
// Copyright (c) 2006, 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.
// dump_syms_tool.m: Command line tool that uses the DumpSymbols class.
// TODO(waylonis): accept stdin
#include <unistd.h>
#include <mach-o/arch.h>
#include "dump_syms.h"
#include "common/mac/macho_utilities.h"
typedef struct {
NSString *srcPath;
NSString *arch;
NSString *uuidStr;
BOOL result;
} Options;
//=============================================================================
static void Start(Options *options) {
DumpSymbols *dump = [[DumpSymbols alloc]
initWithContentsOfFile:options->srcPath];
if (!dump) {
fprintf(stderr, "%s is not a valid Mach-o file\n",
[options->srcPath fileSystemRepresentation]);
options->result = NO;
return;
}
if (![dump setArchitecture:options->arch]) {
fprintf(stderr, "Architecture: %s not available in %s\n",
[options->arch UTF8String],
[options->srcPath fileSystemRepresentation]);
options->result = NO;
return;
}
options->result = [dump writeSymbolFile:@"-"];
}
//=============================================================================
static void Usage(int argc, const char *argv[]) {
fprintf(stderr, "Output a Breakpad symbol file from a Mach-o file.\n");
fprintf(stderr, "Usage: %s [-a ppc|i386|x86] <Mach-o file>\n",
argv[0]);
fprintf(stderr, "\t-a: Architecture type [default: native]\n");
fprintf(stderr, "\t-h: Usage\n");
fprintf(stderr, "\t-?: Usage\n");
}
//=============================================================================
static void SetupOptions(int argc, const char *argv[], Options *options) {
extern int optind;
const NXArchInfo *localArchInfo = NXGetLocalArchInfo();
char ch;
if (localArchInfo) {
if (localArchInfo->cputype & CPU_ARCH_ABI64)
options->arch = (localArchInfo->cputype == CPU_TYPE_POWERPC64) ? @"ppc64":
@"x86_64";
else
options->arch = (localArchInfo->cputype == CPU_TYPE_POWERPC) ? @"ppc" :
@"x86";
}
while ((ch = getopt(argc, (char * const *)argv, "a:h?")) != -1) {
switch (ch) {
case 'a':
if (strcmp("ppc", optarg) == 0)
options->arch = @"ppc";
else if (strcmp("x86", optarg) == 0 || strcmp("i386", optarg) == 0)
options->arch = @"x86";
else if (strcmp("ppc64", optarg) == 0)
options->arch = @"ppc64";
else if (strcmp("x86_64", optarg) == 0)
options->arch = @"x86_64";
else {
fprintf(stderr, "%s: Invalid architecture: %s\n", argv[0], optarg);
Usage(argc, argv);
exit(1);
}
break;
case '?':
case 'h':
Usage(argc, argv);
exit(0);
break;
}
}
if ((argc - optind) != 1) {
fprintf(stderr, "Must specify Mach-o file\n");
Usage(argc, argv);
exit(1);
}
options->srcPath = [[NSFileManager defaultManager]
stringWithFileSystemRepresentation:argv[optind]
length:strlen(argv[optind])];
}
//=============================================================================
int main (int argc, const char * argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Options options;
bzero(&options, sizeof(Options));
SetupOptions(argc, argv, &options);
Start(&options);
[pool release];
return !options.result;
}

View File

@ -69,6 +69,7 @@ include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),WINNT)
LIBS += \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/windows/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/$(LIB_PREFIX)crash_generation_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/windows/$(LIB_PREFIX)breakpad_windows_common_s.$(LIB_SUFFIX)
LIBS += $(call expand_libname shell32)
OS_LIBS += $(call EXPAND_LIBNAME,ole32)

View File

@ -174,6 +174,7 @@ SHARED_LIBRARY_LIBS += $(DEPTH)/toolkit/crashreporter/$(LIB_PREFIX)exception_han
ifeq ($(OS_ARCH),WINNT)
SHARED_LIBRARY_LIBS += \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/windows/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/$(LIB_PREFIX)crash_generation_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/windows/$(LIB_PREFIX)breakpad_windows_common_s.$(LIB_SUFFIX)
endif