Skip to content

Commit

Permalink
Make work for GDB 7.5 and fix a bug.
Browse files Browse the repository at this point in the history
	* src/GdbServer.cpp: Include inttypes.h, first defining
	__STDC_FORMAT_MACROS so we get the printf/scanf macros. Update
	copyright date.
	(rspQuery): Add qAttached and all tracepoint packets.
	(rspSet): Add QTDV, QTEnable, QTDisable, QTDisconnected, QTSave,
	QTBuffer and QTNotes to list of tracepoint packets which are ignored.
	(rspRemoveMatchpoint, rspInsertMatchpoint): Use correct scanf
	field for uint32_t.
	* src/RspConnection.cpp: Update copyright date.
	* src/SimProc.cpp: Update copyright date.
	(parseSpecificMemoryClause): Use wordSize when
	calling MemoryBlock for word array.
  • Loading branch information
jeremybennett committed Apr 30, 2013
1 parent d9c0986 commit 6ab2a3e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 20 deletions.
25 changes: 20 additions & 5 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
2009-04-12 Jeremy Bennett <[email protected]>
2012-04-30 Jeremy Bennett <[email protected]>

* src/GdbServer.cpp: Include inttypes.h, first defining
__STDC_FORMAT_MACROS so we get the printf/scanf macros. Update
copyright date.
(rspQuery): Add qAttached and all tracepoint packets.
(rspSet): Add QTDV, QTEnable, QTDisable, QTDisconnected, QTSave,
QTBuffer and QTNotes to list of tracepoint packets which are ignored.
(rspRemoveMatchpoint, rspInsertMatchpoint): Use correct scanf
field for uint32_t.
* src/RspConnection.cpp: Update copyright date.
* src/SimProc.cpp: Update copyright date.
(parseSpecificMemoryClause): Use wordSize when
calling MemoryBlock for word array.

2012-04-29 Jeremy Bennett <[email protected]>

* src/RspConnection.cpp: include unistd.h, needed for close ().

2009-04-12 Jeremy Bennett <[email protected]>
2012-04-29 Jeremy Bennett <[email protected]>

* README: Created as a symbolic link to README.md to keep autoconf
happy.
* README.md: Added instructions about autoreconf.
* INSTALL: Replaced with standard installation instructions.

2009-04-12 Jeremy Bennett <[email protected]>
2012-04-29 Jeremy Bennett <[email protected]>

* README.md: Even better use of MarkDown!

2009-04-12 Jeremy Bennett <[email protected]>
2012-04-29 Jeremy Bennett <[email protected]>

* .gitignore: New file.
* README.md: Renamed from README an updated to make best use of
MarkDown.

2009-04-09 Jeremy Bennett <[email protected]>
2009-04-12 Jeremy Bennett <[email protected]>

* src/RspProxyMain.cpp, src/RspProxyMain.h: created by renaming
src/RspDummyMain.cpp and src/RspDummyMain.h respectively.
Expand Down
60 changes: 48 additions & 12 deletions src/GdbServer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// GDB RSP server: implementation

// Copyright (C) 2009 Embecosm Limited <[email protected]>
// Copyright (C) 2009, 2013 Embecosm Limited <[email protected]>

// Contributor Jeremy Bennett <[email protected]>

Expand All @@ -21,11 +21,12 @@

// ----------------------------------------------------------------------------

// $Id$

#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>

#include "GdbServer.h"
#include "Utils.h"
Expand All @@ -35,6 +36,8 @@ using std::cerr;
using std::dec;
using std::endl;
using std::hex;
using std::string;


//-----------------------------------------------------------------------------
//! Constructor for the GDB RSP server.
Expand Down Expand Up @@ -755,6 +758,29 @@ GdbServer::rspQuery ()
pkt->packStr ("");
rsp->putPkt (pkt);
}
else if (0 == strncmp ("qAttached", pkt->data, strlen ("qAttached")))
{
// Assume we are attaching to an existing process
pkt->packStr ("1");
rsp->putPkt (pkt);
}
else if ((0 == strncmp ("qTMinFTPILen", pkt->data, strlen ("qTMinFTPILen")))
|| (0 == strncmp ("qTStatus", pkt->data, strlen ("qTStatus")))
|| (0 == strncmp ("qTP:", pkt->data, strlen ("qTP:")))
|| (0 == strncmp ("qTV:", pkt->data, strlen ("qTV:")))
|| (0 == strncmp ("qTfP", pkt->data, strlen ("qTfP")))
|| (0 == strncmp ("qTsP", pkt->data, strlen ("qTsP")))
|| (0 == strncmp ("qTfV", pkt->data, strlen ("qTfV")))
|| (0 == strncmp ("qTsV", pkt->data, strlen ("qTsV")))
|| (0 == strncmp ("qTfSTM", pkt->data, strlen ("qTfSTM")))
|| (0 == strncmp ("qTsSTM", pkt->data, strlen ("qTsSTM")))
|| (0 == strncmp ("qTSTMat:", pkt->data, strlen ("qTSTMat:")))
|| (0 == strncmp ("qTBuffer:", pkt->data, strlen ("qTBuffer:"))))
{
// All tracepoint features are not supported.
pkt->packStr ("");
rsp->putPkt (pkt);
}
else
{
cerr << "Unrecognized RSP query: ignored" << endl;
Expand Down Expand Up @@ -800,12 +826,20 @@ GdbServer::rspSet ()
pkt->packStr ("");
rsp->putPkt (pkt);
}
else if ((0 == strncmp ("QTDP", pkt->data, strlen ("QTDP"))) ||
(0 == strncmp ("QFrame", pkt->data, strlen ("QFrame"))) ||
(0 == strcmp ("QTStart", pkt->data)) ||
(0 == strcmp ("QTStop", pkt->data)) ||
(0 == strcmp ("QTinit", pkt->data)) ||
(0 == strncmp ("QTro", pkt->data, strlen ("QTro"))))
else if ((0 == strncmp ("QTDP", pkt->data, strlen ("QTDP")))
|| (0 == strncmp ("QTDV:", pkt->data, strlen ("QTDV:")))
|| (0 == strncmp ("QFrame", pkt->data, strlen ("QFrame")))
|| (0 == strcmp ("QTStart", pkt->data))
|| (0 == strcmp ("QTStop", pkt->data))
|| (0 == strncmp ("QTEnable:", pkt->data, strlen ("QTEnable:")))
|| (0 == strncmp ("QTDisable:", pkt->data, strlen ("QTDisable:")))
|| (0 == strcmp ("QTinit", pkt->data))
|| (0 == strncmp ("QTro", pkt->data, strlen ("QTro")))
|| (0 == strncmp ("QTDisconnected:", pkt->data,
strlen ("QTDisconnected:")))
|| (0 == strncmp ("QTSave:", pkt->data, strlen ("QTSave:")))
|| (0 == strncmp ("QTBuffer:", pkt->data, strlen ("QTBuffer:")))
|| (0 == strncmp ("QTNotes:", pkt->data, strlen ("QTNotes:"))))
{
// All tracepoint features are not supported. This reply is really only
// needed to 'QTDP', since with that the others should not be
Expand Down Expand Up @@ -994,7 +1028,8 @@ GdbServer::rspRemoveMatchpoint ()
uint8_t *instrVec; // Instruction as byte vector

// Break out the instruction
if (3 != sscanf (pkt->data, "z%1d,%lx,%1d", (int *)&type, &addr, &len))
if (3 != sscanf (pkt->data, "z%1d,%" SCNx32 ",%1d", (int *)&type, &addr,
&len))
{
cerr << "Warning: RSP matchpoint deletion request not "
<< "recognized: ignored" << endl;
Expand Down Expand Up @@ -1171,10 +1206,11 @@ GdbServer::rspInsertMatchpoint ()
uint8_t *instrVec; // Instruction as byte vector

// Break out the instruction
if (3 != sscanf (pkt->data, "Z%1d,%lx,%1d", (int *)&type, &addr, &len))
if (3 != sscanf (pkt->data, "Z%1d,%" SCNx32 ",%1d", (int *)&type, &addr,
&len))
{
cerr << "Warning: RSP matchpoint insertion request not "
<< "recognized: ignored" << endl;
<< " recognized: ignored" << endl;
pkt->packStr ("E01");
rsp->putPkt (pkt);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/RspConnection.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ----------------------------------------------------------------------------
// Remote Serial Protocol connection: implementation

// Copyright (C) 2009 Embecosm Limited <[email protected]>
// Copyright (C) 2009, 2013 Embecosm Limited <[email protected]>

// Contributor Jeremy Bennett <[email protected]>

Expand Down
4 changes: 2 additions & 2 deletions src/SimProc.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ----------------------------------------------------------------------------
// Simulated Processor: implementation

// Copyright (C) 2009 Embecosm Limited <[email protected]>
// Copyright (C) 2009, 2013 Embecosm Limited <[email protected]>

// Contributor Jeremy Bennett <[email protected]>

Expand Down Expand Up @@ -1077,7 +1077,7 @@ SimProc::parseSpecificMemoryClause (ScannerObject memoryType)
uint32_t wordSize = byteSize / BYTES_PER_WORD;
uint32_t *wordArray = new uint32_t [wordSize];
parseMemoryValues (memoryType, (int)wordSize, (void *)wordArray);
memList = new MemoryBlock (memList, baseAddr, byteSize, wordArray,
memList = new MemoryBlock (memList, baseAddr, wordSize, wordArray,
isLittleEndianP);
delete [] wordArray;
}
Expand Down

0 comments on commit 6ab2a3e

Please sign in to comment.