gdb75 dumps core on startup

Andriy Gapon avg at FreeBSD.org
Mon Aug 27 14:44:51 UTC 2012


on 27/08/2012 17:03 Andriy Gapon said the following:
> Program terminated with signal 11, Segmentation fault
> ...
> #0  0x00000000004777e2 in i386_use_watchpoints ()
> #1  0x0000000000476bbd in _initialize_amd64fbsd_nat ()
> #2  0x000000000060deea in initialize_all_files ()
> #3  0x00000000005e710f in gdb_init ()
> #4  0x0000000000549086 in relocate_gdb_directory ()
> #5  0x0000000000547aa4 in catch_errors ()
> #6  0x0000000000548bb4 in gdb_main ()
> #7  0x0000000000457ea9 in main ()
> 
> This is on amd64 head.
> 

The problem seems to be caused by files/patch-gdb-amd64-nat.h, which for some
cryptic reason removes prototype of amd64bsd_target() from amd64-nat.h.  That
allows the code to be compilable still (sloppy gdb developers!) but the assumed
return type of the function becomes int instead of a pointer which it really is.
Thus, the returned pointer value gets truncated on amd64 and as a result an
invalid pointer is passed to i386_use_watchpoints() from _initialize_amd64fbsd_nat().

Oh, looking at the patch in PR ports/165357
(http://www.freebsd.org/cgi/query-pr.cgi?pr=165357), it seems that
amd64bsd_target() should have re-appeared in a new header file "amd64bsd-nat.h"...
 But that part of the patch seems to be incorrect in that it would create
files/amd64bsd-nat.h instead of a patch file to create amd64bsd-nat.h in the
source directory.  Apparently this file never made it as a result.

-- 
Andriy Gapon


More information about the freebsd-ports mailing list