I experience problem with debugging with -O option turned on. Simply gdb closes the session ( as eclipse says ).
robert David Brown wrote:
What sort of compile-time options have you got turned on? It looks to me like this is compiled with all optomisations switched off, and full debugging on, so that the compiler generates as debugger-friendly code as possible. For example, a local copy of the parameter d is made on the stack, and manipulated there rather than using a register, and r5 is set up as a frame pointer so that any debugger can track local variables and the stack. It is usual to compile with at least -O, if not -O2 - gcc and gdb are perfectly happy with debugging optomised code (although occasionally local variables give odd values, or are optomised away altogether), and I find they give far more understandable assembly code than unoptomised code. mvh., DavidI have simple delay loop as: void delay(unsigned int d) { while(d--){ nop(); nop(); } } I was expecting that this function will use only one register (r15), as it doesn't declare anything. To my supprise dissassembly is very complicated. Does anyone know why it is so? And what is add #6, r5 Also another thing: while(d--) syntax. I understand above syn. as AGAIN: cmp d jnz X add #-1,d jmp AGAIN X: as opposite to while (--d) syntax which is realized as below. void delay(unsigned int d) { 1140: 05 12 push r5 ; 1142: 04 12 push r4 ; 1144: 05 41 mov r1, r5 ; 1146: 35 50 06 00 add #6, r5 ;#0x0006 114a: 21 83 decd r1 ; 114c: 04 41 mov r1, r4 ; 114e: 84 4f 00 00 mov r15, 0(r4) ; while(d--) { 1152: b4 53 00 00 add #-1, 0(r4) ;r3 As==11 1156: b4 93 00 00 cmp #-1, 0(r4) ;r3 As==11 115a: 01 20 jnz $+4 ;abs 0x115e 115c: 03 3c jmp $+8 ;abs 0x1164 nop(); 115e: 03 43 nop nop(); 1160: 03 43 nop 1162: f7 3f jmp $-16 ;abs 0x1152 } } 1164: 21 53 incd r1 ; 1166: 34 41 pop r4 ; 1168: 35 41 pop r5 ; 116a: 30 41 ret ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Mspgcc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mspgcc-users------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Mspgcc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mspgcc-users
