Message-Id: <4.2.0.58.19991126181032.00a65c40@hal.nt.tuwien.ac.at> X-Sender: tony AT dictator DOT nt DOT tuwien DOT ac DOT at X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58 Date: Fri, 26 Nov 1999 18:35:13 +0100 To: djgpp AT delorie DOT com From: Anton Helm Subject: Re: Problems with DJGPP lib and grx23 In-Reply-To: <199911241840.TAA05908@acp3bf.physik.rwth-aachen.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk At 07:40 PM 11/24/99 +0100, you wrote: >In article <4 DOT 2 DOT 0 DOT 58 DOT 19991124161000 DOT 00a11cb0 AT hal DOT nt DOT tuwien DOT ac DOT at> you wrote: >> At 01:00 PM 11/24/99 +0100, you wrote: >> Main problem with debugging is that this is a graphic application >> and the problem is related to displaying a mouse cursor. >E.g.: what happens if you use just that one .o module containing the >problematic assembly function from the existing, known-working 2.8.1 >compilation of GRX, and all the rest from the 2.95 one. Just to make >sure it's really *this* function that actually causes the problem, >that is. 1) extracted the shiftscn.o from the 2.8.1 compiled library and replaced it with the 2.95 compiled version. -> crash (as expected) 2) replaced shiftscn.o in the 2.95 compiled library with the one extracted from the 2.8.1 compiled library. -> now the new library works (as expected) disassembled the 2.8.1 compiled objectfile and tried to compare it with the assembly code of the 2.95 compiled file. Well, if you know what you are looking for, you probably find it. I don't. Program crashes at _GR_shift_scanline+99 while running the first inline asm part. This is somewhat mysterious as 99 is definitely out of this inline asm part. (See the second asm file attached below.) So the bug is probably related to embedding the inline asm into the rest. >It's hard, but manageable, if you have some 'trick hardware': you need >a secondary mono graphics card (a 'Hercules card', something which >went out of fashion at least 8 years ago :-) and a second, monochrome >screen attached to it, so you can run gdb on the mono screen, and the >graphical program on the other. If gdb doesn't want to work in that >configuration, try rhgdb, fsdb or, last chance, edebug32, the mother >of all DJGPP debuggers. I have no 2nd video card. I've tried fsdb and got a crash (of fsdb) when the program switched into graphic mode. So that doesn't help much. Back to gdb ... gdb (4.18) tells me (by stepi) that it is running the first inline asm part when the crash happens (SIGSEGV). Here are asm files, first the 2.8.1 compiled : shiftscl.o: file format coff-go32 Disassembly of section .text: 00000000 <__GR_shift_scanline>: 0: 83 ec 0c subl $0xc,%esp 3: 55 pushl %ebp 4: 57 pushl %edi 5: 56 pushl %esi 6: 53 pushl %ebx 7: 8b 6c 24 2c movl 0x2c(%esp,1),%ebp b: 85 ed testl %ebp,%ebp d: 7f 75 jg 84 <__GR_shift_scanline+84> f: f7 dd negl %ebp 11: c7 44 24 14 00 movl $0x0,0x14(%esp,1) 16: 00 00 00 19: 8b 54 24 30 movl 0x30(%esp,1),%edx 1d: 39 54 24 14 cmpl %edx,0x14(%esp,1) 21: 0f 8d c6 00 00 jge ed <__GR_shift_scanline+ed> 26: 00 27: 90 nop 28: 8b 5c 24 28 movl 0x28(%esp,1),%ebx 2c: 8b 4c 24 24 movl 0x24(%esp,1),%ecx 30: 03 19 addl (%ecx),%ebx 32: 83 c1 04 addl $0x4,%ecx 35: 89 4c 24 24 movl %ecx,0x24(%esp,1) 39: 8b 7c 24 28 movl 0x28(%esp,1),%edi 3d: 8b 74 24 20 movl 0x20(%esp,1),%esi 41: 03 3e addl (%esi),%edi 43: 89 7c 24 10 movl %edi,0x10(%esp,1) 47: 83 c6 04 addl $0x4,%esi 4a: 89 74 24 20 movl %esi,0x20(%esp,1) 4e: 89 de movl %ebx,%esi 50: 8b 54 24 28 movl 0x28(%esp,1),%edx 54: 89 e9 movl %ebp,%ecx 56: 8a 2e movb (%esi),%ch 58: eb 06 jmp 60 <__GR_shift_scanline+60> 5a: 8d b6 00 00 00 leal 0x0(%esi),%esi 5f: 00 60: 4e decl %esi 61: 88 e8 movb %ch,%al 63: 8a 26 movb (%esi),%ah 65: 88 e5 movb %ah,%ch 67: d3 e8 shrl %cl,%eax 69: 88 07 movb %al,(%edi) 6b: 4f decl %edi 6c: 4a decl %edx 6d: 75 f1 jne 60 <__GR_shift_scanline+60> 6f: d2 ed shrb %cl,%ch 71: 88 2f movb %ch,(%edi) 73: ff 44 24 14 incl 0x14(%esp,1) 77: 8b 4c 24 30 movl 0x30(%esp,1),%ecx 7b: 39 4c 24 14 cmpl %ecx,0x14(%esp,1) 7f: 7c a7 jl 28 <__GR_shift_scanline+28> 81: eb 6a jmp ed <__GR_shift_scanline+ed> 83: 90 nop 84: b8 08 00 00 00 movl $0x8,%eax 89: 29 e8 subl %ebp,%eax 8b: 89 c5 movl %eax,%ebp 8d: c7 44 24 14 00 movl $0x0,0x14(%esp,1) 92: 00 00 00 95: 8b 74 24 30 movl 0x30(%esp,1),%esi 99: 39 74 24 14 cmpl %esi,0x14(%esp,1) 9d: 7d 4e jnl ed <__GR_shift_scanline+ed> 9f: 90 nop a0: 8b 7c 24 24 movl 0x24(%esp,1),%edi a4: 8b 1f movl (%edi),%ebx a6: 83 c7 04 addl $0x4,%edi a9: 89 7c 24 24 movl %edi,0x24(%esp,1) ad: 8b 54 24 20 movl 0x20(%esp,1),%edx b1: 8b 12 movl (%edx),%edx b3: 89 54 24 10 movl %edx,0x10(%esp,1) b7: 83 44 24 20 04 addl $0x4,0x20(%esp,1) bc: 89 de movl %ebx,%esi be: 8b 7c 24 28 movl 0x28(%esp,1),%edi c2: 89 e9 movl %ebp,%ecx c4: 8a 2e movb (%esi),%ch c6: eb 08 jmp d0 <__GR_shift_scanline+d0> c8: 90 nop c9: 8d b4 26 00 00 leal 0x0(%esi,1),%esi ce: 00 00 d0: 46 incl %esi d1: 88 ec movb %ch,%ah d3: 8a 06 movb (%esi),%al d5: 88 c5 movb %al,%ch d7: d3 e8 shrl %cl,%eax d9: 88 02 movb %al,(%edx) db: 42 incl %edx dc: 4f decl %edi dd: 75 f1 jne d0 <__GR_shift_scanline+d0> df: ff 44 24 14 incl 0x14(%esp,1) e3: 8b 54 24 30 movl 0x30(%esp,1),%edx e7: 39 54 24 14 cmpl %edx,0x14(%esp,1) eb: 7c b3 jl a0 <__GR_shift_scanline+a0> ed: 5b popl %ebx ee: 5e popl %esi ef: 5f popl %edi f0: 5d popl %ebp f1: 83 c4 0c addl $0xc,%esp f4: c3 ret f5: 8d 76 00 leal 0x0(%esi),%esi And here is the new one (The patches mentioned earlier in this group have been applied to the source first. Otherwise there would have been no output at all): shiftscl.o: file format coff-go32 Disassembly of section .text: 00000000 <__GR_shift_scanline>: 0: 83 ec 1c subl $0x1c,%esp 3: 55 pushl %ebp 4: 57 pushl %edi 5: 56 pushl %esi 6: 53 pushl %ebx 7: 8b 7c 24 3c movl 0x3c(%esp,1),%edi b: 8b 54 24 40 movl 0x40(%esp,1),%edx f: 85 ff testl %edi,%edi 11: 7f 6d jg 80 13: f7 df negl %edi 15: 85 d2 testl %edx,%edx 17: 0f 8e b8 00 00 jle d5 1c: 00 1d: 89 54 24 14 movl %edx,0x14(%esp,1) 00000021 : 21: 8b 44 24 38 movl 0x38(%esp,1),%eax 25: 8b 54 24 34 movl 0x34(%esp,1),%edx 29: 8b 4c 24 30 movl 0x30(%esp,1),%ecx 2d: 89 44 24 10 movl %eax,0x10(%esp,1) 31: 89 c5 movl %eax,%ebp 33: 8b 12 movl (%edx),%edx 35: 01 54 24 10 addl %edx,0x10(%esp,1) 39: 8b 5c 24 10 movl 0x10(%esp,1),%ebx 3d: 83 44 24 34 04 addl $0x4,0x34(%esp,1) 42: 89 c2 movl %eax,%edx 44: 03 11 addl (%ecx),%edx 46: 83 c1 04 addl $0x4,%ecx 49: 89 4c 24 30 movl %ecx,0x30(%esp,1) 4d: 89 d6 movl %edx,%esi 4f: 89 f9 movl %edi,%ecx 51: 8a 29 movb (%ecx),%ch 53: eb 0b jmp 60 55: 8d 74 26 00 leal 0x0(%esi,1),%esi 59: 8d bc 27 00 00 leal 0x0(%edi,1),%edi 5e: 00 00 60: 49 decl %ecx 61: 88 e8 movb %ch,%al 63: 8a 21 movb (%ecx),%ah 65: 88 e5 movb %ah,%ch 67: d3 e8 shrl %cl,%eax 69: 88 03 movb %al,(%ebx) 6b: 4b decl %ebx 6c: 4e decl %esi 6d: 75 f1 jne 60 6f: d2 ed shrb %cl,%ch 71: 88 2b movb %ch,(%ebx) 73: ff 4c 24 14 decl 0x14(%esp,1) 77: 75 a8 jne 21 79: eb 5a jmp d5 7b: 90 nop 7c: 8d 74 26 00 leal 0x0(%esi,1),%esi 00000080 : 80: b8 08 00 00 00 movl $0x8,%eax 85: 29 f8 subl %edi,%eax 87: 89 c7 movl %eax,%edi 89: 85 d2 testl %edx,%edx 8b: 7e 48 jle d5 8d: 89 54 24 14 movl %edx,0x14(%esp,1) 00000091 : 91: 8b 44 24 34 movl 0x34(%esp,1),%eax 95: 8b 4c 24 30 movl 0x30(%esp,1),%ecx 99: 8b 6c 24 38 movl 0x38(%esp,1),%ebp 9d: 8b 00 movl (%eax),%eax 9f: 89 44 24 10 movl %eax,0x10(%esp,1) a3: 83 44 24 34 04 addl $0x4,0x34(%esp,1) a8: 8b 11 movl (%ecx),%edx aa: 83 c1 04 addl $0x4,%ecx ad: 89 4c 24 30 movl %ecx,0x30(%esp,1) b1: 89 c3 movl %eax,%ebx b3: 89 d6 movl %edx,%esi b5: 89 f9 movl %edi,%ecx b7: 8a 29 movb (%ecx),%ch b9: eb 05 jmp c0 bb: 90 nop bc: 8d 74 26 00 leal 0x0(%esi,1),%esi c0: 41 incl %ecx c1: 88 ec movb %ch,%ah c3: 8a 01 movb (%ecx),%al c5: 88 c5 movb %al,%ch c7: d3 e8 shrl %cl,%eax c9: 88 03 movb %al,(%ebx) cb: 43 incl %ebx cc: 4e decl %esi cd: 75 f1 jne c0 cf: ff 4c 24 14 decl 0x14(%esp,1) d3: 75 bc jne 91 000000d5 : d5: 5b popl %ebx d6: 5e popl %esi d7: 5f popl %edi d8: 5d popl %ebp d9: 83 c4 1c addl $0x1c,%esp dc: c3 ret 000000dd <.ef>: dd: 8d 76 00 leal 0x0(%esi),%esi Sorry for this huge mail. Tony