Skip to contentSkip to conversation

google-breakpad: new package

PATCH Superseded Pascal Huerst 1 participant 2 messages May 21, 2014 Kbuild

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 google-breakpad: new package

Breakpad is a library and tool suite that allows you to distribute an application to users with compiler-provided debugging information removed, record crashes in compact "minidump" files, send them back to your server, and produce C and C++ stack traces from these minidumps. Breakpad can also write minidumps on request for programs that have not crashed.

---

Changes v2 -> v3 (All suggested by thomas.petazzoni at free-electrons.com)
Removed dependency of BR2_ENABLE_DEBUG, but added comment,
that this flag might have to be set in order to use breakpad properly.
Removed "find -name ..." for libs and binaries by generic patterns,
such as "*.so" and so forth. This will never work properly. Instead I added a list to insert libs and binaries, that will be symbol- dumped and prepared for breakpad (see Config.in patch v3 2/2)
Changed storage path for dumps from: $(TARGET_DIR).. to
$(STAGING_DIR)/usr/share/google-breakpad-symbols/
Removed most logic from Makefile. Added script instead, which is
called by Makefile
Added dependency for compatible targets: ARM, i386, MIPS... Set fixed version for checkout (instead of head)
Fixed typos, and some minor mistakes

Changes v1 -> v2 (All suggested by maxime.hadjinlian at gmail.com)
Added dependency from BR2_ENABLE_DEBUG
Removed symbolstore.py -> Its all done in Makefile now Removed new Target -> It in target-finalize before stripping now Added LICENSE and LICENSE_FILE to *.mk

 package/Config.in                                  |  1 +
 package/google-breakpad/Config.in                  | 21 ++++++++++++
 .../google-breakpad/google-breakpad-gen-syms.sh    | 40 ++++++++++++++++++++++
 package/google-breakpad/google-breakpad.mk         | 17 +++++++++
 4 files changed, 79 insertions(+)
 create mode 100644 package/google-breakpad/Config.in
 create mode 100755 package/google-breakpad/google-breakpad-gen-syms.sh
 create mode 100644 package/google-breakpad/google-breakpad.mk
package/Config.in +1 -0
index 3bc8d24..0e59c06 100644
@@ -53,6 +53,7 @@ source "package/dstat/Config.in"
 source "package/duma/Config.in"
 source "package/fio/Config.in"
 source "package/gdb/Config.in"
+source "package/google-breakpad/Config.in"
 source "package/iozone/Config.in"
 source "package/kexec/Config.in"
 source "package/ktap/Config.in"
package/google-breakpad/Config.in new file +21 -0
new file mode 100644
index 0000000..5c9e18b
@@ -0,0 +1,21 @@
+config BR2_PACKAGE_GOOGLE_BREAKPAD
+	bool "google-breakpad"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on BR2_i386 || BR2_x86_64 || BR2_arm || BR2_aarch64 || BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
+
+	help
+	  Google-Breakpad is a library and tool suite that allows you to distribute 
+	  an application to users with compiler-provided debugging information 
+	  removed, record crashes in compact "minidump" files, send them back to 
+	  your server, and produce C and C++ stack traces from these minidumps. 
+	  Breakpad can also write minidumps on request for programs that have not 
+	  crashed. 	 
+
+	  Add all binaries and libraries you want to debug by google-breakpad to
+	  BR2_GOOGLE_BREAKPAD_INCLUDE_FILES
+
+	  http://code.google.com/p/google-breakpad/
+
+comment "google-breakpad requires an (e)glibc toolchain w/ C++ enabled"
+	depends on !(BR2_INSTALL_LIBSTDCPP && BR2_TOOLCHAIN_USES_GLIBC)
package/google-breakpad/google-breakpad-gen-syms.sh new file +40 -0
new file mode 100755
index 0000000..884e523
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+STAGING_DIR=$1
+HOST_DIR=$2
+INCLUDE_FILES=$3
+
+# Search for files we want to dump symbols of
+FIND_CMD="find $STAGING_DIR -name \"\""
+
+for INCLUDE_FILE in $INCLUDE_FILES; do
+	FIND_CMD="$FIND_CMD -o -name \"$INCLUDE_FILE\""
+done
+
+FIND_CMD="$FIND_CMD -print"
+
+
+# Create directory structure
+SYMBOLS_DIR=$STAGING_DIR/usr/share/google-breakpad-symbols
+
+mkdir -p $SYMBOLS_DIR/tmp
+
+for BIN_PATH in $(eval $FIND_CMD); do
+	BIN=$(basename $BIN_PATH);
+	SYM=$BIN.sym;
+
+	$HOST_DIR/usr/bin/dump_syms $BIN_PATH > $SYMBOLS_DIR/tmp/$SYM 2>/dev/null;
+
+	if [ $? -eq 0 ]; then
+		HASH=$(head -n1 $SYMBOLS_DIR/tmp/$SYM | cut -d ' ' -f 4);
+		mkdir -p $SYMBOLS_DIR/$BIN/$HASH
+		mv $SYMBOLS_DIR/tmp/$SYM $SYMBOLS_DIR/$BIN/$HASH;
+	else
+		rm -f $SYMBOLS_DIR/tmp/$SYM
+		echo "Can not dump symbols of $BIN for google-breakpad!"
+	fi
+done
+
+rm -Rf $SYMBOLS_DIR/tmp
+
+exit 0
package/google-breakpad/google-breakpad.mk new file +17 -0
new file mode 100644
index 0000000..e5b69c0
@@ -0,0 +1,17 @@
+################################################################################
+#
+# google-breakpad
+#
+################################################################################
+
+GOOGLE_BREAKPAD_VERSION = 1320
+GOOGLE_BREAKPAD_SITE = http://google-breakpad.googlecode.com/svn/trunk
+GOOGLE_BREAKPAD_SITE_METHOD = svn
+GOOGLE_BREAKPAD_CONF_OPT = --disable-processor --disable-tools
+GOOGLE_BREAKPAD_DEPENDENCIES = host-google-breakpad
+GOOGLE_BREAKPAD_INSTALL_STAGING = YES
+GOOGLE_BREAKPAD_LICENSE = BSD-3c
+GOOGLE_BREAKPAD_LICENSE_FILES = LICENSE
+
+$(eval $(host-autotools-package))
+$(eval $(autotools-package))
Signature · 1 line
1.9.0
#1 lore raw

PATCH v3 2/2 google-breakpad: integration into makefile and Config.in

This adds the symbol generation for google-breakpad to the Makefile and adds a list were users can insert libraries and binaries that should be symbol-dumped.

---
 Config.in | 10 ++++++++++
 Makefile  |  7 +++++++
 2 files changed, 17 insertions(+)
Config.in +10 -0
index d402c93..2439026 100644
@@ -457,6 +457,16 @@ config BR2_OPTIMIZE_S
 
 endchoice
 
+config BR2_GOOGLE_BREAKPAD_INCLUDE_FILES
+	string "executables and libraries to be used by google-breakpad"
+	depends on BR2_PACKAGE_GOOGLE_BREAKPAD
+	default ""
+	help
+	  You may specify a space-seperated list of binaries and libraries
+	  here of which debug symbols should be dumped for google breakpad.
+	  Debug symbols will be stored as google_breakpad_symbols in: 
+	  staging/usr/shared/google-breakpad-symbols
+
 config BR2_ENABLE_SSP
 	bool "build code with Stack Smashing Protection"
 	depends on BR2_TOOLCHAIN_HAS_SSP
Makefile +7 -0
index 4b93805..dbdef4a 100644
@@ -553,6 +553,13 @@ endif
 ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY)$(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
 	find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
 endif
+ifeq ($(BR2_PACKAGE_GOOGLE_BREAKPAD),y)
+	package/google-breakpad/google-breakpad-gen-syms.sh \
+		$(STAGING_DIR) \
+		$(HOST_DIR) \
+		"$(call qstrip,$(BR2_GOOGLE_BREAKPAD_INCLUDE_FILES))" 
+endif
+
 	rm -rf $(TARGET_DIR)/usr/lib/luarocks
 	$(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
 	if test -d $(TARGET_DIR)/lib/modules; then \
Signature · 1 line
1.9.0