mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-20 03:30:36 +02:00
util: Force emission of stack frame in stack unit test
The `capture_not_overwritten` unit test captures and compares two backtraces -- one from inside a call to `func_c` and one outside -- and confirms that they are not identical. That is, that `func_c` is in the backtrace. On 32-bit x86, without `-fno-omit-frame-pointer`, the function will not emit a stack frame. As a result, the unit test fails. The fix is to compile `func_c` with the flag `-fno-omit-frame-pointer` to prevent the compiler from optimizing out the stack frame which is otherwise unneeded. Bug: https://bugs.gentoo.org/823774 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4091 Fixes:d0d14f3f64("util: Add unit test for stack backtrace caputure") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30622> (cherry picked from commit05dc4eb536)
This commit is contained in:
parent
5f2c486ccb
commit
d2da512f21
2 changed files with 3 additions and 2 deletions
|
|
@ -634,7 +634,7 @@
|
|||
"description": "util: Force emission of stack frame in stack unit test",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "d0d14f3f6481e015b4413fa0487164b76fe45296",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ func_b(void)
|
|||
debug_backtrace_dump(backtrace, 16);
|
||||
}
|
||||
|
||||
static void ATTRIBUTE_NOINLINE
|
||||
/* This function must emit a stack frame for the unit test to work */
|
||||
static void ATTRIBUTE_NOINLINE ATTRIBUTE_OPTIMIZE("no-omit-frame-pointer")
|
||||
func_c(struct debug_stack_frame *frames)
|
||||
{
|
||||
debug_backtrace_capture(frames, 0, 16);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue