From mboxrd@z Thu Jan 1 00:00:00 1970 From: Motoya Kurotsu To: ecos-discuss@sources.redhat.com Subject: [ECOS] mips: address error after break Date: Fri, 11 May 2001 00:45:00 -0000 Message-id: <20010511163830.A1202@white.office1> X-SW-Source: 2001-05/msg00133.html Hi, I'm porting ecos on the customed mips base board with NKK's NR4700 (maybe, compatible with IDT's R4700) as CPU and Gelileo Technology's GT-64010 as controller, based on VR4373 ports. Stub seems to work with gdb except one problem. That is, after I stop the program at a breakpoint and continue it, the address error exception occurs. Checking the BadVAddr register, the address which caused exception seems to be correctly aligned. Moreover, the occurence of exception seems to depend on where the breakpoint is placed. Could anyone suggest me anything? Regards, Motoya Kurotsu Alilled Telesis K.K. -------------------- I'm using the codes and tools in the following: ecos: snapshot of Jan 25, 2001 binutils: 2.10.1 gcc : 2.95.2.1, compiled with mips64orion-idt-elf as the prefix gdb : insight-5.0 Below is the process of regenerating problem and the result: (gdb) b led.c:act_blink Breakpoint 1 at 0x80101174: file led.c, line 26. (gdb) c Continuing. Breakpoint 1, act_blink () at led.c:26 26 for(j=0;j<10;j++) { (gdb) c Continuing. Program received signal SIGSEGV, Segmentation fault. 0x80101178 in act_blink () at led.c:26 26 for(j=0;j<10;j++) { (gdb) info registers ............ gp sp s8 ra R28 ffffffff8012a410 ffffffff8012b530 ffffffff8012b530 ffffffff8010112c sr lo hi bad 34001802 0000000000040000 000000000eac8849 ffffffff8012b544 cause pc 0000000000008014 ffffffff80101178 ............ (gdb) disassemble Dump of assembler code for function act_blink: 0x80101164 : addiu $sp,$sp,-32 0x80101168 : sw $ra,28($sp) 0x8010116c : sw $s8,24($sp) 0x80101170 : move $s8,$sp 0x80101174 : nop 0x80101178 : sw $zero,20($s8) 0x8010117c : lw $v0,20($s8) 0x80101180 : slti $v1,$v0,10 ............ Below is the case where exception doesn't happen: (gdb) delete 1 (gdb) break led.c:19 Breakpoint 2 at 0x80101124: file led.c, line 19. (gdb) j _start Line 106 is not in `act_blink'. Jump anyway? (y or n) y Continuing at 0x801000f0. Breakpoint 2, cyg_user_start () at led.c:19 19 act_blink(); (gdb) c Continuing. Breakpoint 2, cyg_user_start () at led.c:19 19 act_blink(); (gdb) c Continuing. Breakpoint 2, cyg_user_start () at led.c:19 19 act_blink(); (gdb) disassemble Dump of assembler code for function act_blink: 0x801010f4 : addiu $sp,$sp,-32 0x801010f8 : sw $ra,28($sp) 0x801010fc : sw $s8,24($sp) 0x80101100 : move $s8,$sp 0x80101104 : nop 0x80101108 : sw $zero,16($s8) 0x8010110c : lw $v0,16($s8) 0x80101110 : slti $v1,$v0,1000 0x80101114 : bnez $v1,0x80101124 0x80101118 : nop 0x8010111c : j 0x80101140 0x80101120 : nop 0x80101124 : jal 0x80101164 0x80101128 : nop 0x8010112c : lw $v0,16($s8) 0x80101130 : addiu $v1,$v0,1 0x80101134 : sw $v1,16($s8) 0x80101138 : j 0x8010110c 0x8010113c : nop ............ My sample program: 13 void act_blink(void); 14 int cyg_user_start(void) 15 { 16 int i; 17 18 for(i=0;i<1000;i++) { 19 act_blink(); 20 } 21 return 0; 22 } 23 void act_blink(void) 24 { 25 int i,j; 26 for(j=0;j<10;j++) { 27 for (i=0; i<100000; i++) 28 hal_led_act(); 29 for (i=0; i<100000; i++) 30 hal_led_on(0,0); 31 } 32 } I compiled the stub and my program without -ffunction-sections, -fdata-sections as CFLAGS and --gc-sections as LDFLAGS so that the breakpoint works correctly. ===========