mirror of
https://github.com/RKX1209/nsemu.git
synced 2024-06-04 22:19:23 -04:00
Add d flag for debugging mode
This commit is contained in:
parent
51f61166ce
commit
8925f1d464
|
@ -970,7 +970,7 @@ static bool DisasLdstCompute64bit(unsigned int size, bool is_signed, unsigned in
|
|||
/* Load/Store exclusive ... literal means PC-relative immediate value */
|
||||
static void DisasLdstExcl(uint32_t insn, DisasCallback *cb) {
|
||||
unsigned int rt = extract32(insn, 0, 5);
|
||||
unsigned int rn = extract32(insn, 5, 5);
|
||||
unsigned int rn = ARMv8::HandleAsSP(extract32(insn, 5, 5));
|
||||
unsigned int rt2 = extract32(insn, 10, 5);
|
||||
unsigned int is_lasr = extract32(insn, 15, 1);
|
||||
unsigned int rs = extract32(insn, 16, 5);
|
||||
|
@ -1003,6 +1003,8 @@ static void DisasLdstExcl(uint32_t insn, DisasCallback *cb) {
|
|||
} else {
|
||||
cb->StoreRegI64(rt, rn, size, false, false);
|
||||
}
|
||||
/* Set status code (success = 0) */
|
||||
cb->MoviI64(rs, 0, true);
|
||||
}
|
||||
} else {
|
||||
bool sf = DisasLdstCompute64bit(size, false, 0);
|
||||
|
|
|
@ -39,9 +39,10 @@ void Interpreter::Run() {
|
|||
if (counter >= estimate){
|
||||
Cpu::DumpMachine ();
|
||||
}
|
||||
if (counter >= estimate + mx)
|
||||
if (counter >= estimate + mx) {
|
||||
break;
|
||||
SingleStep ();
|
||||
}
|
||||
SingleStep ();
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
|
4
Cpu.cpp
4
Cpu.cpp
|
@ -29,7 +29,9 @@ State GetState() {
|
|||
}
|
||||
|
||||
void DumpMachine() {
|
||||
//ARMv8::Dump ();
|
||||
if (is_debug()) {
|
||||
ARMv8::Dump ();
|
||||
}
|
||||
if (TraceOut)
|
||||
ARMv8::DumpJson (TraceOut);
|
||||
}
|
||||
|
|
9
Main.cpp
9
Main.cpp
|
@ -77,7 +77,7 @@ void Banner() {
|
|||
}
|
||||
|
||||
enum optionIndex {
|
||||
UNKNOWN, HELP, ENABLE_TRACE, ENABLE_GDB,
|
||||
UNKNOWN, HELP, ENABLE_TRACE, ENABLE_GDB, ENABLE_DEBUG,
|
||||
};
|
||||
const option::Descriptor usage[] =
|
||||
{
|
||||
|
@ -86,6 +86,7 @@ const option::Descriptor usage[] =
|
|||
{ HELP, 0, "", "help", Arg::None, " --help \tPrint help message" },
|
||||
{ ENABLE_TRACE, 0, "t","enable-trace", Arg::None, " --enable-trace, -t \tEnable Trace" },
|
||||
{ ENABLE_GDB, 0, "s","enable-gdb", Arg::None, " --enable-gdb -s \tEnable GDBServer" },
|
||||
{ ENABLE_DEBUG, 0, "d","enable-debug", Arg::None, " --enable-debug -d \tEnable debug mode" },
|
||||
{ 0, 0, nullptr, nullptr, nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
@ -121,7 +122,11 @@ printUsage:
|
|||
}
|
||||
if (options[ENABLE_GDB].count () > 0) {
|
||||
GdbStub::Init();
|
||||
}
|
||||
}
|
||||
if (options[ENABLE_DEBUG].count () > 0) {
|
||||
enable_debug();
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (options[NSO].count () > 0) {
|
||||
if (options[NSO].count () != 1) {
|
||||
|
|
2
Util.cpp
2
Util.cpp
|
@ -1 +1,3 @@
|
|||
/* nsemu - LGPL - Copyright 2017 rkx1209<rkx1209dev@gmail.com> */
|
||||
#include "Nsemu.hpp"
|
||||
RunLevel curlevel;
|
||||
|
|
|
@ -14,8 +14,15 @@ enum RunLevel {
|
|||
RUN_LEVEL_DEBUG,
|
||||
};
|
||||
|
||||
//static RunLevel curlevel = RUN_LEVEL_DEBUG;
|
||||
static RunLevel curlevel = RUN_LEVEL_RELEASE;
|
||||
extern RunLevel curlevel;
|
||||
|
||||
inline void enable_debug() {
|
||||
curlevel = RUN_LEVEL_DEBUG;
|
||||
}
|
||||
|
||||
inline bool is_debug() {
|
||||
return curlevel == RUN_LEVEL_DEBUG;
|
||||
}
|
||||
|
||||
static void util_print(RunLevel level, FILE *fp, const char *format, ...) {
|
||||
if (curlevel >= level) {
|
||||
|
|
Loading…
Reference in a new issue