[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BUG REPORT
From: |
Konstantin A. Kostyukhin |
Subject: |
BUG REPORT |
Date: |
Fri, 18 Jun 2004 16:40:39 +0400 (MSK) |
1. GDB version 6.1 and lower
2. Native platform is `i686-pc-linux-gnu',
target platform is `mips64-*-*'
3. GDB was compiled with GCC 3.2.2
4. The debugged program was compiled with GCC 3.4
5. Options used for compilation of the debugged program: "-g -G 0 -c"
6. The debugged program (test.c):
static int test (long long param) {return param;}
int main(void)
{
return (int) test (5);
}
Disassembler of this test (by objdump):
test.o: file format elf32-bigmips
Disassembly of section .text:
00000000 <test>:
0: 27bdfff8 addiu sp,sp,-8
4: ffbe0000 sd s8,0(sp)
8: 03a0f02d move s8,sp
! c: ffc40008 sd a0,8(s8)
10: dfc20008 ld v0,8(s8)
14: 00021000 sll v0,v0,0x0
18: 03c0e82d move sp,s8
1c: dfbe0000 ld s8,0(sp)
20: 27bd0008 addiu sp,sp,8
24: 03e00008 jr ra
28: 00000000 nop
0000002c <main>:
2c: 27bdffd0 addiu sp,sp,-48
30: ffbf0028 sd ra,40(sp)
34: ffbe0020 sd s8,32(sp)
38: 03a0f02d move s8,sp
3c: 24040005 li a0,5
40: 0c000000 jal 0 <test>
44: 00000000 nop
48: 03c0e82d move sp,s8
4c: dfbf0028 ld ra,40(sp)
50: dfbe0020 ld s8,32(sp)
54: 27bd0030 addiu sp,sp,48
58: 03e00008 jr ra
5c: 00000000 nop
7. Look at the string below:
! c: ffc40008 sd a0,8(s8)
GDB doesn't recognize this code as a part of prologue, so
we receive incorrect argument value after hitting breakpoint on the function
'test'.
8. I suppose that the cause of the problem is the following.
Current version of function mips-tdep.c::mips32_skip_prologue:
static CORE_ADDR
mips32_skip_prologue (CORE_ADDR pc)
{
...
else if ((inst & 0xF3E00000) == 0xA3C00000 && (inst & 0x001F0000))
/* sx reg,n($s8) */
continue; /* reg != $zero */
else if (((inst & 0xFFE00000) == 0xAFA00000 /* sw reg,n($sp) */
|| (inst & 0xFFE00000) == 0xFFA00000) /* sd reg,n($sp) */
&& (inst & 0x001F0000)) /* reg != $zero */
continue;
else if ((inst & 0xFFE00000) == 0xE7A00000) /* swc1 freg,n($sp) */
continue;
else if ((inst & 0xF3E00000) == 0xA3C00000 && (inst & 0x001F0000))
/* sx reg,n($s8) */
continue; /* reg != $zero */
...
}
My version of function mips-tdep.c::mips32_skip_prologue:
static CORE_ADDR
mips32_skip_prologue (CORE_ADDR pc)
{
...
else if ((inst & 0xF3E00000) == 0xA3C00000 && (inst & 0x001F0000))
/* sx reg,n($s8) */
continue; /* reg != $zero */
else if (((inst & 0xFFE00000) == 0xAFA00000 /* sw reg,n($sp) */
|| (inst & 0xFFE00000) == 0xFFA00000) /* sd reg,n($sp) */
&& (inst & 0x001F0000)) /* reg != $zero */
continue;
else if ((inst & 0xFFE00000) == 0xE7A00000) /* swc1 freg,n($sp) */
continue;
/* Be carefull!!! We forgot command sd reg,n($s8)
address@hidden 18-jun-04 */
else if (((inst & 0xF3E00000) == 0xA3C00000 /* sw reg,n($s8) */
|| (inst & 0xF3E00000) == 0xF3C00000) /* sd reg,n($s8) */
&& (inst & 0x001F0000))
continue; /* reg != $zero */
...
}
9. I hope that my patch for this bug is correct.
Best regards,
Konstantin Kostyuhin
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- BUG REPORT,
Konstantin A. Kostyukhin <=