aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Markus <daniel.markus@leica-geosystems.com>2015-03-12 14:34:49 +0100
committerMartin Jansa <Martin.Jansa@gmail.com>2015-03-21 16:42:23 +0100
commitba72b88a4147ae2d050aa0a8d452a07e09330e33 (patch)
tree0832814d4d58628d4c17100ad205976e2789ad69
parent01bd032f2f55bcfaed5f4ff66a68fba97e30243f (diff)
downloadmeta-openembedded-ba72b88a4147ae2d050aa0a8d452a07e09330e33.tar.gz
socorro-syms: Add directory arrangement needed by minidump_stackwalk
http://code.google.com/p/google-breakpad/wiki/LinuxStarterGuide When extracting a stack trace out of a Breakpad minidump, the application minidump_stackwalk is used. This application needs all symbol files to be arranged in a particular directory structure in order to match the correct symbol file with the version of the crashed program in question. A directory structure is created in accordance with minidump_stackwalk. The structure contains the name of the application binary and a hash value where the hash corresponds to the binary the symbol file was produced from. The symbol file is moved to the hash directory allowing multiple versions of the same symbol file. Signed-off-by: Daniel Markus <daniel.markus@leica-geosystems.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r--meta-oe/classes/socorro-syms.bbclass50
1 files changed, 49 insertions, 1 deletions
diff --git a/meta-oe/classes/socorro-syms.bbclass b/meta-oe/classes/socorro-syms.bbclass
index 766a9e6272..c2729527d6 100644
--- a/meta-oe/classes/socorro-syms.bbclass
+++ b/meta-oe/classes/socorro-syms.bbclass
@@ -42,6 +42,16 @@ python symbol_file_preprocess() {
breakpad_sym_file_path = os.path.join(breakpad_syms_dir, sym_file_name)
socorro_sym_file_path = os.path.join(socorro_syms_dir, sym_file_name)
+ create_socorro_sym_file(breakpad_sym_file_path, socorro_sym_file_path)
+
+ arrange_socorro_sym_file(socorro_sym_file_path, socorro_syms_dir)
+
+ return
+}
+
+
+def create_socorro_sym_file(breakpad_sym_file_path, socorro_sym_file_path):
+
# In the symbol file, all source files are referenced like the following.
# FILE 123 /path/to/some/File.cpp
# Go through all references and replace the file paths with repository
@@ -56,7 +66,6 @@ python symbol_file_preprocess() {
socorro_sym_file.write(line)
return
-}
def socorro_file_reference(line):
@@ -162,3 +171,42 @@ def git_repository_path(source_file_path):
return socorro_reference
+
+def arrange_socorro_sym_file(socorro_sym_file_path, socorro_syms_dir):
+
+ import re
+
+ # Breakpad's minidump_stackwalk needs a certain directory structure in order
+ # to find correct symbols when extracting a stack trace out of a minidump.
+ # The directory structure must look like the following.
+ # YourBinary/<hash>/YourBinary.sym
+ # YourLibrary.so/<hash>/YourLibrary.so.sym
+ # To be able to create such structure we need to extract the hash value that
+ # is found in each symbol file. The header of the symbol file looks
+ # something like this:
+ # MODULE Linux x86 A079E473106CE51C74C1C25AF536CCD30 YourBinary
+ # See
+ # http://code.google.com/p/google-breakpad/wiki/LinuxStarterGuide
+
+ # Create the directory with the same name as the binary.
+ binary_dir = re.sub("\.sym$", "", socorro_sym_file_path)
+ if not os.path.exists(binary_dir):
+ os.makedirs(binary_dir)
+
+ # Get the hash from the header of the symbol file.
+ with open(socorro_sym_file_path, 'r') as socorro_sym_file:
+
+ # The hash is the 4th argument of the first line.
+ sym_file_hash = socorro_sym_file.readline().split()[3]
+
+ # Create the hash directory.
+ hash_dir = os.path.join(binary_dir, sym_file_hash)
+ if not os.path.exists(hash_dir):
+ os.makedirs(hash_dir)
+
+ # Move the symbol file to the hash directory.
+ sym_file_name = os.path.basename(socorro_sym_file_path)
+ os.rename(socorro_sym_file_path, os.path.join(hash_dir, sym_file_name))
+
+ return
+