As I wrote you in my previous e-mail we are running the testsuite (p/test) of gpc-20050331 based on gcc-3.4.3 under the "x86_64_unknown-linux-gnu" platform, so we are using gpc-20050331 and gcc-3.4.3. Anyway, as you can see in the previous message we have isolated the trap problem, compiling and running the traptest modules alone in order to avoid noise by other test cases. Anyway we won't change the trapc.c or trap.pas source code because such modules are contained in the GPC distribution kit , so we think that this task is of only relevance of the pascal development team.
I was not clear enough in the previous message: the `traptest.pas' test runs fine on my AMD64 Mandrake 9.2. So, the problem is still not "isolated", I am trying to find out why your machine works differently.
Also, since I can not reproduce the problem I am dependent on information that you provide.
As I wrote, my guess is that the failure is due to the stack protection (Mandrake 9.2 uses no stack protection, newer distributions may add it). ATM you have not provided enough detail to verify this.
If it can help you better, here, below, you find a full stack status report.
(gdb) run Starting program: /dkalvn46_1/grfdev/ags/gnu/gpc-20050331/p/test/traptest.exe
Program received signal SIGSEGV, Segmentation fault. $0000007fbffff010 in ?? ()
Could you verify that the trampoline code got correctly planted on the stack, using `disassemble 0x7fbffff010 7fbffff030'. You should get something like
Dump of assembler code from 0x7fbfffeef0 to 0x7fbfffef10: 0x0000007fbfffeef0: mov $0x402b40,%r11d 0x0000007fbfffeef6: mov $0x7fbffff730,%r10 0x0000007fbfffef00: jmpq *%r11 0x0000007fbfffef03: add %al,(%rax)
(that is dump from my machine, on your machine addreses will differ.
Also `info registers' can show if the code is really on the stack.
If the problem is caused by executable stack the patch below should work aroud the problem:
--- p/units/trap.pas.orig 2005-05-16 19:38:59.460127184 +0200 +++ p/units/trap.pas 2005-05-16 19:50:40.088615464 +0200 @@ -140,6 +140,18 @@ end end;
+{$ifndef NEW_TRAP} +var + TrapP: ^procedure (Trapped: Boolean) = nil; + +procedure DoCall (Trapped: Boolean); +begin + AtExit (TrapExit); + TrapP^ (Trapped) + end; +{$endif} + + procedure TrapExec (procedure p (Trapped: Boolean)); var SavedTrappedExitCode: Integer { @@ } = 0; @@ -157,12 +169,8 @@ goto TrapLabel end; {$else} + SavedTrapP: ^procedure (Trapped: Boolean) = nil;
- procedure DoCall (Trapped: Boolean); - begin - AtExit (TrapExit); - p (Trapped) - end; {$endif}
begin @@ -179,7 +187,10 @@ p (Trapped); TrapJump := SavedTrapJump; {$else} + SavedTrapP := TrapP; + TrapP := @p; DoSetJmp (DoCall); + TrapP := SavedTrapP; {$endif} Dec (TrapCount); if TrappedErrorAddr = nil then