risc-v-tlm/inc/Debug.h

53 lines
1.0 KiB
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"
2021-11-30 03:37:20 +08:00
namespace riscv_tlm {
2021-02-21 20:49:05 +08:00
2021-11-30 03:37:20 +08:00
class Debug : sc_core::sc_module {
public:
Debug(riscv_tlm::RV32 *cpu, Memory *mem);
2021-11-30 03:37:20 +08:00
~Debug() override;
private:
static std::string compute_checksum_string(const std::string &msg);
void send_packet(int m_conn, const std::string &msg);
std::string receive_packet();
void handle_gdb_loop();
static constexpr size_t bufsize = 1024 * 8;
char iobuf[bufsize]{};
int conn;
riscv_tlm::RV32 *dbg_cpu;
2021-11-30 03:37:20 +08:00
Memory *dbg_mem;
tlm::tlm_generic_payload dbg_trans;
unsigned char pyld_array[128]{};
std::unordered_set<uint32_t> breakpoints;
};
}
2021-02-21 20:49:05 +08:00
#endif /* INC_DEBUG_H_ */