ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
GDBCore.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2//
3// This file is part of ETISS. It is licensed under the BSD 3-Clause License; you may not use this file except in
4// compliance with the License. You should have received a copy of the license along with this project. If not, see the
5// LICENSE file.
15#include <iostream>
16#include <vector>
17#include <string>
18#include <fstream>
19#include <streambuf>
20#include <boost/filesystem.hpp>
21
23#include "etiss/Misc.h"
24#include "etiss/Format.h"
25#include "etiss/jit/CPU.h"
26
27using namespace etiss::plugin::gdb;
28
30std::string GDBCore::mapRegister(unsigned index)
31{
32 return "";
33}
34unsigned GDBCore::mapRegister(std::string name)
35{
36 return INVALIDMAPPING;
37}
39{
40 return 0;
41}
43{
44 return false;
45}
47{
48 return cpu->instructionPointer;
49}
50
51std::string getXMLDirectory(std::string archName)
52{
53 std::string xmlDir = etiss::installDir() + "/xml/" + archName;
54 return xmlDir;
55}
56
57std::string GDBCore::getXMLContents(ETISS_CPU *cpu, std::string archName, std::string fname)
58{
59 std::string xmlFile = getXMLDirectory(archName) + "/" + fname;
60 if (!boost::filesystem::exists(xmlFile))
61 {
63 etiss::fmt::format("Could not find XML GDB target descriptions for arch: {}", archName));
64 return "";
65 }
66 std::ifstream t(xmlFile);
67 std::string xmlContent((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
68 return xmlContent;
69}
std::string getXMLDirectory(std::string archName)
Definition GDBCore.cpp:51
general configuration and logging
static const unsigned INVALIDMAPPING
Definition GDBCore.h:70
virtual etiss::uint64 getInstructionPointer(ETISS_CPU *cpu)
allows to calculate the index of the instruction to be executed for breakpoint checks.
Definition GDBCore.cpp:46
virtual unsigned mappedRegisterCount()
returns the number of registers in the gdb defined register list
Definition GDBCore.cpp:38
virtual std::string mapRegister(unsigned index)
the returned string identifies the register at the given index as defined by gdb.
Definition GDBCore.cpp:30
virtual bool isLittleEndian()
returns true if the values are expected to be little endian
Definition GDBCore.cpp:42
virtual std::string getXMLContents(ETISS_CPU *cpu, std::string archName, std::string fname)
Definition GDBCore.cpp:57
std::string installDir()
Get ETISS installation directory.
Definition Misc.cpp:554
@ WARNING
Definition Misc.h:86
void log(Verbosity level, std::string msg)
write log message at the given level.
Definition Misc.cpp:94
basic cpu state structure needed for execution of any cpu architecture.
Definition CPU.h:51
etiss_uint64 instructionPointer
pointer to next instruction.
Definition CPU.h:54