Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 43 additions & 33 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ AM_CXXFLAGS += -fPIC
endif

if WINDOWS_HOST
# don't have stab.h, don't build stabs support
AM_CPPFLAGS += -DNO_STABS_SUPPORT
# Windows doesn't have stab.h
AM_CPPFLAGS += -I$(top_srcdir)/src/third_party/stab/include
endif

if MINGW_HOST
Expand All @@ -62,6 +62,10 @@ AM_CPPFLAGS += -D_POSIX_C_SOURCE
AM_CPPFLAGS += -D__USE_MINGW_ANSI_STDIO
endif

if MACOS_HOST
AM_CPPFLAGS += -Wno-deprecated-declarations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warnings should just be non-fatal rather than disabled completely. See #22 (this warning is already there on master).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can replace that with -Wno-error=deprecated-declarations instead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Werror should be off by default but for people who choose to turn it on, the deprecated declarations warning should be an error.

endif

# Specify include paths for ac macros
ACLOCAL_AMFLAGS = -I m4

Expand Down Expand Up @@ -391,11 +395,16 @@ bin_PROGRAMS += \
src/tools/windows/dump_syms_dwarf/dump_syms_dwarf
endif

if !DISABLE_TOOLS
bin_PROGRAMS += \
src/tools/linux/dump_syms/dump_syms
endif

if MINGW_HOST
# For MinGW, use gyp to generate a Makefile to build Windows client library
Configuration ?= Debug
all-local:
cd $(top_srcdir)/src ; ./tools/gyp/gyp --no-circular-check --no-parallel --depth=. -f make client/windows/breakpad_client.gyp
cd $(top_srcdir)/src ; GYP_DEFINES='OS=win' ./tools/gyp/gyp --no-circular-check --no-parallel --depth=. -f make client/windows/breakpad_client.gyp

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does GYP_DEFINES come from?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ grep -r GYP_DEFINES src/tools/gyp/
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  os.environ['GYP_DEFINES'] = \
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:    os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:    del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  os.environ['GYP_DEFINES'] = (
src/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines/gyptest-define-override.py:os.environ['GYP_DEFINES'] = 'OS=fakeos'
src/tools/gyp/test/defines/gyptest-defines-env-regyp.py:  os.environ['GYP_DEFINES'] = 'value=50'
src/tools/gyp/test/defines/gyptest-defines-env-regyp.py:  os.environ['GYP_DEFINES'] = ''
src/tools/gyp/test/defines/gyptest-defines-env-regyp.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines/gyptest-defines-env.py:  os.environ['GYP_DEFINES'] = 'value=10'
src/tools/gyp/test/defines/gyptest-defines-env.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines/gyptest-defines-env.py:  os.environ['GYP_DEFINES'] = 'value=20'
src/tools/gyp/test/defines/gyptest-defines-env.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines/gyptest-defines-env.py:  os.environ['GYP_DEFINES'] = 'value=30'
src/tools/gyp/test/defines/gyptest-defines-env.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/defines/gyptest-defines-env.py:  os.environ['GYP_DEFINES'] = 'value=40'
src/tools/gyp/test/defines/gyptest-defines-env.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/gyp-defines/gyptest-multiple-values.py:os.environ['GYP_DEFINES'] = 'key=value1 key=value2 key=value3'
src/tools/gyp/test/gyp-defines/gyptest-multiple-values.py:os.environ['GYP_DEFINES'] = 'key=repeated_value key=value1 key=repeated_value'
src/tools/gyp/test/gyp-defines/gyptest-regyp.py:os.environ['GYP_DEFINES'] = 'key=repeated_value key=value1 key=repeated_value'
src/tools/gyp/test/lib/TestGyp.py:    # Clear $GYP_DEFINES for the same reason.
src/tools/gyp/test/lib/TestGyp.py:    if 'GYP_DEFINES' in os.environ:
src/tools/gyp/test/lib/TestGyp.py:      del os.environ['GYP_DEFINES']
src/tools/gyp/test/msvs/external_builder/gyptest-all.py:  os.environ['GYP_DEFINES'] = 'use_external_builder=1'
src/tools/gyp/test/msvs/external_builder/gyptest-all.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/msvs/external_builder/gyptest-all.py:  os.environ['GYP_DEFINES'] = 'use_external_builder=1'
src/tools/gyp/test/msvs/external_builder/gyptest-all.py:  del os.environ['GYP_DEFINES']
src/tools/gyp/test/variables/commands/gyptest-commands-ignore-env.py:os.environ['GYP_DEFINES'] = 'FOO=BAR'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, damn, those are fetched with ./fetch-externals… We should really get rid of gyp!

@illwieckz illwieckz Jul 24, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slipher we may have a big problem, we may be you and me the only people on Earth being able to build the dwarf mingw dump_syms thanks to our local copy (in our own computers) of a specific gyp that is not anymore the one fetched by ./fetch-externals. We need to get rid of it.

@illwieckz illwieckz Jul 24, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah no it's for the non-dwarf Windows dump_syms or even something else, but maybe this also builds libs for the dwarf one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This NUKES GYP:

cd $(top_srcdir)/src ; $(MAKE) CXX="$(CXX)" CXXFLAGS="-DUNICODE -D_UNICODE $(AM_CPPFLAGS) $(CXXFLAGS)" AR="$(AR)" RC="$(WINDRES)" BUILDTYPE="$(Configuration)"
endif

Expand Down Expand Up @@ -627,36 +636,6 @@ src_tools_linux_pid2md_pid2md_SOURCES = \
src_tools_linux_pid2md_pid2md_LDADD = \
src/client/linux/libbreakpad_client.a

src_tools_linux_dump_syms_dump_syms_SOURCES = \
src/common/dwarf_cfi_to_module.cc \
src/common/dwarf_cu_to_module.cc \
src/common/dwarf_line_to_module.cc \
src/common/dwarf_range_list_handler.cc \
src/common/language.cc \
src/common/module.cc \
src/common/path_helper.cc \
src/common/stabs_reader.cc \
src/common/stabs_to_module.cc \
src/common/dwarf/bytereader.cc \
src/common/dwarf/dwarf2diehandler.cc \
src/common/dwarf/dwarf2reader.cc \
src/common/dwarf/elf_reader.cc \
src/common/linux/crc32.cc \
src/common/linux/dump_symbols.cc \
src/common/linux/dump_symbols.h \
src/common/linux/elf_symbols_to_module.cc \
src/common/linux/elf_symbols_to_module.h \
src/common/linux/elfutils.cc \
src/common/linux/file_id.cc \
src/common/linux/linux_libc_support.cc \
src/common/linux/memory_mapped_file.cc \
src/common/linux/safe_readlink.cc \
src/tools/linux/dump_syms/dump_syms.cc
src_tools_linux_dump_syms_dump_syms_CXXFLAGS = \
$(RUST_DEMANGLE_CFLAGS)
src_tools_linux_dump_syms_dump_syms_LDADD = \
$(RUST_DEMANGLE_LIBS)

src_tools_linux_md2core_minidump_2_core_SOURCES = \
src/common/linux/memory_mapped_file.cc \
src/common/path_helper.cc \
Expand Down Expand Up @@ -855,6 +834,37 @@ src_tools_windows_dump_syms_dwarf_dump_syms_dwarf_SOURCES = \
src/tools/windows/dump_syms_dwarf/dump_syms.cc
src_tools_windows_dump_syms_dwarf_dump_syms_dwarf_LDADD = \
$(SOCKET_LIBS)

src_tools_linux_dump_syms_dump_syms_SOURCES = \
src/common/dwarf_cfi_to_module.cc \
src/common/dwarf_cu_to_module.cc \
src/common/dwarf_line_to_module.cc \
src/common/dwarf_range_list_handler.cc \
src/common/language.cc \
src/common/module.cc \
src/common/path_helper.cc \
src/common/stabs_reader.cc \
src/common/stabs_to_module.cc \
src/common/dwarf/bytereader.cc \
src/common/dwarf/dwarf2diehandler.cc \
src/common/dwarf/dwarf2reader.cc \
src/common/dwarf/elf_reader.cc \
src/common/linux/crc32.cc \
src/common/linux/dump_symbols.cc \
src/common/linux/dump_symbols.h \
src/common/linux/elf_symbols_to_module.cc \
src/common/linux/elf_symbols_to_module.h \
src/common/linux/elfutils.cc \
src/common/linux/file_id.cc \
src/common/linux/linux_libc_support.cc \
src/common/linux/memory_mapped_file.cc \
src/common/linux/safe_readlink.cc \
src/tools/linux/dump_syms/dump_syms.cc
src_tools_linux_dump_syms_dump_syms_CXXFLAGS = \
$(RUST_DEMANGLE_CFLAGS)
src_tools_linux_dump_syms_dump_syms_LDADD = \
$(RUST_DEMANGLE_LIBS) \
$(SOCKET_LIBS)
endif

if !DISABLE_PROCESSOR
Expand Down
6 changes: 5 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ AC_ARG_ENABLE(m32,
AC_HEADER_STDC
AC_SYS_LARGEFILE
AX_PTHREAD
AC_CHECK_HEADERS([a.out.h sys/random.h])
AC_CHECK_HEADERS([a.out.h mach-o/nlist.h sys/random.h])
AC_CHECK_FUNCS([arc4random getcontext getrandom])
AM_CONDITIONAL([HAVE_GETCONTEXT], [test "x$ac_cv_func_getcontext" = xyes])

Expand Down Expand Up @@ -115,6 +115,9 @@ case $host in
*-*-linux* | *-android* )
LINUX_HOST=true
;;
*-apple-* )
MACOS_HOST=true
;;
*-*-cygwin* )
WINDOWS_HOST=true
;;
Expand All @@ -125,6 +128,7 @@ case $host in
esac

AM_CONDITIONAL(LINUX_HOST, test x$LINUX_HOST = xtrue)
AM_CONDITIONAL(MACOS_HOST, test x$MACOS_HOST = xtrue)
# WINDOWS_HOST means MINGW or CYGWIN
AM_CONDITIONAL(WINDOWS_HOST, test x$WINDOWS_HOST = xtrue)
AM_CONDITIONAL(MINGW_HOST, test x$MINGW_HOST = xtrue)
Expand Down
6 changes: 4 additions & 2 deletions src/common/dwarf/elf_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@
#define _GNU_SOURCE // needed for pread()
#endif

#include "compat/linux.h"
#include "compat/elf.h"
#include "compat/mman.h"

#include <fcntl.h>
#include <limits.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
Expand All @@ -46,7 +49,6 @@
// Also need to add configure tests for zlib.
//#include "zlib.h"

#include "third_party/musl/include/elf.h"
#include "elf_reader.h"
#include "common/using_std_string.h"

Expand Down
8 changes: 5 additions & 3 deletions src/common/linux/dump_symbols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,21 @@
// dump_symbols.cc: implement google_breakpad::WriteSymbolFile:
// Find all the debugging info in a file and dump it as a Breakpad symbol file.

#include "compat/linux.h"
#include "compat/elf.h"
#include "compat/link.h"
#include "compat/mman.h"

#include "common/linux/dump_symbols.h"

#include <assert.h>
#include <elf.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <link.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>

Expand Down
2 changes: 1 addition & 1 deletion src/common/linux/elf_gnu_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#ifndef COMMON_LINUX_ELF_GNU_COMPAT_H_
#define COMMON_LINUX_ELF_GNU_COMPAT_H_

#include <elf.h>
#include "compat/elf.h"

// A note type on GNU systems corresponding to the .note.gnu.build-id section.
#ifndef NT_GNU_BUILD_ID
Expand Down
4 changes: 3 additions & 1 deletion src/common/linux/elf_symbols_to_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@

// Original author: Ted Mielczarek <ted.mielczarek@gmail.com>

#include "compat/linux.h"
#include "compat/elf.h"

#include "common/linux/elf_symbols_to_module.h"

#include <cxxabi.h>
#include <elf.h>
#include <string.h>

#include "common/byte_cursor.h"
Expand Down
5 changes: 3 additions & 2 deletions src/common/linux/elfutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
#ifndef COMMON_LINUX_ELFUTILS_H_
#define COMMON_LINUX_ELFUTILS_H_

#include <elf.h>
#include <link.h>
#include "compat/elf.h"
#include "compat/link.h"

#include <stdint.h>

#include "common/memory_allocator.h"
Expand Down
3 changes: 2 additions & 1 deletion src/common/linux/file_id.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
// See file_id.h for documentation
//

#include "compat/inet.h"

#include "common/linux/file_id.h"

#include <arpa/inet.h>
#include <assert.h>
#include <string.h>

Expand Down
14 changes: 7 additions & 7 deletions src/common/linux/guid_creator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ class GUIDGenerator {
#endif

// Put in the version according to RFC 4122.
guid->data3 &= 0x0fff;
guid->data3 |= 0x4000;
guid->COMPAT_GUID_DATA3 &= 0x0fff;
guid->COMPAT_GUID_DATA3 |= 0x4000;

// Put in the variant according to RFC 4122.
guid->data4[0] &= 0x3f;
guid->data4[0] |= 0x80;
guid->COMPAT_GUID_DATA4[0] &= 0x3f;
guid->COMPAT_GUID_DATA4[0] |= 0x80;

return true;
}
Expand Down Expand Up @@ -178,9 +178,9 @@ bool GUIDToString(const GUID *guid, char *buf, int buf_len) {
// Should allow more space the the max length of GUID.
assert(buf_len > kGUIDStringLength);
int num = snprintf(buf, buf_len, kGUIDFormatString,
guid->data1, guid->data2, guid->data3,
GUIDGenerator::BytesToUInt32(&(guid->data4[0])),
GUIDGenerator::BytesToUInt32(&(guid->data4[4])));
guid->COMPAT_GUID_DATA1, guid->COMPAT_GUID_DATA2, guid->COMPAT_GUID_DATA3,
GUIDGenerator::BytesToUInt32(&(guid->COMPAT_GUID_DATA4[0])),
GUIDGenerator::BytesToUInt32(&(guid->COMPAT_GUID_DATA4[4])));
if (num != kGUIDStringLength)
return false;

Expand Down
4 changes: 3 additions & 1 deletion src/common/linux/guid_creator.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
#ifndef COMMON_LINUX_GUID_CREATOR_H__
#define COMMON_LINUX_GUID_CREATOR_H__

// Set MDGUID.
#include "google_breakpad/common/minidump_format.h"

typedef MDGUID GUID;
// Use MDGUID.
#include "compat/guiddef.h"

// Format string for parsing GUID.
#define kGUIDFormatString "%08x-%04x-%04x-%08x-%08x"
Expand Down
5 changes: 4 additions & 1 deletion src/common/linux/memory_mapped_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@
// memory_mapped_file.cc: Implement google_breakpad::MemoryMappedFile.
// See memory_mapped_file.h for details.

#include "compat/linux.h"
#include "compat/mman.h"
#include "compat/syscall.h"

#include "common/linux/memory_mapped_file.h"

#include <fcntl.h>
#include <sys/mman.h>
#if defined(__ANDROID__)
#include <sys/stat.h>
#endif
Expand Down
5 changes: 3 additions & 2 deletions src/common/linux/safe_readlink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
// safe_readlink.cc: Implement google_breakpad::SafeReadLink.
// See safe_readlink.h for details.

#include <stddef.h>
#include "compat/linux.h"
#include "compat/syscall.h"

#include "third_party/lss/linux_syscall_support.h"
#include <stddef.h>

namespace google_breakpad {

Expand Down
13 changes: 4 additions & 9 deletions src/common/memory_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@
#ifndef GOOGLE_BREAKPAD_COMMON_MEMORY_ALLOCATOR_H_
#define GOOGLE_BREAKPAD_COMMON_MEMORY_ALLOCATOR_H_

#include "compat/linux.h"
#include "compat/mman.h"
#include "compat/syscall.h"

#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>

#include <memory>
#include <vector>
Expand All @@ -42,14 +45,6 @@
#include <sanitizer/msan_interface.h>
#endif

#ifdef __APPLE__
#define sys_mmap mmap
#define sys_munmap munmap
#define MAP_ANONYMOUS MAP_ANON
#else
#include "third_party/lss/linux_syscall_support.h"
#endif

namespace google_breakpad {

// This is very simple allocator which fetches pages from the kernel directly.
Expand Down
2 changes: 2 additions & 0 deletions src/common/stabs_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
// This file implements the google_breakpad::StabsReader class.
// See stabs_reader.h.

#include "compat/linux.h"

#include "common/stabs_reader.h"

#include <assert.h>
Expand Down
10 changes: 10 additions & 0 deletions src/compat/elf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef SRC_COMPAT_ELF_H_
#define SRC_COMPAT_ELF_H_

#if !defined(_WIN32) && !defined(__APPLE__)
#include <elf.h>
#else
#include "third_party/musl/include/elf.h"
#endif

#endif // SRC_COMPAT_ELF_H_
22 changes: 22 additions & 0 deletions src/compat/guiddef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef SRC_COMPAT_GUIDDEF_H_
#define SRC_COMPAT_GUIDDEF_H_

#if defined(_WIN32)
#include <guiddef.h>
#else
typedef MDGUID GUID;
#endif

#if defined(_WIN32)
#define COMPAT_GUID_DATA1 Data1
#define COMPAT_GUID_DATA2 Data2
#define COMPAT_GUID_DATA3 Data3
#define COMPAT_GUID_DATA4 Data4
#else
#define COMPAT_GUID_DATA1 data1
#define COMPAT_GUID_DATA2 data2
#define COMPAT_GUID_DATA3 data3
#define COMPAT_GUID_DATA4 data4
#endif

#endif // SRC_COMPAT_GUIDDEF_H_
10 changes: 10 additions & 0 deletions src/compat/inet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef SRC_COMPAT_INET_H_
#define SRC_COMPAT_INET_H_

#if defined(_WIN32)
#include <winsock2.h>
#else
#include <arpa/inet.h>
#endif

#endif // SRC_COMPAT_INET_H_
Loading