Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Aug 2012 17:51:13 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        Luca Pizzamiglio <luca.pizzamiglio@gmail.com>
Cc:        Michael Scheidell <scheidell@FreeBSD.org>, freebsd-ports@FreeBSD.org
Subject:   Re: gdb75 dumps core on startup
Message-ID:  <503B8961.6070002@FreeBSD.org>
In-Reply-To: <503B87DE.6070209@FreeBSD.org>
References:  <503B7E3B.9010306@FreeBSD.org> <503B87DE.6070209@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
on 27/08/2012 17:44 Andriy Gapon said the following:
> 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.
> 

Oh, oops, I misread history a bit and I see now that amd64bsd-nat.h is included
upstream.  But since the upstream version doesn't have a prototype for
amd64bsd_target(), then files/patch-gdb-amd64-nat.h should be dropped.

-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?503B8961.6070002>