Mark Wielaard 7a3daa
commit 78df22afc540c6c34003c3cb8ecc3ee686fbef76
Mark Wielaard 7a3daa
Author: Mark Wielaard <mark@klomp.org>
Mark Wielaard 7a3daa
Date:   Wed Jun 28 13:25:12 2017 +0200
Mark Wielaard 7a3daa
Mark Wielaard 7a3daa
    find-debuginfo.sh: Filter out all <built-in> like fake file names.
Mark Wielaard 7a3daa
    
Mark Wielaard 7a3daa
    There is no official way to mark an instruction range as being not
Mark Wielaard 7a3daa
    part of some actual source code, but as part of a compiler built-in
Mark Wielaard 7a3daa
    construct in DWARF. So different compilers have come up with fake
Mark Wielaard 7a3daa
    source file names like <built-in> or <__thread_local_inner macros>.
Mark Wielaard 7a3daa
    We already filtered out the strings "<internal>" and "<built-in>".
Mark Wielaard 7a3daa
    Just filter out all '(^|/)<[a-z _-]+>$'. They are fake files!
Mark Wielaard 7a3daa
    
Mark Wielaard 7a3daa
    This is mainly to appease the rustc compiler which generates lots of
Mark Wielaard 7a3daa
    different variants to encode some instruction sequence is part of an
Mark Wielaard 7a3daa
    compiler generated macro expansion.
Mark Wielaard 7a3daa
    
Mark Wielaard 7a3daa
    Signed-off-by: Mark Wielaard <mark@klomp.org>
Mark Wielaard 7a3daa
Mark Wielaard 7a3daa
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
Mark Wielaard 7a3daa
index 0233d92..555e7b8 100755
Mark Wielaard 7a3daa
--- a/scripts/find-debuginfo.sh
Mark Wielaard 7a3daa
+++ b/scripts/find-debuginfo.sh
Mark Wielaard 7a3daa
@@ -502,7 +502,11 @@ if [ -s "$SOURCEFILE" ]; then
Mark Wielaard 7a3daa
   fi
Mark Wielaard 7a3daa
 
Mark Wielaard 7a3daa
   mkdir -p "${RPM_BUILD_ROOT}${debug_dest_name}"
Mark Wielaard 7a3daa
-  LC_ALL=C sort -z -u "$SOURCEFILE" | grep -E -v -z '(<internal>|<built-in>)$' |
Mark Wielaard 7a3daa
+  # Filter out anything compiler generated which isn't a source file.
Mark Wielaard 7a3daa
+  # e.g. <internal>, <built-in>, <__thread_local_inner macros>.
Mark Wielaard 7a3daa
+  # Some compilers generate them as if they are part of the working
Mark Wielaard 7a3daa
+  # directory (which is why we match against ^ or /).
Mark Wielaard 7a3daa
+  LC_ALL=C sort -z -u "$SOURCEFILE" | grep -E -v -z '(^|/)<[a-z _-]+>$' |
Mark Wielaard 7a3daa
   (cd "${debug_base_name}"; cpio -pd0mL "${RPM_BUILD_ROOT}${debug_dest_name}")
Mark Wielaard 7a3daa
   # stupid cpio creates new directories in mode 0700,
Mark Wielaard 7a3daa
   # and non-standard modes may be inherented from original directories, fixup