Commit b07071f6 authored by James Darpinian's avatar James Darpinian Committed by Commit Bot

Make stack trace regexes independent of pointer width

We don't need to know the width of pointers ahead of time to make our
stack trace regexes. They can simply accept both pointer widths. This
removes the need to specify or detect the architecture in some cases.

Change-Id: Ib0222635ac1c6953ed0cb0dbec10ecd8af63317f
Reviewed-on: https://chromium-review.googlesource.com/c/1410272Reviewed-by: default avataragrieve <agrieve@chromium.org>
Reviewed-by: default avatarMatthew Cary <mattcary@chromium.org>
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622967}
parent 89923f30
......@@ -46,3 +46,5 @@ Speedup symbolization by avoiding unnecessary APK manifest extraction loops.
Changed the symbolizer to act in a passthrough mode when reading from stdin, so
adb logcat can be piped through it to symbolize on the fly.
Made the symbolizer agnostic to the width of pointers.
\ No newline at end of file
......@@ -52,8 +52,6 @@ _DALVIK_JNI_THREAD_LINE = re.compile("(\".*\" prio=[0-9]+ tid=[0-9]+ NATIVE.*)")
_DALVIK_NATIVE_THREAD_LINE = re.compile("(\".*\" sysTid=[0-9]+ nice=[0-9]+.*)")
_JAVA_STDERR_LINE = re.compile("([0-9]+)\s+[0-9]+\s+.\s+System.err:\s*(.+)")
_WIDTH = '{8}'
# Matches LOG(FATAL) lines, like the following example:
# [FATAL:source_file.cc(33)] Check failed: !instances_.empty()
_LOG_FATAL_LINE = re.compile('(\[FATAL\:.*\].*)$')
......@@ -72,17 +70,14 @@ _LOG_FATAL_LINE = re.compile('(\[FATAL\:.*\].*)$')
_TRACE_LINE = re.compile('(.*)\#(?P<frame>[0-9]+)[ \t]+(..)[ \t]+(0x)?(?P<address>[0-9a-f]{0,16})[ \t]+(?P<lib>[^\r\n \t]*)(?P<symbol_present> \((?P<symbol_name>.*)\))?') # pylint: disable-msg=C6310
def InitWidthRelatedLineMatchers():
global _WIDTH
global _DEBUG_TRACE_LINE, _VALUE_LINE, _CODE_LINE
if symbol.ARCH == 'arm64' or symbol.ARCH == 'x86_64' or symbol.ARCH == 'x64':
_WIDTH = '{16}'
# Matches lines emitted by src/base/debug/stack_trace_android.cc, like:
# #00 0x7324d92d /data/app-lib/org.chromium.native_test-1/libbase.cr.so+0x0006992d
# This pattern includes the unused named capture groups <symbol_present> and
# <symbol_name> so that it can interoperate with the |_TRACE_LINE| regex.
_DEBUG_TRACE_LINE = re.compile(
'(.*)(?P<frame>\#[0-9]+ 0x[0-9a-f]' + _WIDTH + ') '
'(?P<lib>[^+]+)\+0x(?P<address>[0-9a-f]' + _WIDTH + ')'
'(.*)(?P<frame>\#[0-9]+ 0x[0-9a-f]{8,16}) '
'(?P<lib>[^+]+)\+0x(?P<address>[0-9a-f]{8,16})'
'(?P<symbol_present>)(?P<symbol_name>)')
# Examples of matched value lines include:
......@@ -90,7 +85,7 @@ def InitWidthRelatedLineMatchers():
# bea4170c 8018e4e9 /data/data/com.my.project/lib/libmyproject.so (symbol)
# 03-25 00:51:05.530 I/DEBUG ( 65): bea4170c 8018e4e9 /data/data/com.my.project/lib/libmyproject.so
# Again, note the spacing differences.
_VALUE_LINE = re.compile('(.*)([0-9a-f]' + _WIDTH + ')[ \t]+([0-9a-f]' + _WIDTH + ')[ \t]+([^\r\n \t]*)( \((.*)\))?')
_VALUE_LINE = re.compile('(.*)([0-9a-f]{8,16})[ \t]+([0-9a-f]{8,16})[ \t]+([^\r\n \t]*)( \((.*)\))?')
# Lines from 'code around' sections of the output will be matched before
# value lines because otheriwse the 'code around' sections will be confused as
# value lines.
......@@ -98,9 +93,9 @@ def InitWidthRelatedLineMatchers():
# Examples include:
# 801cf40c ffffc4cc 00b2f2c5 00b2f1c7 00c1e1a8
# 03-25 00:51:05.530 I/DEBUG ( 65): 801cf40c ffffc4cc 00b2f2c5 00b2f1c7 00c1e1a8
_CODE_LINE = re.compile('(.*)[ \t]*[a-f0-9]' + _WIDTH + '[ \t]*[a-f0-9]' + _WIDTH +
'[ \t]*[a-f0-9]' + _WIDTH + '[ \t]*[a-f0-9]' + _WIDTH +
'[ \t]*[a-f0-9]' + _WIDTH + '[ \t]*[ \r\n]') # pylint: disable-msg=C6310
_CODE_LINE = re.compile('(.*)[ \t]*[a-f0-9]{8,16}[ \t]*[a-f0-9]{8,16}' +
'[ \t]*[a-f0-9]{8,16}[ \t]*[a-f0-9]{8,16}' +
'[ \t]*[a-f0-9]{8,16}[ \t]*[ \r\n]') # pylint: disable-msg=C6310
# This pattern is used to find shared library offset in APK.
# Example:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment