int Platform_CommReceiveChar(void) { waitForReceiveData(); int character = Buffer_ReadChar(&g_receiveBuffer); clearExceptionCode(); return character; }
/* Handle the 'c' command which is sent from gdb to tell the debugger to continue execution of the currently halted program. Command Format: cAAAAAAAA Response Format: Blank until the next exception, at which time a 'T' stop response packet will be sent. Where AAAAAAAA is an optional value to be used for the Program Counter when restarting the program. */ uint32_t HandleContinueCommand(void) { Buffer* pBuffer = GetBuffer(); uint32_t returnValue = 0; uint32_t newPC; returnValue |= skipHardcodedBreakpoint(); /* New program counter value is optional parameter. */ __try { __throwing_func( newPC = ReadUIntegerArgument(pBuffer) ); Platform_SetProgramCounter(newPC); } __catch { clearExceptionCode(); } return (returnValue | HANDLER_RETURN_RESUME_PROGRAM | HANDLER_RETURN_RETURN_IMMEDIATELY); }
/* Handle the 'F' command which is sent from gdb in response to a previously sent File I/O command from mri. Command Format: Frr[,ee[,C]] Where rr is the signed hexadecimal representation of the return code from the last requested file I/O command. ee is the optional signed hexadecimal value for the errorno associated with the call if rr indicates error. C is the optional 'C' character sent by gdb to indicate that CTRL+C was pressed by user while gdb was processing the current file I/O request. */ uint32_t HandleFileIOCommand(void) { static const char controlCFlag[] = ",C"; Buffer* pBuffer = GetBuffer(); int returnCode = -1; int errNo = 0; int controlC = 0; returnCode = Buffer_ReadIntegerAsHex(pBuffer); if (Buffer_IsNextCharEqualTo(pBuffer, ',')) { errNo = Buffer_ReadIntegerAsHex(pBuffer); controlC = Buffer_MatchesString(pBuffer, controlCFlag, sizeof(controlCFlag)-1); } SetSemihostReturnValues(returnCode, errNo); RecordControlCFlagSentFromGdb(controlC); clearExceptionCode(); return (HANDLER_RETURN_RESUME_PROGRAM | HANDLER_RETURN_RETURN_IMMEDIATELY); }
static uint32_t uint32FromString(const char* pString) { uint32_t value = 0; while (*pString) { uint32_t digit; __try { digit = getDecimalDigit(*pString++); } __catch { clearExceptionCode(); break; } value = value * 10 + digit; } return value; }
void validateExceptionThrown(int expectedExceptionCode) { LONGS_EQUAL(expectedExceptionCode, getExceptionCode()); clearExceptionCode(); }
void teardown() { LONGS_EQUAL ( m_expectedException, getExceptionCode() ); clearExceptionCode(); platformMock_Uninit(); }
void teardown() { LONGS_EQUAL( m_expectedExceptionCode, getExceptionCode() ); clearExceptionCode(); free(m_pTestString); }
void validateOutOfMemoryExceptionThrown() { LONGS_EQUAL(outOfMemoryException, getExceptionCode()); clearExceptionCode(); POINTERS_EQUAL(NULL, m_pTextSource); }