 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Noko
Joined: 06 Sep 2008 Posts: 23
|
Posted: Wed Sep 10, 2008 7:09 pm Post subject: very weird SIGBUS error |
|
|
I have some very strange error in SDL. Here's the output of gdb:
| Code: | GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-cygwin --target=psp"...
(gdb) target remote :10001
Remote debugging using :10001
[New thread 0]
_start (args=0, argp=0x0) at crt0.c:105
105 if ((&module_info != NULL) && (module_info.modattribute & 0x1000)) {
(gdb) c
Continuing.
[New thread 13506353]
Program received signal SIGBUS, Bus error.
[Switching to thread 13506353]
SDL_LowerBlit (src=0x8ad0780, srcrect=0x88f7cb0, dst=0x8ab4450, dstrect=0x88f7ca8) at SDL_surface.c:424
424 if ( (src->map->dst != dst) ||
(gdb) disas
Dump of assembler code for function SDL_LowerBlit:
0x089f47a8 <SDL_LowerBlit+0>: addiu sp,sp,-40
0x089f47ac <SDL_LowerBlit+4>: sw s3,28(sp)
0x089f47b0 <SDL_LowerBlit+8>: sw s2,24(sp)
0x089f47b4 <SDL_LowerBlit+12>: sw s1,20(sp)
0x089f47b8 <SDL_LowerBlit+16>: sw s0,16(sp)
0x089f47bc <SDL_LowerBlit+20>: sw ra,32(sp)
0x089f47c0 <SDL_LowerBlit+24>: lw t0,48(a0)
0x089f47c4 <SDL_LowerBlit+28>: move s3,a0
0x089f47c8 <SDL_LowerBlit+32>: move s2,a2
0x089f47cc <SDL_LowerBlit+36>: lw v0,0(t0)
0x089f47d0 <SDL_LowerBlit+40>: move s0,a1
0x089f47d4 <SDL_LowerBlit+44>: bne v0,a2,0x89f47ec <SDL_LowerBlit+68>
0x089f47d8 <SDL_LowerBlit+48>: move s1,a3
<omitted>
(gdb) p/x $pc
$1 = 0x89f47cc
(gdb) p/x $t0
$2 = 0x0
(gdb) p/x $a0
$3 = 0x8ad0780
(gdb) p/x *(int *)($a0+48)
$4 = 0x8b7e530
(gdb) set $t0=*(int *)($a0+48)
(gdb) p/x $t0
$5 = 0x8b7e530
(gdb) c
Continuing.
Can't send signals to this remote system. SIGBUS not sent. |
The faulty operation is lw t0,48(a0) because t0 is 0. But t0 is supposed to be set at 0x089f47c0, with lw t0,48(a0). And when I set $t0 to *(int *)($a0+48) manually, program continues to work like lnothing happened.
This error happens randomly, I call SDL_LowerBlit many times, and only in some rare cases this hasppens.
EDIT:
I am a fucking idiot and another thread deleted the surface, that's why I had SIGBUS, and then this thread allocated surface again and that's why everything worked in debugger.
Thank you for reading.
Last edited by Noko on Fri Sep 12, 2008 2:41 am; edited 1 time in total |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Wed Sep 10, 2008 7:57 pm Post subject: |
|
|
Well, honestly, reading carefully your output of gdb, the only sensible explanation i might see is a cache issue : how is it possible for lw $t0, 48($a0) randomly to read different values in run-time (as you say it happens randomly) ?
I would first have thought something might randomly set src->map to 0 but your gdb output seems to prove that it wasn't the case since you had a zero value at run-time and then you had the right value in debug-time by manually setting t0 from the same memory reference just after the exception with t0 == 0.
I'm sure there is a logical reason why it messes up, but we haven't enough information to tell you why. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|