Exemple #1
0
/* 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();
}
Exemple #2
0
/* Send file stat request to gdb on behalf of mbed LocalFileSystem to get file length.

    Data Format: Fstat,ff,bb
    
    Where ff is the hex value of the file descriptor to be closed.
          bb is the hex representation of the address of the stat structure to be filled in.
*/
int IssueGdbFileStatRequest(uint32_t fileDescriptor, uint32_t fileStatBuffer)
{
    static const char  gdbStatCommand[] = "Ffstat,";
    Buffer*            pBuffer = GetInitializedBuffer();

    Buffer_WriteString(pBuffer, gdbStatCommand);
    Buffer_WriteUIntegerAsHex(pBuffer, fileDescriptor);
    Buffer_WriteChar(pBuffer, ',');
    Buffer_WriteUIntegerAsHex(pBuffer, fileStatBuffer);
    
    SendPacketToGdb();
    return processGdbFileResponseCommands();
}
Exemple #3
0
/* 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();
}
Exemple #4
0
/* 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();
}
Exemple #5
0
/* 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();
}
Exemple #6
0
/* 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;
}
Exemple #7
0
void WriteHexValueToGdbConsole(uint32_t Value)
{
    Buffer BufferObject;
    char   StringBuffer[11];
    
    Buffer_Init(&BufferObject, StringBuffer, sizeof(StringBuffer));
    Buffer_WriteString(&BufferObject, "0x");
    Buffer_WriteUIntegerAsHex(&BufferObject, Value);
    Buffer_WriteChar(&BufferObject, '\0');
    
    WriteStringToGdbConsole(StringBuffer);
}
Exemple #8
0
/* 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();
}