risc-v-tlm/inc/Debug.h

47 lines
885 B
C
Raw Normal View History

2021-02-21 20:49:05 +08:00
/*!
\file Debug.h
\brief GDB connector
\author Màrius Montón
\date February 2021
*/
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef INC_DEBUG_H_
#define INC_DEBUG_H_
#define SC_INCLUDE_DYNAMIC_PROCESSES
#include "systemc"
#include "tlm.h"
#include "tlm_utils/simple_initiator_socket.h"
#include "CPU.h"
#include "Memory.h"
class Debug: sc_core::sc_module {
public:
2021-02-21 21:04:11 +08:00
Debug(CPU *cpu, Memory* mem);
2021-04-26 01:52:12 +08:00
~Debug() override;
2021-02-21 20:49:05 +08:00
private:
2021-04-26 01:52:12 +08:00
static std::string compute_checksum_string(const std::string &msg);
2021-04-26 06:20:29 +08:00
void send_packet(int m_conn, const std::string &msg);
2021-02-21 20:49:05 +08:00
std::string receive_packet();
void handle_gdb_loop();
static constexpr size_t bufsize = 1024 * 8;
char iobuf[bufsize]{};
int conn;
CPU *dbg_cpu;
Memory *dbg_mem;
tlm::tlm_generic_payload dbg_trans;
2021-04-26 06:20:29 +08:00
unsigned char pyld_array[128]{};
2021-02-21 20:49:05 +08:00
std::unordered_set<uint32_t> breakpoints;
};
#endif /* INC_DEBUG_H_ */