From: Cristiano <cri...@ho...> - 2015-03-31 21:48:03
|
On 07/10/2014 11:05 PM, Cristiano wrote: > Hi, I've applied the patches to the latest SVN snapshot. I use GDB > 7.7.1. Great job! Stepping is now super fast. I'm debugging from > Eclipse and the experience is now decent. The patch for the GDB > disassemble is here: > https://sourceware.org/bugzilla/show_bug.cgi?id=13519 > > Thanks for AVARICE and these patches. -Cristiano > >> Hello, >> >> as suggested the patches have been uploaded to the patch tracker! > I'm trying the debugging experience, using the above setup, on a LUFA project. After tweaking a little bit the LUFA makefile and resorting using the Atmel AVR toolchain v3.4.5 for Linux, I can confirm the experience is still quite good. Stepping is fast if compared with a vanilla Avarice but... Sometimes, stepping (gdb `next' or `step' commands) from the return statement of a function ends in the __vectors jump table. Another `next' from here stops avr-gdb in the USB ISR. This is somewhat surprising because I launch Avarice with the --ignore-intr switch. Note that interrupts are usually skipped but there are pathological case where they are not, systematically. Returning from the function, from the same return statement above, with `finish' or returning through a sequence of `nexti' or `stepi' produces the expected result, returning to the function caller. There must be something wrong with the patches or maybe this is a known issue. If I run the same debug session above using a vanilla Avarice 2.10 (Linux Mint package), with the same options, everything works as expected (if you have the patience of waiting 5-10 seconds for a step). Since these patches make a big difference in debugging (stepping is 5x faster) I'd like to help debugging this issue. Below is the disassembled function. I can provide gdb and avarice logs if needed. Regards, Cristiano CALLBACK_HID_Device_CreateHIDReport: 000004a6: push r16 000004a8: push r17 000004aa: push r28 000004ac: push r29 000004ae: in r28, 0x3d ; 61 000004b0: in r29, 0x3e ; 62 000004b2: sbiw r28, 0x0f ; 15 000004b4: in r0, 0x3f ; 63 000004b6: cli 000004b8: out 0x3e, r29 ; 62 000004ba: out 0x3f, r0 ; 63 000004bc: out 0x3d, r28 ; 61 000004be: std Y+8, r25 ; 0x08 000004c0: std Y+7, r24 ; 0x07 000004c2: std Y+10, r23 ; 0x0a 000004c4: std Y+9, r22 ; 0x09 000004c6: std Y+11, r20 ; 0x0b 000004c8: std Y+13, r19 ; 0x0d 000004ca: std Y+12, r18 ; 0x0c 000004cc: std Y+15, r17 ; 0x0f 000004ce: std Y+14, r16 ; 0x0e 167 uint8_t* Data = (uint8_t*)ReportData; 000004d0: ldd r24, Y+12 ; 0x0c 000004d2: ldd r25, Y+13 ; 0x0d 000004d4: std Y+2, r25 ; 0x02 000004d6: std Y+1, r24 ; 0x01 168 uint8_t CurrLEDMask = LEDs_GetLEDs(); 000004d8: call 0x26c ; 0x26c <LEDs_GetLEDs> 000004dc: std Y+3, r24 ; 0x03 169 hal_rx_frame_t *frame = NULL; 000004de: std Y+5, r1 ; 0x05 000004e0: std Y+4, r1 ; 0x04 171 HAL_ENTER_CRITICAL_REGION(); 000004e2: ldi r24, 0x5F ; 95 000004e4: ldi r25, 0x00 ; 0 000004e6: movw r30, r24 000004e8: ld r24, Z 000004ea: std Y+6, r24 ; 0x06 000004ec: cli 172 frame = (hal_rx_frame_t*) list_pop(hal_rx_frame_queue); 000004ee: lds r24, 0x0100 000004f2: lds r25, 0x0101 000004f6: call 0x14bc ; 0x14bc <list_pop> 000004fa: std Y+5, r25 ; 0x05 000004fc: std Y+4, r24 ; 0x04 173 HAL_LEAVE_CRITICAL_REGION(); 000004fe: ldi r24, 0x5F ; 95 00000500: ldi r25, 0x00 ; 0 00000502: ldd r18, Y+6 ; 0x06 00000504: movw r30, r24 00000506: st Z, r18 175 if (frame != NULL) { 00000508: ldd r24, Y+4 ; 0x04 0000050a: ldd r25, Y+5 ; 0x05 0000050c: sbiw r24, 0x00 ; 0 0000050e: breq .+14 ; 0x51e <CALLBACK_HID_Device_CreateHIDReport+120> 177 LEDs_ToggleLEDs(LEDS_LED4); 00000510: ldi r24, 0x04 ; 4 00000512: call 0x23c ; 0x23c <LEDs_ToggleLEDs> 178 hal_rx_frame_free(frame); 00000516: ldd r24, Y+4 ; 0x04 00000518: ldd r25, Y+5 ; 0x05 0000051a: call 0xd98 ; 0xd98 <hal_rx_frame_free> 181 if (changed) 0000051e: lds r24, 0x0122 00000522: and r24, r24 00000524: brne .+2 ; 0x528 <CALLBACK_HID_Device_CreateHIDReport+130> 00000526: rjmp .+134 ; 0x5ae <CALLBACK_HID_Device_CreateHIDReport+264> 183 changed = false; 00000528: sts 0x0122, r1 185 Data[0] = ((CurrLEDMask & LEDS_LED1) ? 1 : 0); 0000052c: ldd r24, Y+3 ; 0x03 0000052e: adc r24, r24 00000530: eor r24, r24 00000532: adc r24, r24 00000534: mov r18, r24 00000536: ldd r24, Y+1 ; 0x01 00000538: ldd r25, Y+2 ; 0x02 0000053a: movw r30, r24 0000053c: st Z, r18 186 Data[1] = ((CurrLEDMask & LEDS_LED2) ? 1 : 0); 0000053e: ldd r24, Y+1 ; 0x01 00000540: ldd r25, Y+2 ; 0x02 00000542: adiw r24, 0x01 ; 1 00000544: ldd r18, Y+3 ; 0x03 00000546: mov r18, r18 00000548: ldi r19, 0x00 ; 0 0000054a: andi r18, 0x20 ; 32 0000054c: eor r19, r19 0000054e: ldi r20, 0x01 ; 1 00000550: cp r18, r1 00000552: cpc r19, r1 00000554: brne .+2 ; 0x558 <CALLBACK_HID_Device_CreateHIDReport+178> 00000556: ldi r20, 0x00 ; 0 00000558: mov r18, r20 0000055a: movw r30, r24 0000055c: st Z, r18 187 Data[2] = ((CurrLEDMask & LEDS_LED3) ? 1 : 0); 0000055e: ldd r24, Y+1 ; 0x01 00000560: ldd r25, Y+2 ; 0x02 00000562: adiw r24, 0x02 ; 2 00000564: ldd r18, Y+3 ; 0x03 00000566: mov r18, r18 00000568: ldi r19, 0x00 ; 0 0000056a: andi r18, 0x08 ; 8 0000056c: eor r19, r19 0000056e: ldi r20, 0x01 ; 1 00000570: cp r18, r1 00000572: cpc r19, r1 00000574: brne .+2 ; 0x578 <CALLBACK_HID_Device_CreateHIDReport+210> 00000576: ldi r20, 0x00 ; 0 00000578: mov r18, r20 0000057a: movw r30, r24 0000057c: st Z, r18 188 Data[3] = ((CurrLEDMask & LEDS_LED4) ? 1 : 0); 0000057e: ldd r24, Y+1 ; 0x01 00000580: ldd r25, Y+2 ; 0x02 00000582: adiw r24, 0x03 ; 3 00000584: ldd r18, Y+3 ; 0x03 00000586: mov r18, r18 00000588: ldi r19, 0x00 ; 0 0000058a: andi r18, 0x04 ; 4 0000058c: eor r19, r19 0000058e: ldi r20, 0x01 ; 1 00000590: cp r18, r1 00000592: cpc r19, r1 00000594: brne .+2 ; 0x598 <CALLBACK_HID_Device_CreateHIDReport+242> 00000596: ldi r20, 0x00 ; 0 00000598: mov r18, r20 0000059a: movw r30, r24 0000059c: st Z, r18 190 *ReportSize = GENERIC_REPORT_SIZE; 0000059e: ldd r24, Y+14 ; 0x0e 000005a0: ldd r25, Y+15 ; 0x0f 000005a2: ldi r18, 0x08 ; 8 000005a4: ldi r19, 0x00 ; 0 000005a6: movw r30, r24 000005a8: std Z+1, r19 ; 0x01 000005aa: st Z, r18 000005ac: rjmp .+10 ; 0x5b8 <CALLBACK_HID_Device_CreateHIDReport+274> 193 *ReportSize = 0; 000005ae: ldd r24, Y+14 ; 0x0e 000005b0: ldd r25, Y+15 ; 0x0f 000005b2: movw r30, r24 000005b4: std Z+1, r1 ; 0x01 000005b6: st Z, r1 196 return true; 000005b8: ldi r24, 0x01 ; 1 197 } 000005ba: adiw r28, 0x0f ; 15 000005bc: in r0, 0x3f ; 63 000005be: cli 000005c0: out 0x3e, r29 ; 62 000005c2: out 0x3f, r0 ; 63 000005c4: out 0x3d, r28 ; 61 000005c6: pop r29 000005c8: pop r28 000005ca: pop r17 000005cc: pop r16 000005ce: ret |