Author: jhibbits
Date: Mon Jan 23 04:03:12 2017
New Revision: 312659
URL: https://svnweb.freebsd.org/changeset/base/312659

Log:
  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

Modified:
  head/sys/powerpc/powerpc/db_trace.c

Modified: head/sys/powerpc/powerpc/db_trace.c
==============================================================================
--- head/sys/powerpc/powerpc/db_trace.c Mon Jan 23 02:21:06 2017        
(r312658)
+++ head/sys/powerpc/powerpc/db_trace.c Mon Jan 23 04:03:12 2017        
(r312659)
@@ -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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to