|
1 | | -# Copyright (c) 2023, Oracle and/or its affiliates. |
| 1 | +# Copyright (c) 2024, Oracle and/or its affiliates. |
2 | 2 | # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ |
3 | 3 | import drgn |
4 | | -import pytest |
| 4 | +from drgn.helpers.linux import cpu_curr |
5 | 5 |
|
6 | 6 | from drgn_tools import bt |
7 | 7 |
|
8 | 8 |
|
9 | | -@pytest.mark.skip_vmcore("*-uek4") |
10 | | -def test_bt_smoke(prog, request, debuginfo_type): |
| 9 | +def test_bt_smoke(prog): |
11 | 10 | if prog.flags & drgn.ProgramFlags.IS_LIVE: |
12 | 11 | thread = prog.thread(1) |
13 | 12 | else: |
14 | | - thread = prog.crashed_thread() |
| 13 | + try: |
| 14 | + thread = prog.crashed_thread() |
| 15 | + except Exception: |
| 16 | + # On x86_64 uek4, the sysrq does not actually trigger a panic, it |
| 17 | + # triggers a NULL pointer dereference, which triggers an "oops", and |
| 18 | + # that directly calls into the kexec code without ever calling |
| 19 | + # panic(). Thus, panic_cpu == -1, and prog.crashing_cpu() page |
| 20 | + # faults because it tries to index the wrong per-cpu variables. |
| 21 | + # To handle this, use the x86_64-specific "crashing_cpu" variable. |
| 22 | + # Note that on some drgn versions we get "FaultError", others we get |
| 23 | + # "Exception". So we just catch Exception here. |
| 24 | + pid = cpu_curr(prog, prog["crashing_cpu"]).pid.value_() |
| 25 | + thread = prog.thread(pid) |
15 | 26 |
|
16 | 27 | print("===== STACK TRACE [show_vars=False] =====") |
17 | 28 | bt.bt(thread, show_vars=False) |
|
0 commit comments