Avoid using non-zero argument for __builtin_frame_address().

Building kernel with devel/powerpc64-gcc (6.2.0) yields the following error:
/usr/src/sys/powerpc/powerpc/db_trace.c:299:20: error: calling
'__builtin_frame_address' with a nonzero argument is unsafe
[-Werror=frame-address]

Work around this by dereferencing the frame address manually instead.

PR:		215600
Reported by:	Mark Millard <markmi AT dsl-only DOT net>
MFC after:	2 weeks
This commit is contained in:
jhibbits 2017-01-23 04:03:12 +00:00
parent 8632319c4b
commit 0aa520541e

View File

@ -296,8 +296,12 @@ db_trace_self(void)
{
db_addr_t addr;
addr = (db_addr_t)__builtin_frame_address(1);
db_backtrace(curthread, addr, -1);
addr = (db_addr_t)__builtin_frame_address(0);
if (addr == 0) {
db_printf("Null frame address\n");
return;
}
db_backtrace(curthread, *(db_addr_t *)addr, -1);
}
int