[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: maxima: debugging unaligned access

Thanks!  OK, it is in libc sigsetjmp:

(gdb) b *0x200000000051de70
Breakpoint 2 at 0x200000000051de70: file ../sysdeps/unix/sysv/linux/ia64/setjmp.S, line 109.
(gdb) c

Breakpoint 2, __sigsetjmp () at ../sysdeps/unix/sysv/linux/ia64/setjmp.S:109
109	../sysdeps/unix/sysv/linux/ia64/setjmp.S: No such file or directory.
	in ../sysdeps/unix/sysv/linux/ia64/setjmp.S
Current language:  auto
The current source language is "auto; currently asm".

The address does appear reproducible, as I get the same unaligned
access warning on subsequent runs from the shell.

Under gdb, as before noted, there is no unaligned access warning, but
a failure associated with a piece of code doing setjmp and longjmp.

 {frame_ptr fr;
 if(fr==((void *)0)) FEerror("The tag ~s is undefined.",1,((object)(VVi)[107]));
 base[16]= ((object)&Ct_body);
 goto T409;

On the first iteration, all goes well, then the "unwind" call calls a
longjmp, which escapes to the following setjmp earlier in the code:

 do { frame_ptr _frs_top = frs_top +1; if (_frs_top >= frs_limit) frs_overflow(); _frs_top->frs_lex = lex_env; _frs_top->frs_bds_top = bds_top; _frs_top->frs_class = (FRS_CATCH); _frs_top->frs_in_signal_handler = in_signal_handler; _frs_top->frs_val = (((object)(VVi)[107])); _frs_top->frs_ihs = ihs_top; frs_top=_frs_top; _setjmp (_frs_top->frs_jmpbuf); } while (0);

when the frs_sch_catch is run again, it cannot find the frame on a
global stack and triggers the undefined error.

This code works at -O0, and fails under -O2.  It is compiled with
-Wall and contains volatile declarations as necessary so there are no
gcc "clobbering" warnings.  And this code has worked for years on ia64

Here is a disassembly in the sigsetjmp routine:

(gdb) disassemble 0x200000000051de70
Dump of assembler code for function __sigsetjmp:
0x200000000051de20 <__sigsetjmp+0>:	[MMI]       alloc r35=ar.pfs,9,7,0
0x200000000051de21 <__sigsetjmp+1>:	            mov.m r36=ar.unat
0x200000000051de22 <__sigsetjmp+2>:	            nop.i 0x0;;
0x200000000051de30 <__sigsetjmp+16>:	[MII]       mov.m r17=ar.fpsr
0x200000000051de31 <__sigsetjmp+17>:	            mov r2=r32
0x200000000051de32 <__sigsetjmp+18>:	            adds r3=8,r32;;
0x200000000051de40 <__sigsetjmp+32>:	[MMI]       st8.spill.nta [r2]=r12,16
0x200000000051de41 <__sigsetjmp+33>:	            st8.spill.nta [r3]=r1,16
0x200000000051de42 <__sigsetjmp+34>:	            nop.i 0x0;;
0x200000000051de50 <__sigsetjmp+48>:	[MMI]       st8.nta [r2]=r36,16
0x200000000051de51 <__sigsetjmp+49>:	            st8.nta [r3]=r17,16
0x200000000051de52 <__sigsetjmp+50>:	            adds r8=160,r32;;
0x200000000051de60 <__sigsetjmp+64>:	[MMI]       st8.spill.nta [r2]=r4,16
0x200000000051de61 <__sigsetjmp+65>:	            st8.spill.nta [r3]=r5,16
0x200000000051de62 <__sigsetjmp+66>:	            adds r9=176,r32;;
0x200000000051de70 <__sigsetjmp+80>:	[MMI]       stf.spill.nta [r8]=f2,32
0x200000000051de71 <__sigsetjmp+81>:	            stf.spill.nta [r9]=f3,32
0x200000000051de72 <__sigsetjmp+82>:	            mov r34=b0;;
0x200000000051de80 <__sigsetjmp+96>:	[MMI]       stf.spill.nta [r8]=f4,32
0x200000000051de81 <__sigsetjmp+97>:	            stf.spill.nta [r9]=f5,32
0x200000000051de82 <__sigsetjmp+98>:	            mov r17=b1;;
0x200000000051de90 <__sigsetjmp+112>:	[MMI]       stf.spill.nta [r8]=f16,32

If I try breaking at the address gdb does not progress on "continue":

b *0x200000000051de70
Note: breakpoint 2 (disabled) also set at pc 0x200000000051de70.
Breakpoint 4 at 0x200000000051de70: file ../sysdeps/unix/sysv/linux/ia64/setjmp.S, line 109.
(gdb) c

Breakpoint 4, __sigsetjmp () at ../sysdeps/unix/sysv/linux/ia64/setjmp.S:109
109	../sysdeps/unix/sysv/linux/ia64/setjmp.S: No such file or directory.
	in ../sysdeps/unix/sysv/linux/ia64/setjmp.S
Current language:  auto
The current source language is "auto; currently asm".

Breakpoint 4, __sigsetjmp () at ../sysdeps/unix/sysv/linux/ia64/setjmp.S:109
109	in ../sysdeps/unix/sysv/linux/ia64/setjmp.S

Breakpoint 4, __sigsetjmp () at ../sysdeps/unix/sysv/linux/ia64/setjmp.S:109
109	in ../sysdeps/unix/sysv/linux/ia64/setjmp.S

Breakpoint 4, __sigsetjmp () at ../sysdeps/unix/sysv/linux/ia64/setjmp.S:109
109	in ../sysdeps/unix/sysv/linux/ia64/setjmp.S


Suggestions?  I'm going to try gcc-4.3, but I cannot seem to get gdb
to isolate this further.

Separately -- do you perchance know of a reference for ia64 object
code relocation?

Take care,

>> On 1/26/10 3:43 PM, Camm Maguire wrote:
>>    Greetings, and thanks!
>>    Breakpoint 2 at 0x200000000051de70
>>    (gdb) r -eval '(run)'
>>    Starting program: /home/camm/maxima-5.20.1/src/binary-gcl/maxima -eval '(run)'
>>    Warning:
>>    Cannot insert breakpoint 2.
>>    Error accessing memory address 0x200000000051de70: Input/output error.
>>    (gdb)
>>    ???
>>Do "start" first, then insert the breakpoint. You may also need to make sure the program loads at the same execution address each time. I think some distros randomize it for security.

Reply to: