Re: 673015 (gprbuild: [hurd-i386] could not create $DIRECTORY/auto.cgpr)
On Wed, 2012-06-27 at 23:56 +0200, Ludovic Brenta wrote:
> Svante Signell <svante.signell@telia.com> writes:
...
> More seriously, I don't think you should investigate how an exception is
> raised, but rather what triggers it. I still think that gprconfig is
> trying to parse the output of grep and that this output is different on
> hurd-i386 than it is on all other architectures.
The exception is triggered by the Prefix being the non-numerical Default
string "@@", as far as I understand the code, as expected. And the
exception should return Compiler.Prefix_Index := -1; but segfaults
instead.
I've traced this problem with GDB to the following code in tracebak.c:
(see also http://paste.debian.net/176605/)
I think it could be a corrupt stack that causes the problem. Will try
with a dummy definition:
#ifndef VALID_STACK_FRAME
#define VALID_STACK_FRAME(ptr) 1
#endif
to see if it helps!
tracebak.c:
/*------------------------------- x86 ----------------------------------*/
#elif defined (i386)
#define IS_BAD_PTR(ptr) 0
#define PC_ADJUST -2
#define STOP_FRAME(CURRENT, TOP_STACK) \
(IS_BAD_PTR((long)(CURRENT)) \
|| IS_BAD_PTR((long)(CURRENT)->return_address) \
|| (CURRENT)->return_address == 0|| (CURRENT)->next == 0 \
|| (void *) (CURRENT) < (TOP_STACK))
#define VALID_STACK_FRAME(ptr) \
(!IS_BAD_PTR(ptr) \
&& (((*((ptr) - 3) & 0xff) == 0xe8) \
|| ((*((ptr) - 5) & 0xff) == 0x9a) \
|| ((*((ptr) - 1) & 0xff) == 0xff) \
|| (((*(ptr) & 0xd0ff) == 0xd0ff))))
Segfault here:
tracebak.c:
{
if (STOP_FRAME (current, top_stack) || <- HERE
!VALID_STACK_FRAME((char *)(current->return_address + PC_ADJUST)))
gdb session:
Program received signal SIGSEGV, Segmentation fault.
0x015074a9 in __gnat_backtrace (array=0x15a6350, size=50, exclude_min=0x1388df4,
exclude_max=0x138b079, skip_frames=<optimized out>) at tracebak.c:494
494 if (STOP_FRAME (current, top_stack) ||
(gdb) bt full
#0 0x015074a9 in __gnat_backtrace (array=0x15a6350, size=50, exclude_min=0x1388df4,
exclude_max=0x138b079, skip_frames=<optimized out>) at tracebak.c:494
current = 0x15a3a68
top_frame = 0x10234a8
top_stack = 0x10233ef
cnt = <optimized out>
#1 0x014f788e in system.traceback.call_chain (traceback=
(const system__address) 0x15a6350, max_len=50, exclude_min=
(const system__address) 0x1388df4, exclude_max=(const system__address) 0x138b079,
skip_frames=3) at s-traceb.adb:86
len = 1
Reply to: