dcwbrown / dwire-debug

Simple stand-alone debugger for AVR DebugWIRE chips connected directly to an FT232R/CH340/DigiSpark/LittleWire on Linux or Windows.
GNU General Public License v2.0
191 stars 33 forks source link

Segfault when starting gdbserver with a USBTiny talking to an ATTiny85 #47

Closed faisyl closed 4 years ago

faisyl commented 4 years ago

Using a digispark repurposed as an UsbTiny talking to an ATTiny85. Other operations work fine. Launching gdbserver causes a SegFault. Here' the relevant error and the backtrace for the failure.

Unconnected.                            > gdbserver
Connected to ATtiny85 on UsbTiny1 at 7739 baud.
Could not read back timings following transfer and sync command

[New Thread 0x2503 of process 3903]
[New Thread 0x271f of process 3903]

Thread 3 received signal SIGSEGV, Segmentation fault.
0x0000000100196670 in usb_control_msg () from /opt/local/lib/libusb-0.1.4.dylib
(gdb) bt
#0  0x0000000100196670 in usb_control_msg () from /opt/local/lib/libusb-0.1.4.dylib
#1  0x0000000100002f9c in digisparkUSBSendBytes (up=0x1002067f0, state=20 '\024',
    out=0x1000bd1b0 <DigisparkOutBufBytes> "dd", <incomplete sequence \342\043>, outlen=23) at src/dwire/DigiSpark.c:188
#2  0x000000010000309b in digisparkBufferFlush (up=0x1002067f0, state=20 '\024') at src/dwire/DigiSpark.c:211
#3  0x000000010000324a in DigisparkReceive (up=0x1002067f0, in=0x7ffeefbff0bc "\001", inlen=4) at src/dwire/DigiSpark.c:250
#4  0x000000010000491a in DwReceive (in=0x7ffeefbff0bc "\001", inlen=4) at src/dwire/DwPort.c:42
#5  0x0000000100006dc3 in DwReadFlash (addr=0, len=4, buf=0x7ffeefbff0bc "\001") at src/commands/NonVolatile.c:106
#6  0x000000010000d16c in DisassemblyPrompt () at src/ui/UserInterface.c:43
#7  0x000000010000d40e in Prompt () at src/ui/UserInterface.c:134
#8  0x000000010000d4f7 in UI () at src/ui/UserInterface.c:153
#9  0x000000010000d533 in main (argCount=1, argVector=0x7ffeefbff130) at src/dwdebug.c:18

I don't understand the USB specific code to dig deeper. Any help would be appreciated.

faisyl commented 4 years ago

I guess this is similar to #9.