Fix gdb server crash when reading invalid addr
Fix gdb server crash when reading invalid addr

Normally when a gbd client tries to read or write to an invalid memory
address, the server should report an error to the client and continue
running.  Instead, when a large block at an invalid address is read or
written the server crashes.  This is because dapTransferBlock queues
multiple packets before the first response comes back.  On the first
return packet it then throws an exception.  This leaves the server out
of sync with packets from the target board - every command sent will
get one of the previous responses not yet read.  This quickly causes a
ValueError to get thrown, killing the gdb server.  This problem was
introduced in the commit:
2b69175eb7996da983846c2a6046f27c6fa43e4f -
    "Improve pyusb speed by creating reader thread"

This patch fixes the problem by guaranteeing that  dapTransferBlock
always reads as many packets and it sends before it throws an errors.

oliviermartin/pyOCD,mbedmicro/pyOCD,flit/pyOCD,0xc0170/pyOCD,geky/pyOCDgdb,geky/pyOCD,wjzhang/pyOCD,matthewelse/pyOCD,tgarc/pyOCD,wjzhang/pyOCD,0xc0170/pyOCD,bridadan/pyOCD,molejar/pyOCD,tgarc/pyOCD,c1728p9/pyOCD,geky/pyDAPLink,mbedmicro/pyOCD,c1728p9/pyOCD,bridadan/pyOCD,c1728p9/pyOCD,mesheven/pyOCD,oliviermartin/pyOCD,adamgreen/pyOCD,pyocd/pyOCD,geky/pyOCD,wjzhang/pyOCD,mesheven/pyOCD,oliviermartin/pyOCD,molejar/pyOCD,devanlai/pyOCD,0xc0170/pyOCD,flit/pyOCD,adamgreen/pyOCD,adamgreen/pyOCD,bridadan/pyOCD,mbedmicro/pyOCD,tgarc/pyOCD,pyocd/pyOCD,matthewelse/pyOCD,matthewelse/pyOCD,mesheven/pyOCD,devanlai/pyOCD,devanlai/pyOCD,molejar/pyOCD