/* Send the 'O' command to gdb to output text to its console. Command Format: OXX... Where XX is the hexadecimal representation of each character in the string to be sent to the gdb console. */ static void writeStringToExclusiveGdbCommChannel(const char* pString) { Buffer* pBuffer = GetInitializedBuffer(); Buffer_WriteChar(pBuffer, 'O'); while (*pString) Buffer_WriteByteAsHex(pBuffer, *pString++); if (!Buffer_OverrunDetected(pBuffer)) SendPacketToGdb(); }
/* Sent when an exception occurs while program is executing because of previous 'c' (Continue) or 's' (Step) commands. Data Format: Tssii:xxxxxxxx;ii:xxxxxxxx;... Where ss is the hex value of the signal which caused the exception. ii is the hex offset of the 32-bit register value following the ':' The offset is relative to the register contents in the g response packet and the SContext structure. xxxxxxxx is the 32-bit value of the specified register in hex format. The above ii:xxxxxxxx; patterns can be repeated for whichever register values should be sent with T repsonse. */ uint32_t Send_T_StopResponse(void) { Buffer* pBuffer = GetInitializedBuffer(); Buffer_WriteChar(pBuffer, 'T'); Buffer_WriteByteAsHex(pBuffer, GetSignalValue()); Platform_WriteTResponseRegistersToBuffer(pBuffer); SendPacketToGdb(); return HANDLER_RETURN_RETURN_IMMEDIATELY; }
static uint32_t readMemoryBytesIntoHexBuffer(Buffer* pBuffer, const void* pvMemory, uint32_t readByteCount) { uint32_t byteCount = 0; uint8_t* p = (uint8_t*) pvMemory; while (readByteCount-- > 0) { uint8_t byte; byte = Platform_MemRead8(p++); if (Platform_WasMemoryFaultEncountered()) break; Buffer_WriteByteAsHex(pBuffer, byte); byteCount++; } return byteCount; }
static void writeBytesToBufferAsHex(Buffer* pBuffer, const void* pv, size_t length) { uint8_t* pBytes = (uint8_t*)pv; while (length--) Buffer_WriteByteAsHex(pBuffer, *pBytes++); }