Skip to content
This repository was archived by the owner on Dec 8, 2025. It is now read-only.

Commit 0a46a4b

Browse files
authored
gfauto: update signature_util.py (#1164)
* Fix PATTERN_ANDROID_BACKTRACE_CATCHALL to include hex address. * Add Mali error regex. * Add tests for the above.
1 parent 2421252 commit 0a46a4b

2 files changed

Lines changed: 59 additions & 1 deletion

File tree

gfauto/gfauto/signature_util.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@
6666
fr"\n{HEX_LIKE}+`{HEX_LIKE}+ {HEX_LIKE}+`{HEX_LIKE}+ (.*)"
6767
)
6868

69-
PATTERN_ANDROID_BACKTRACE_CATCHALL = re.compile(r"\n.*#00 pc " + HEX_LIKE + r"+ (.*)")
69+
# E.g.
70+
# 01-23 11:51:21.141 1814 1811 F DEBUG : #00 pc 00000000012313ec /vendor/lib64/egl/libGLES.so (BuildId: 123b5800abef5fc4b86c0032ddd223d5)
71+
PATTERN_ANDROID_BACKTRACE_CATCHALL = re.compile(fr"\n.*#00 pc ({HEX_LIKE}+ .*)")
7072

7173
# E.g. ERROR: temp/.../variant/shader.frag:549: 'variable indexing fragment shader output array' : not supported with this profile: es
7274
# variable indexing fragment shader output array <-- group 1
@@ -142,6 +144,8 @@
142144
r"is greater th[ae]n tolerance|Buffers have different values"
143145
)
144146

147+
PATTERN_MALI_ERROR = re.compile(r"E mali [\w.]+:(.*)")
148+
145149
BAD_IMAGE_SIGNATURE = "bad_image"
146150

147151

@@ -221,6 +225,18 @@ def get_signature_from_log_contents( # pylint: disable=too-many-return-statemen
221225
# noinspection PyUnusedLocal
222226
group: Optional[str]
223227

228+
# Mali error.
229+
# Find the last match.
230+
last_match = None
231+
for match in re.finditer(PATTERN_MALI_ERROR, log_contents):
232+
# Assign each time to avoid linter warning B007.
233+
last_match = match
234+
if last_match:
235+
group = "mali_" + last_match.group(1)
236+
group = clean_up(group, remove_numbers=False)
237+
group = reduce_length(group)
238+
return group
239+
224240
# LLVM FATAL ERROR (special override).
225241
group = basic_match(PATTERN_LLVM_FATAL_ERROR, log_contents)
226242
if group:

gfauto/gfautotests/test_signature_util.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,45 @@ def test_mesa_error_glsl_type_is_struct_or_ifc() -> None:
327327
"""
328328
signature = signature_util.get_signature_from_log_contents(log)
329329
assert signature == "glsl_type_is_struct_or_ifctype"
330+
331+
332+
def test_mali_error() -> None:
333+
log = """
334+
--------- beginning of kernel
335+
11-23 12:48:29.723 2507 2507 E mali 1e1000.mali: Unhandled Page fault
336+
11-23 12:48:29.723 0 0 W : [ C0] mali 1e1000.mali: error detected from slot 0, job status 0x00000004 (TERMINATED)
337+
11-23 12:48:29.724 321 321 E mali 1e1000.mali: t1xx: GPU fault 0x04 from job slot 0
338+
11-23 12:48:29.724 0 0 W : [ C0] mali 1e1000.mali: error detected from slot 0, job status 0x00000042 (JOB_READ_FAULT)
339+
11-23 12:48:29.724 321 321 E mali 1e1000.mali: t1xx: GPU fault 0x42 from job slot 0
340+
"""
341+
signature = signature_util.get_signature_from_log_contents(log)
342+
assert signature == "mali_t1xx_GPU_fault_0x42_from_job_slot_0"
343+
344+
345+
def test_android_hex_backtrace() -> None:
346+
log = """
347+
05-23 16:56:20.744 5884 5884 F DEBUG : backtrace:
348+
05-23 16:56:20.745 5884 5884 F DEBUG : NOTE: Function names and BuildId information is missing for some frames due
349+
05-23 16:56:20.745 5884 5884 F DEBUG : NOTE: to unreadable libraries. For unwinds of apps, only shared libraries
350+
05-23 16:56:20.745 5884 5884 F DEBUG : NOTE: found under the lib/ directory are readable.
351+
05-23 16:56:20.745 5884 5884 F DEBUG : NOTE: On this device, run setenforce 0 to make the libraries readable.
352+
05-23 16:56:20.745 5884 5884 F DEBUG : #00 pc 00000000018213fc /vendor/lib64/egl/libGLES_mali.so (BuildId: d4fb5800abef5fc4b86c0032cae223d5)
353+
05-23 16:56:20.745 5884 5884 F DEBUG : #01 pc 0000000001821584 /vendor/lib64/egl/libGLES_mali.so (BuildId: d4fb5800abef5fc4b86c0032cae223d5)
354+
05-23 16:56:20.745 5884 5884 F DEBUG : #02 pc 000000000182456c /vendor/lib64/egl/libGLES_mali.so (BuildId: d4fb5800abef5fc4b86c0032cae223d5)
355+
05-23 16:56:20.745 5884 5884 F DEBUG : #03 pc 0000000001821b2c /vendor/lib64/egl/libGLES_mali.so (BuildId: d4fb5800abef5fc4b86c0032cae223d5)
356+
05-23 16:56:20.745 5884 5884 F DEBUG : #04 pc 0000000000a08cac /vendor/lib64/egl/libGLES_mali.so (BuildId: d4fb5800abef5fc4b86c0032cae223d5)
357+
05-23 16:56:20.745 5884 5884 F DEBUG : #05 pc 00000000016d6ce0 /vendor/lib64/egl/libGLES_mali.so (BuildId: d4fb5800abef5fc4b86c0032cae223d5)
358+
05-23 16:56:20.746 5884 5884 F DEBUG : #06 pc 00000000007de018 /vendor/lib64/egl/libGLES_mali.so (BuildId: d4fb5800abef5fc4b86c0032cae223d5)
359+
05-23 16:56:20.746 5884 5884 F DEBUG : #07 pc 00000000007dcbc0 /vendor/lib64/egl/libGLES_mali.so (BuildId: d4fb5800abef5fc4b86c0032cae223d5)
360+
05-23 16:56:20.746 5884 5884 F DEBUG : #08 pc 00000000000fdb4c /data/local/tmp/amber_ndk
361+
05-23 16:56:20.746 5884 5884 F DEBUG : #09 pc 00000000000d0ca0 /data/local/tmp/amber_ndk
362+
05-23 16:56:20.746 5884 5884 F DEBUG : #10 pc 00000000000d1b5c /data/local/tmp/amber_ndk
363+
05-23 16:56:20.746 5884 5884 F DEBUG : #11 pc 00000000000cd8bc /data/local/tmp/amber_ndk
364+
05-23 16:56:20.746 5884 5884 F DEBUG : #12 pc 00000000000aedf0 /data/local/tmp/amber_ndk
365+
05-23 16:56:20.746 5884 5884 F DEBUG : #13 pc 00000000000aeb7c /data/local/tmp/amber_ndk
366+
05-23 16:56:20.746 5884 5884 F DEBUG : #14 pc 0000000000083554 /data/local/tmp/amber_ndk
367+
05-23 16:56:20.746 5884 5884 F DEBUG : #15 pc 0000000000083464 /data/local/tmp/amber_ndk
368+
05-23 16:56:20.746 5884 5884 F DEBUG : #16 pc 00000000000765a8 /data/local/tmp/amber_ndk
369+
"""
370+
signature = signature_util.get_signature_from_log_contents(log)
371+
assert signature == "00000000018213fc_egllibGLES_maliso"

0 commit comments

Comments
 (0)