Skip to contentSkip to conversation

google-breakpad: Integration into Makefile and Config.in

PATCH Superseded Pascal Huerst 3 participants 7 messages Jul 23, 2014 – Jul 31, 2014

v7 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v7 cover google-breakpad: Integration into Makefile and Config.in

Changes v6 -> v7
Removed comments I forgot to remove in v6 in gen-symy.sh for:
ifeq ($(BR2_PACKAGE_GOOGLE_BREAKPAD),y)
as suggested by Yann E. MORIN
Still using eval, however for:
for FILE in $(eval ls "${TARGET_DIR}/${@}"); do could not make it work without eval

Changes v5 -> v6
google-breakpad: new package has been accepted.
Moved parts from makefile into google-breakpad.mk and defined
the call to gen-symy.sh as a new variable in google-breakpas.mk. This seems to be more compatible with fabios series, as suggested by Arnout and Thomas.
Changed integration in Config.in, by adding an enable google breakpad
option which expands to a list to insert filenames as suggested by Arnout and Thomas.
Removed creation of tmp directory in gen-symy.sh as sugested
by Arnout, since this is not necessary.

Changes v4 -> v5 (All suggested by Yann E. MORIN)
Fixed some typo
Reorganized patch structure
which parts belong to 'new package' and which parts belong to 'intergration into Makefile and Config.in'
Changed and Rewrote gen-symy.sh - script
Passing $(EXTRA_ENV)
Adapted a proposed solution from Yann E. MORIN, which uses ls instead of find commands
Made better descriptions for users in:
Config.in
package/google-breakpad/Config.in

Changes v3 -> v4
Fixed minor issue in google-breakpad_gen-syms.sh
Had to remove -print from find command

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

Pascal Huerst (1):
google-breakpad: Integration into Makefile and Config.in

 Config.in                                  | 28 ++++++++++++++++++++++++++++
 package/google-breakpad/gen-syms.sh        | 25 +++++++++++++++++++++++++
 package/google-breakpad/google-breakpad.mk |  8 ++++++++
 3 files changed, 61 insertions(+)
 create mode 100755 package/google-breakpad/gen-syms.sh
Signature · 1 line
1.9.3
#1 lore raw

PATCH v7 1/1 google-breakpad: Integration into Makefile and Config.in

---
 Config.in                                  | 28 ++++++++++++++++++++++++++++
 package/google-breakpad/gen-syms.sh        | 25 +++++++++++++++++++++++++
 package/google-breakpad/google-breakpad.mk |  8 ++++++++
 3 files changed, 61 insertions(+)
 create mode 100755 package/google-breakpad/gen-syms.sh
Config.in +28 -0
index b169678..432ec28 100644
@@ -484,6 +484,34 @@ config BR2_OPTIMIZE_S
 
 endchoice
 
+config BR2_GOOGLE_BREAKPAD_ENABLE
+	bool "Enable google-breakpad support"
+	select BR2_PACKAGE_GOOGLE_BREAKPAD
+	help
+	  This option will enable the use of google breakpad, 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.
+
+if BR2_GOOGLE_BREAKPAD_ENABLE
+
+config BR2_GOOGLE_BREAKPAD_INCLUDE_FILES
+	string "List of executables and libraries to extract symbols from"
+	default ""
+	help
+	  You may specify a space-separated list of binaries and libraries
+	  with full paths relative to $(TARGET_DIR) of which debug symbols 
+	  will be dumped for further use with google breakpad.
+
+	  A directory structure that can be used by minidump-stackwalk will
+	  be created at:
+
+	  $(STAGING_DIR)/usr/share/google-breakpad-symbols
+
+endif
+
 config BR2_ENABLE_SSP
 	bool "build code with Stack Smashing Protection"
 	depends on BR2_TOOLCHAIN_HAS_SSP
package/google-breakpad/gen-syms.sh new file +25 -0
new file mode 100755
index 0000000..f29c8fe
@@ -0,0 +1,25 @@
+#!/bin/sh
+STAGING_DIR="${1}"
+TARGET_DIR="${2}"
+shift 2
+
+SYMBOLS_DIR="${STAGING_DIR}/usr/share/google-breakpad-symbols"
+rm -rf "${SYMBOLS_DIR}"
+mkdir -p "${SYMBOLS_DIR}"
+
+for FILE in $(eval ls "${TARGET_DIR}/${@}"); do
+	if [ -d "${FILE}" ]; then
+		printf "Error: '%s' is a directory\n" "${FILE}" >&2
+		exit 1
+	fi
+	if dump_syms "${FILE}" > "${SYMBOLS_DIR}/tmp.sym" 2>/dev/null; then
+		HASH=$(head -n1 "${SYMBOLS_DIR}/tmp.sym" | cut -d ' ' -f 4);
+		FILENAME=$(basename "$FILE");
+		mkdir -p "${SYMBOLS_DIR}/${FILENAME}/${HASH}"
+		mv "${SYMBOLS_DIR}/tmp.sym" "${SYMBOLS_DIR}/${FILENAME}/${HASH}/${FILENAME}.sym";
+	else
+		printf "Error dumping symbols for: '%s'\n" "${FILE}" >&2
+		exit 1
+	fi
+done
+rm -rf "${SYMBOLS_DIR}/tmp"
package/google-breakpad/google-breakpad.mk +8 -0
index bf857ba..8dea916 100644
@@ -14,5 +14,13 @@ GOOGLE_BREAKPAD_INSTALL_STAGING = YES
 GOOGLE_BREAKPAD_LICENSE = BSD-3c
 GOOGLE_BREAKPAD_LICENSE_FILES = LICENSE
 
+ifeq ($(BR2_PACKAGE_GOOGLE_BREAKPAD),y)
+define GOOGLE_BREAKPAD_EXTRACT_SYMBOLS
+	$(EXTRA_ENV) package/google-breakpad/gen-syms.sh $(STAGING_DIR) \
+		$(TARGET_DIR) $(call qstrip,$(BR2_GOOGLE_BREAKPAD_INCLUDE_FILES))
+endef
+TARGET_FINALIZE_HOOKS += GOOGLE_BREAKPAD_EXTRACT_SYMBOLS
+endif
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
Signature · 1 line
1.9.3
#2 lore raw

PATCH v7 1/1 google-breakpad: Integration into Makefile and Config.in

Pascal, All,

On 2014-07-23 16:09 +0200, Pascal Huerst spake thusly:

Quoted 1 line

I'll be shepherding this patch, since it still needs a bit of work.

For example, there is no host package for google breakpad, so it does not work for me as I do not have googlebreakpad install on my host.

Also, I now know why you need this eval in the script. I do not like it, so I'll try to come up with an alternative solution. Still, I have one
question: do you expect that one would enter shell wildcards in the list of files to "breakpadize"?

It's a bit late here, now, so I'll continue tomorrow evening (GMT+2).

Regards,
Yann E. MORIN.

Quoted 102 lines
---
 Config.in                                  | 28 ++++++++++++++++++++++++++++
 package/google-breakpad/gen-syms.sh        | 25 +++++++++++++++++++++++++
 package/google-breakpad/google-breakpad.mk |  8 ++++++++
 3 files changed, 61 insertions(+)
 create mode 100755 package/google-breakpad/gen-syms.sh
Config.in +28 -0
index b169678..432ec28 100644
@@ -484,6 +484,34 @@ config BR2_OPTIMIZE_S
 
 endchoice
 
+config BR2_GOOGLE_BREAKPAD_ENABLE
+	bool "Enable google-breakpad support"
+	select BR2_PACKAGE_GOOGLE_BREAKPAD
+	help
+	  This option will enable the use of google breakpad, 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.
+
+if BR2_GOOGLE_BREAKPAD_ENABLE
+
+config BR2_GOOGLE_BREAKPAD_INCLUDE_FILES
+	string "List of executables and libraries to extract symbols from"
+	default ""
+	help
+	  You may specify a space-separated list of binaries and libraries
+	  with full paths relative to $(TARGET_DIR) of which debug symbols 
+	  will be dumped for further use with google breakpad.
+
+	  A directory structure that can be used by minidump-stackwalk will
+	  be created at:
+
+	  $(STAGING_DIR)/usr/share/google-breakpad-symbols
+
+endif
+
 config BR2_ENABLE_SSP
 	bool "build code with Stack Smashing Protection"
 	depends on BR2_TOOLCHAIN_HAS_SSP
package/google-breakpad/gen-syms.sh new file +25 -0
new file mode 100755
index 0000000..f29c8fe
@@ -0,0 +1,25 @@
+#!/bin/sh
+STAGING_DIR="${1}"
+TARGET_DIR="${2}"
+shift 2
+
+SYMBOLS_DIR="${STAGING_DIR}/usr/share/google-breakpad-symbols"
+rm -rf "${SYMBOLS_DIR}"
+mkdir -p "${SYMBOLS_DIR}"
+
+for FILE in $(eval ls "${TARGET_DIR}/${@}"); do
+	if [ -d "${FILE}" ]; then
+		printf "Error: '%s' is a directory\n" "${FILE}" >&2
+		exit 1
+	fi
+	if dump_syms "${FILE}" > "${SYMBOLS_DIR}/tmp.sym" 2>/dev/null; then
+		HASH=$(head -n1 "${SYMBOLS_DIR}/tmp.sym" | cut -d ' ' -f 4);
+		FILENAME=$(basename "$FILE");
+		mkdir -p "${SYMBOLS_DIR}/${FILENAME}/${HASH}"
+		mv "${SYMBOLS_DIR}/tmp.sym" "${SYMBOLS_DIR}/${FILENAME}/${HASH}/${FILENAME}.sym";
+	else
+		printf "Error dumping symbols for: '%s'\n" "${FILE}" >&2
+		exit 1
+	fi
+done
+rm -rf "${SYMBOLS_DIR}/tmp"
package/google-breakpad/google-breakpad.mk +8 -0
index bf857ba..8dea916 100644
@@ -14,5 +14,13 @@ GOOGLE_BREAKPAD_INSTALL_STAGING = YES
 GOOGLE_BREAKPAD_LICENSE = BSD-3c
 GOOGLE_BREAKPAD_LICENSE_FILES = LICENSE
 
+ifeq ($(BR2_PACKAGE_GOOGLE_BREAKPAD),y)
+define GOOGLE_BREAKPAD_EXTRACT_SYMBOLS
+	$(EXTRA_ENV) package/google-breakpad/gen-syms.sh $(STAGING_DIR) \
+		$(TARGET_DIR) $(call qstrip,$(BR2_GOOGLE_BREAKPAD_INCLUDE_FILES))
+endef
+TARGET_FINALIZE_HOOKS += GOOGLE_BREAKPAD_EXTRACT_SYMBOLS
+endif
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
Signature · 6 lines
1.9.3

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v7 1/1 google-breakpad: Integration into Makefile and Config.in

Hey Yann, all,

Quoted 2 lines · Yann E. MORIN

On 2014-07-23 16:09 +0200, Pascal Huerst spake thusly:
I'll be shepherding this patch, since it still needs a bit of work.

Thanks a lot, people seem to have quite different opinions and sometimes I don't understand why one solution is so much better than an other one...

Quoted 2 lines

For example, there is no host package for google breakpad, so it does not work for me as I do not have googlebreakpad install on my host.

I thought it has, since in google-breakpad.mk it says:

26 $(eval $(host-autotools-package))

and in my current version I have at least:

output/host/usr/bin/minidump-2-core
output/host/usr/bin/minidump_dump
output/host/usr/bin/minidump_stackwalk
output/host/usr/bin/minidump_upload

I only need minidump_stackwalk, to process minidumps. So that looked ok to me.

Quoted 4 lines

Also, I now know why you need this eval in the script. I do not like it, so I'll try to come up with an alternative solution. Still, I have one
question: do you expect that one would enter shell wildcards in the list of files to "breakpadize"?

Originally I wanted to be able to use wildcards and took the stripping mechanism (BR2_STRIP_EXCLUDE_FILES) as an example, but people didn't like it, so I adapted it. But actually I would say it's better to be able to use wildcards.

We are not using breakpad in production yet, but are integrating and maybe we'll find out later, that wildcards are useless, but for now, I would say, why not...

I also found out that make install does not install the headers and *.pc files. I'm in contact with the folks from breakpad to get this fixed. But this means that a version boost will also be needed as soon as that patch is upstream.

regards
pascal

Quoted 108 lines

It's a bit late here, now, so I'll continue tomorrow evening (GMT+2).

Regards,
Yann E. MORIN.

Quoted 102 lines
---
 Config.in                                  | 28 ++++++++++++++++++++++++++++
 package/google-breakpad/gen-syms.sh        | 25 +++++++++++++++++++++++++
 package/google-breakpad/google-breakpad.mk |  8 ++++++++
 3 files changed, 61 insertions(+)
 create mode 100755 package/google-breakpad/gen-syms.sh
Config.in +28 -0
index b169678..432ec28 100644
@@ -484,6 +484,34 @@ config BR2_OPTIMIZE_S
 
 endchoice
 
+config BR2_GOOGLE_BREAKPAD_ENABLE
+	bool "Enable google-breakpad support"
+	select BR2_PACKAGE_GOOGLE_BREAKPAD
+	help
+	  This option will enable the use of google breakpad, 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.
+
+if BR2_GOOGLE_BREAKPAD_ENABLE
+
+config BR2_GOOGLE_BREAKPAD_INCLUDE_FILES
+	string "List of executables and libraries to extract symbols from"
+	default ""
+	help
+	  You may specify a space-separated list of binaries and libraries
+	  with full paths relative to $(TARGET_DIR) of which debug symbols 
+	  will be dumped for further use with google breakpad.
+
+	  A directory structure that can be used by minidump-stackwalk will
+	  be created at:
+
+	  $(STAGING_DIR)/usr/share/google-breakpad-symbols
+
+endif
+
 config BR2_ENABLE_SSP
 	bool "build code with Stack Smashing Protection"
 	depends on BR2_TOOLCHAIN_HAS_SSP
package/google-breakpad/gen-syms.sh new file +25 -0
new file mode 100755
index 0000000..f29c8fe
@@ -0,0 +1,25 @@
+#!/bin/sh
+STAGING_DIR="${1}"
+TARGET_DIR="${2}"
+shift 2
+
+SYMBOLS_DIR="${STAGING_DIR}/usr/share/google-breakpad-symbols"
+rm -rf "${SYMBOLS_DIR}"
+mkdir -p "${SYMBOLS_DIR}"
+
+for FILE in $(eval ls "${TARGET_DIR}/${@}"); do
+	if [ -d "${FILE}" ]; then
+		printf "Error: '%s' is a directory\n" "${FILE}" >&2
+		exit 1
+	fi
+	if dump_syms "${FILE}" > "${SYMBOLS_DIR}/tmp.sym" 2>/dev/null; then
+		HASH=$(head -n1 "${SYMBOLS_DIR}/tmp.sym" | cut -d ' ' -f 4);
+		FILENAME=$(basename "$FILE");
+		mkdir -p "${SYMBOLS_DIR}/${FILENAME}/${HASH}"
+		mv "${SYMBOLS_DIR}/tmp.sym" "${SYMBOLS_DIR}/${FILENAME}/${HASH}/${FILENAME}.sym";
+	else
+		printf "Error dumping symbols for: '%s'\n" "${FILE}" >&2
+		exit 1
+	fi
+done
+rm -rf "${SYMBOLS_DIR}/tmp"
package/google-breakpad/google-breakpad.mk +8 -0
index bf857ba..8dea916 100644
@@ -14,5 +14,13 @@ GOOGLE_BREAKPAD_INSTALL_STAGING = YES
 GOOGLE_BREAKPAD_LICENSE = BSD-3c
 GOOGLE_BREAKPAD_LICENSE_FILES = LICENSE
 
+ifeq ($(BR2_PACKAGE_GOOGLE_BREAKPAD),y)
+define GOOGLE_BREAKPAD_EXTRACT_SYMBOLS
+	$(EXTRA_ENV) package/google-breakpad/gen-syms.sh $(STAGING_DIR) \
+		$(TARGET_DIR) $(call qstrip,$(BR2_GOOGLE_BREAKPAD_INCLUDE_FILES))
+endef
+TARGET_FINALIZE_HOOKS += GOOGLE_BREAKPAD_EXTRACT_SYMBOLS
+endif
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
Signature · 6 lines
1.9.3

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
#4 lore raw

PATCH v7 1/1 google-breakpad: Integration into Makefile and Config.in

Hi Pascal, all,

Quoted 12 lines · Pascal Huerst

Hey Yann, all,

Quoted 2 lines · Yann E. MORIN

On 2014-07-23 16:09 +0200, Pascal Huerst spake thusly:
I'll be shepherding this patch, since it still needs a bit of work.

Thanks a lot, people seem to have quite different opinions and sometimes I don't understand why one solution is so much better than an other one...

Quoted 2 lines

For example, there is no host package for google breakpad, so it does not work for me as I do not have googlebreakpad install on my host.

Quoted 7 lines

I thought it has, since in google-breakpad.mk it says:

26 $(eval $(host-autotools-package))

and in my current version I have at least:

output/host/usr/bin/minidump-2-core

AFAICS [1], minidump-2-core is not a cross-program ; so it could be better to remove it from the host tree.

Quoted 6 lines

output/host/usr/bin/minidump_dump
output/host/usr/bin/minidump_stackwalk
output/host/usr/bin/minidump_upload

I only need minidump_stackwalk, to process minidumps. So that looked ok to me.

Same here ;-).

[1] https://code.google.com/p/google-breakpad/source/browse/trunk/src/tools/linux/md2core/minidump-2-core.cc#425

Regards,

Signature · 1 line
Samuel
#5 lore raw

PATCH v7 1/1 google-breakpad: Integration into Makefile and Config.in

In reply to Pascal Huerst

Pascal, All,

On 2014-07-31 11:12 +0200, Pascal Huerst spake thusly:

Quoted 11 lines · Yann E. MORIN
Quoted 3 lines

On 2014-07-23 16:09 +0200, Pascal Huerst spake thusly:
For example, there is no host package for google breakpad, so it does not work for me as I do not have googlebreakpad install on my host.

I thought it has, since in google-breakpad.mk it says:

26 $(eval $(host-autotools-package))

and in my current version I have at least:

Quoted 7 lines

output/host/usr/bin/minidump-2-core
output/host/usr/bin/minidump_dump
output/host/usr/bin/minidump_stackwalk
output/host/usr/bin/minidump_upload

I only need minidump_stackwalk, to process minidumps. So that looked ok to me.

I do not have those files. Here's what I did:

    make defconfig
    make menuconfig
        -> use an external toolchain, to avoid the build time
        -> enable google-breakpad in Build options
        -> add /bin/busybox to be 'breakpadised'
        -> save and exit
    make
    [--SNIP--]
    >>>   Finalizing target directory
    PATH="/home/ymorin/dev/buildroot/O/host/bin:/home/ymorin/dev/buildroot/
    O/host/sbin:/home/ymorin/dev/buildroot/O/host/usr/bin:/home/ymorin/dev/
    buildroot/O/host/usr/sbin:/home/ymorin/bin:/home/ymorin/bin:/opt/mutt-s
    idebar/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    :/usr/games:/usr/local/games" BR2_DL_DIR=/home/ymorin/src BUILD_DIR=/ho
    me/ymorin/dev/buildroot/O/build package/google-breakpad/gen-syms.sh /ho
    me/ymorin/dev/buildroot/O/host/usr/i686-buildroot-linux-gnu/sysroot /ho
    me/ymorin/dev/buildroot/O/target /bin/busybox
    Error dumping symbols for: '/home/ymorin/dev/buildroot/O/target//bin/bu
    sybox'
    make[1]: *** [target-finalize] Error 1

Looking in host/usr/bin, I do not have the minidump executables.

That's because nothing depends on host-google-breakpad, so it is not built.

I'll fix that before I respin a fixed patch.

Quoted 9 lines
Quoted 4 lines

Also, I now know why you need this eval in the script. I do not like it, so I'll try to come up with an alternative solution. Still, I have one
question: do you expect that one would enter shell wildcards in the list of files to "breakpadize"?

Originally I wanted to be able to use wildcards and took the stripping mechanism (BR2_STRIP_EXCLUDE_FILES) as an example, but people didn't like it, so I adapted it. But actually I would say it's better to be able to use wildcards.

I (still) have some comments on your script. I'll see what I can come up with to fix that. I'll respin a new version later tonight.

Quoted 8 lines

We are not using breakpad in production yet, but are integrating and maybe we'll find out later, that wildcards are useless, but for now, I would say, why not...

I also found out that make install does not install the headers and *.pc files. I'm in contact with the folks from breakpad to get this fixed. But this means that a version boost will also be needed as soon as that patch is upstream.

Bumping a package is not a problem! ;-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH v7 1/1 google-breakpad: Integration into Makefile and Config.in

In reply to Yann E. MORIN

Hey Yann, all

I just had a talk with Mike Frysinger from chronium.org. And he pointed me to a script they used to generate the symbols with, before they switched to python.

https://chromium.googlesource.com/chromiumos/platform/crosutils/+/4c3b01b52480e527ac54eea2db73afa3d9b8c807/cros_generate_breakpad_symbols

It's quite extensive, but I would stick to our version for now.

regards
pascal

Quoted 123 lines · Yann E. MORIN

Pascal, All,

On 2014-07-23 16:09 +0200, Pascal Huerst spake thusly:

Quoted 1 line

I'll be shepherding this patch, since it still needs a bit of work.

For example, there is no host package for google breakpad, so it does not work for me as I do not have googlebreakpad install on my host.

Also, I now know why you need this eval in the script. I do not like it, so I'll try to come up with an alternative solution. Still, I have one
question: do you expect that one would enter shell wildcards in the list of files to "breakpadize"?

It's a bit late here, now, so I'll continue tomorrow evening (GMT+2).

Regards,
Yann E. MORIN.

Quoted 102 lines
---
 Config.in                                  | 28 ++++++++++++++++++++++++++++
 package/google-breakpad/gen-syms.sh        | 25 +++++++++++++++++++++++++
 package/google-breakpad/google-breakpad.mk |  8 ++++++++
 3 files changed, 61 insertions(+)
 create mode 100755 package/google-breakpad/gen-syms.sh
Config.in +28 -0
index b169678..432ec28 100644
@@ -484,6 +484,34 @@ config BR2_OPTIMIZE_S
 
 endchoice
 
+config BR2_GOOGLE_BREAKPAD_ENABLE
+	bool "Enable google-breakpad support"
+	select BR2_PACKAGE_GOOGLE_BREAKPAD
+	help
+	  This option will enable the use of google breakpad, 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.
+
+if BR2_GOOGLE_BREAKPAD_ENABLE
+
+config BR2_GOOGLE_BREAKPAD_INCLUDE_FILES
+	string "List of executables and libraries to extract symbols from"
+	default ""
+	help
+	  You may specify a space-separated list of binaries and libraries
+	  with full paths relative to $(TARGET_DIR) of which debug symbols 
+	  will be dumped for further use with google breakpad.
+
+	  A directory structure that can be used by minidump-stackwalk will
+	  be created at:
+
+	  $(STAGING_DIR)/usr/share/google-breakpad-symbols
+
+endif
+
 config BR2_ENABLE_SSP
 	bool "build code with Stack Smashing Protection"
 	depends on BR2_TOOLCHAIN_HAS_SSP
package/google-breakpad/gen-syms.sh new file +25 -0
new file mode 100755
index 0000000..f29c8fe
@@ -0,0 +1,25 @@
+#!/bin/sh
+STAGING_DIR="${1}"
+TARGET_DIR="${2}"
+shift 2
+
+SYMBOLS_DIR="${STAGING_DIR}/usr/share/google-breakpad-symbols"
+rm -rf "${SYMBOLS_DIR}"
+mkdir -p "${SYMBOLS_DIR}"
+
+for FILE in $(eval ls "${TARGET_DIR}/${@}"); do
+	if [ -d "${FILE}" ]; then
+		printf "Error: '%s' is a directory\n" "${FILE}" >&2
+		exit 1
+	fi
+	if dump_syms "${FILE}" > "${SYMBOLS_DIR}/tmp.sym" 2>/dev/null; then
+		HASH=$(head -n1 "${SYMBOLS_DIR}/tmp.sym" | cut -d ' ' -f 4);
+		FILENAME=$(basename "$FILE");
+		mkdir -p "${SYMBOLS_DIR}/${FILENAME}/${HASH}"
+		mv "${SYMBOLS_DIR}/tmp.sym" "${SYMBOLS_DIR}/${FILENAME}/${HASH}/${FILENAME}.sym";
+	else
+		printf "Error dumping symbols for: '%s'\n" "${FILE}" >&2
+		exit 1
+	fi
+done
+rm -rf "${SYMBOLS_DIR}/tmp"
package/google-breakpad/google-breakpad.mk +8 -0
index bf857ba..8dea916 100644
@@ -14,5 +14,13 @@ GOOGLE_BREAKPAD_INSTALL_STAGING = YES
 GOOGLE_BREAKPAD_LICENSE = BSD-3c
 GOOGLE_BREAKPAD_LICENSE_FILES = LICENSE
 
+ifeq ($(BR2_PACKAGE_GOOGLE_BREAKPAD),y)
+define GOOGLE_BREAKPAD_EXTRACT_SYMBOLS
+	$(EXTRA_ENV) package/google-breakpad/gen-syms.sh $(STAGING_DIR) \
+		$(TARGET_DIR) $(call qstrip,$(BR2_GOOGLE_BREAKPAD_INCLUDE_FILES))
+endef
+TARGET_FINALIZE_HOOKS += GOOGLE_BREAKPAD_EXTRACT_SYMBOLS
+endif
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
Signature · 6 lines
1.9.3

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot