コード例 #1
0
ファイル: gdb_console.c プロジェクト: JaredCJR/mri
/* 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();
}
コード例 #2
0
ファイル: cmd_registers.c プロジェクト: adamgreen/mri
/* 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;
}
コード例 #3
0
ファイル: cmd_file.c プロジェクト: CNCBASHER/mri
/* Send file close request to gdb on behalf of mbed LocalFileSystem.

    Data Format: Fclose,ff
    
    Where ff is the hex value of the file descriptor to be closed.
*/
int IssueGdbFileCloseRequest(uint32_t fileDescriptor)
{
    static const char  gdbCloseCommand[] = "Fclose,";
    Buffer*            pBuffer = GetInitializedBuffer();

    Buffer_WriteString(pBuffer, gdbCloseCommand);
    Buffer_WriteUIntegerAsHex(pBuffer, fileDescriptor);
    
    SendPacketToGdb();
    return processGdbFileResponseCommands();
}
コード例 #4
0
ファイル: cmd_query.c プロジェクト: jserv/mri
/* Handle the "qSupported" command used by gdb to communicate state to debug monitor and vice versa.

    Reponse Format: qXfer:memory-map:read+;PacketSize==SSSSSSSS
    Where SSSSSSSS is the hexadecimal representation of the maximum packet size support by this stub.
*/
static uint32_t handleQuerySupportedCommand(void)
{
    static const char querySupportResponse[] = "qXfer:memory-map:read+;qXfer:features:read+;PacketSize=";
    uint32_t          PacketSize = Platform_GetPacketBufferSize();
    Buffer*           pBuffer = GetInitializedBuffer();

    Buffer_WriteString(pBuffer, querySupportResponse);
    Buffer_WriteUIntegerAsHex(pBuffer, PacketSize);
    
    return 0;
}
コード例 #5
0
ファイル: cmd_file.c プロジェクト: CNCBASHER/mri
/* Send file unlink request to gdb on behalf of mbed LocalFileSystem.

    Data Format: Funlink,ff/nn
    
    Where ff is the hex representation of the address of the filename to be deleted.
          nn is the hex value of the count of characters in the filename pointed to by ff.
*/
int IssueGdbFileUnlinkRequest(const RemoveParameters* pParameters)
{
    static const char  gdbUnlinkCommand[] = "Funlink,";
    Buffer*            pBuffer = GetInitializedBuffer();

    Buffer_WriteString(pBuffer, gdbUnlinkCommand);
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->filenameAddress);
    Buffer_WriteChar(pBuffer, '/');
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->filenameLength + 1);
    
    SendPacketToGdb();
    return processGdbFileResponseCommands();
}
コード例 #6
0
ファイル: cmd_file.c プロジェクト: CNCBASHER/mri
/* Send file read request to gdb on behalf of mbed LocalFileSystem or stdin.

    Data Format: Fread,ff,pp,cc
    
    Where ff is the hex value of the file descriptor of the file from which the data should be read.
          pp is the hex representation of the buffer to be read into.
          cc is the hex value of the count of bytes in the buffer to be read from the specified file.
*/
int IssueGdbFileReadRequest(const TransferParameters* pParameters)
{
    static const char  gdbReadCommand[] = "Fread,";
    Buffer*            pBuffer = GetInitializedBuffer();

    Buffer_WriteString(pBuffer, gdbReadCommand);
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->fileDescriptor);
    Buffer_WriteChar(pBuffer, ',');
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->bufferAddress);
    Buffer_WriteChar(pBuffer, ',');
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->bufferSize);
    
    SendPacketToGdb();
    return processGdbFileResponseCommands();
}
コード例 #7
0
ファイル: cmd_file.c プロジェクト: CNCBASHER/mri
/* Send file seek request to gdb on behalf of mbed LocalFileSystem.

    Data Format: Flseek,ff,oo,ww
    
    Where ff is the hex value of the file descriptor to be seeked within.
          oo is the hex value of the signed offset for the seek.
          ww is the hex value of the flag indicating from where the seek should be conducted (whence.)
*/
int IssueGdbFileSeekRequest(const SeekParameters* pParameters)
{
    static const char  gdbSeekCommand[] = "Flseek,";
    Buffer*            pBuffer = GetInitializedBuffer();

    Buffer_WriteString(pBuffer, gdbSeekCommand);
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->fileDescriptor);
    Buffer_WriteChar(pBuffer, ',');
    Buffer_WriteIntegerAsHex(pBuffer, pParameters->offsetFromStart);
    Buffer_WriteChar(pBuffer, ',');
    Buffer_WriteIntegerAsHex(pBuffer, SEEK_SET);
    
    SendPacketToGdb();
    return processGdbFileResponseCommands();
}
コード例 #8
0
ファイル: cmd_file.c プロジェクト: CNCBASHER/mri
/* Send file open request to gdb on behalf of mbed LocalFileSystem.

    Data Format: Fopen,ff/nn,mm
    
    Where ff is the hex representation of the address of the filename to be opened.
          nn is the hex value of the count of characters in the filename pointed to by ff.
          mm is the hex value of the mode to be used for the file open.
*/
int IssueGdbFileOpenRequest(const OpenParameters* pParameters)
{
    static const char  gdbOpenCommand[] = "Fopen,";
    Buffer*            pBuffer = GetInitializedBuffer();

    Buffer_WriteString(pBuffer, gdbOpenCommand);
    Buffer_WriteUIntegerAsHex(pBuffer, (uint32_t)(size_t)pParameters->pFilename);
    Buffer_WriteChar(pBuffer, '/');
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->filenameLength + 1);
    Buffer_WriteChar(pBuffer, ',');
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->flags);
    Buffer_WriteChar(pBuffer, ',');
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->mode);
    
    SendPacketToGdb();
    return processGdbFileResponseCommands();
}
コード例 #9
0
ファイル: cmd_file.c プロジェクト: JaredCJR/mri
/* Send file rename request to gdb.

    Data Format: Frename,oo/aa,nn/bb
    
    Where oo is the hex representation of the address of the original filename.
          aa is the hex value of the count of characters in the original filename pointed to by oo.
          nn is the hex representation of the address of the new filename.
          bb is the hex value of the count of characters in the new filename pointed to by nn.
*/
int IssueGdbFileRenameRequest(const RenameParameters* pParameters)
{
    static const char  gdbCommand[] = "Frename,";
    Buffer*            pBuffer = GetInitializedBuffer();

    Buffer_WriteString(pBuffer, gdbCommand);
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->origFilenameAddress);
    Buffer_WriteChar(pBuffer, '/');
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->origFilenameLength);
    Buffer_WriteChar(pBuffer, ',');
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->newFilenameAddress);
    Buffer_WriteChar(pBuffer, '/');
    Buffer_WriteUIntegerAsHex(pBuffer, pParameters->newFilenameLength);
    
    SendPacketToGdb();
    return processGdbFileResponseCommands();
}
コード例 #10
0
ファイル: cmd_registers.c プロジェクト: adamgreen/mri
/* Handle the 'g' command which is to send the contents of the registers back to gdb.

    Command Format:     g
    Response Format:    xxxxxxxxyyyyyyyy...
    
    Where xxxxxxxx is the hexadecimal representation of the 32-bit R0 register.
          yyyyyyyy is the hexadecimal representation of the 32-bit R1 register.
          ... and so on through the members of the SContext structure.
*/
uint32_t HandleRegisterReadCommand(void)
{
    Platform_CopyContextToBuffer(GetInitializedBuffer());

    return 0;
}