aboutsummaryrefslogtreecommitdiff
path: root/checkbuild.py
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-10-09 10:26:22 -0700
committerElliott Hughes <enh@google.com>2018-10-24 12:52:39 -0700
commitce5e58368200ebd0f5c27105104feffeb145bcff (patch)
treee18433e86c3feada6b1916a9f413d3c73995f3c9 /checkbuild.py
parentcacba32a53e9b96ecb2c84a211eca416729c5510 (diff)
downloadndk-ce5e58368200ebd0f5c27105104feffeb145bcff.tar.gz
ndk-stack: switch to python.
We've started to see cases (https://issuetracker.google.com/117306194) where addr2line chokes on DWARF information, so it's probably time to switch to llvm-symbolizer. While doing so, we may as well just switch to a small python script. This changes the output format, because the old format was significantly less useful. In addition to causing ridiculously long lines, it didn't handle inlining. This new script simply outputs whatever llvm-symbolizer has to say, on as many lines as llvm-symbolizer thinks are necessary to accurately represent the situation, rather than trying to parse and reformat it. This script also copies the `Abort message:` line, which is often the most useful line in the tombstone. Why not reuse the platform's `stack`? Because making that work and sharing the code seems like a lot of work for no immediate benefit: the NDK's needs seem a lot simpler, and the obvious improvements one could make to ndk-stack (automatically finding the symbols given an ndk-build/cmake project) aren't in the platform tool anyway. A python script as short as this hopefully encourages folks to roll their own better tools that fit in with however they keep track of their published builds. Example input: 10-24 19:19:57.714 5340 5340 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 10-24 19:19:57.714 5340 5340 F DEBUG : Build fingerprint: 'Android/hikey960/hikey960:Q/PI/enh10051658:userdebug/test-keys' 10-24 19:19:57.714 5340 5340 F DEBUG : Revision: '0' 10-24 19:19:57.714 5340 5340 F DEBUG : ABI: 'arm' 10-24 19:19:57.714 5340 5340 F DEBUG : pid: 5336, tid: 5336, name: crasher >>> crasher <<< 10-24 19:19:57.714 5340 5340 F DEBUG : signal 35 (<debuggerd signal>), code -1 (SI_QUEUE), fault addr -------- 10-24 19:19:57.715 5340 5340 F DEBUG : Abort message: 'attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0xe970400c' 10-24 19:19:57.715 5340 5340 F DEBUG : r0 00000000 r1 000014d8 r2 00000023 r3 ffa73890 10-24 19:19:57.715 5340 5340 F DEBUG : r4 000014d8 r5 ffa738a4 r6 e98efc70 r7 0000016b 10-24 19:19:57.715 5340 5340 F DEBUG : r8 ffa73688 r9 00000014 r10 000014d8 r11 00000000 10-24 19:19:57.715 5340 5340 F DEBUG : ip ffa73890 sp ffa73680 lr e9874737 pc e987474a 10-24 19:19:57.719 5340 5340 F DEBUG : 10-24 19:19:57.719 5340 5340 F DEBUG : backtrace: 10-24 19:19:57.719 5340 5340 F DEBUG : #00 pc 0002e74a /system/lib/libc.so (fdsan_error(char const*, ...)+266) 10-24 19:19:57.719 5340 5340 F DEBUG : #01 pc 0002e553 /system/lib/libc.so (android_fdsan_close_with_tag+386) 10-24 19:19:57.719 5340 5340 F DEBUG : #02 pc 0002ec37 /system/lib/libc.so (close+6) 10-24 19:19:57.719 5340 5340 F DEBUG : #03 pc 00001c93 /system/bin/crasher (do_action+786) 10-24 19:19:57.719 5340 5340 F DEBUG : #04 pc 00002a35 /system/bin/crasher (main+56) 10-24 19:19:57.719 5340 5340 F DEBUG : #05 pc 0009695d /system/lib/libc.so (__libc_init+60) 10-24 19:19:57.719 5340 5340 F DEBUG : #06 pc 0000180f /system/bin/crasher (_start_main+38) 10-24 19:19:57.719 5340 5340 F DEBUG : #07 pc 00000306 <anonymous:e9c56000> Example output: ********** Crash dump: ********** Build fingerprint: 'Android/hikey960/hikey960:Q/PI/enh10051658:userdebug/test-keys' Abort message: 'attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0xe970400c' #00 0x0002e74a /system/lib/libc.so (fdsan_error(char const*, ...)+266) fdsan_error(char const*, ...) bionic/libc/private/bionic_inline_raise.h:0:3 #01 0x0002e553 /system/lib/libc.so (android_fdsan_close_with_tag+386) android_fdsan_close_with_tag bionic/libc/bionic/fdsan.cpp:0:7 #02 0x0002ec37 /system/lib/libc.so (close+6) close bionic/libc/bionic/fdsan.cpp:381:12 #03 0x00001c93 /system/bin/crasher (do_action+786) #04 0x00002a35 /system/bin/crasher (main+56) #05 0x0009695d /system/lib/libc.so (__libc_init+60) __libc_init bionic/libc/bionic/libc_init_dynamic.cpp:136:8 #06 0x0000180f /system/bin/crasher (_start_main+38) #07 0x00000306 <anonymous:e9c56000> Bug: http://b/22085867 Test: ran manually Change-Id: I80b77f13c32a92adb972191b7b9548249e58b3ce
Diffstat (limited to 'checkbuild.py')
-rwxr-xr-xcheckbuild.py39
1 files changed, 26 insertions, 13 deletions
diff --git a/checkbuild.py b/checkbuild.py
index 2df8fc9e1..2ebdc4fdf 100755
--- a/checkbuild.py
+++ b/checkbuild.py
@@ -747,18 +747,6 @@ class NdkDepends(ndk.builds.InvokeExternalBuildModule):
install_exe(src, install_dir, self.name, self.host)
-class NdkStack(ndk.builds.InvokeExternalBuildModule):
- name = 'ndk-stack'
- path = 'prebuilt/{host}/bin'
- script = 'ndk/sources/host-tools/ndk-stack/build.py'
- notice = ndk.paths.ndk_path('sources/host-tools/ndk-stack/NOTICE')
-
- def install(self):
- src = os.path.join(self.out_dir, self.host, self.name)
- install_dir = self.get_install_path()
- install_exe(src, install_dir, self.name, self.host)
-
-
class GdbServer(ndk.builds.InvokeBuildModule):
name = 'gdbserver'
path = 'prebuilt/android-{arch}/gdbserver'
@@ -1982,6 +1970,31 @@ class NdkGdbShortcut(ndk.builds.ScriptShortcutModule):
windows_ext = '.cmd'
+class NdkStack(ndk.builds.MultiFileModule):
+ name = 'ndk-stack'
+ path = 'prebuilt/{host}/bin'
+ notice = ndk.paths.ndk_path('NOTICE')
+
+ @property
+ def files(self):
+ files = [
+ ndk.paths.ndk_path('ndk-stack'),
+ ndk.paths.ndk_path('ndk-stack.py'),
+ ]
+
+ if self.host.startswith('windows'):
+ files.append(ndk.paths.ndk_path('ndk-stack.cmd'))
+
+ return files
+
+
+class NdkStackShortcut(ndk.builds.ScriptShortcutModule):
+ name = 'ndk-stack-shortcut'
+ path = 'ndk-stack'
+ script = 'prebuilt/{host}/bin/ndk-stack'
+ windows_ext = '.cmd'
+
+
class NdkWhichShortcut(ndk.builds.ScriptShortcutModule):
name = 'ndk-which-shortcut'
path = 'ndk-which'
@@ -2000,7 +2013,7 @@ class NdkStackShortcut(ndk.builds.ScriptShortcutModule):
name = 'ndk-stack-shortcut'
path = 'ndk-stack'
script = 'prebuilt/{host}/bin/ndk-stack'
- windows_ext = '.exe'
+ windows_ext = '.cmd'
class NdkBuildShortcut(ndk.builds.ScriptShortcutModule):