console::debugger is no longer required
This commit is contained in:
parent
5b50556273
commit
96c7cf41bd
3 changed files with 7 additions and 36 deletions
27
console.cpp
27
console.cpp
|
@ -270,33 +270,6 @@ std::string console::read_line(const std::string & prompt)
|
||||||
return edit_lines_hist.at(line_nr);
|
return edit_lines_hist.at(line_nr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void console::debug(const std::string fmt, ...)
|
|
||||||
{
|
|
||||||
#if defined(BUILD_FOR_RP2040)
|
|
||||||
char buffer[128];
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
va_start(ap, fmt);
|
|
||||||
vsnprintf(buffer, sizeof buffer, fmt.c_str(), ap);
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
put_string_lf(buffer);
|
|
||||||
#else
|
|
||||||
char *buffer = nullptr;
|
|
||||||
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, fmt);
|
|
||||||
|
|
||||||
vasprintf(&buffer, fmt.c_str(), ap);
|
|
||||||
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
put_string_lf(buffer);
|
|
||||||
|
|
||||||
free(buffer);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void console::put_char(const char c)
|
void console::put_char(const char c)
|
||||||
{
|
{
|
||||||
put_char_ll(c);
|
put_char_ll(c);
|
||||||
|
|
|
@ -79,8 +79,6 @@ public:
|
||||||
void put_string(const std::string & what);
|
void put_string(const std::string & what);
|
||||||
virtual void put_string_lf(const std::string & what) = 0;
|
virtual void put_string_lf(const std::string & what) = 0;
|
||||||
|
|
||||||
void debug(const std::string fmt, ...);
|
|
||||||
|
|
||||||
virtual void resize_terminal() = 0;
|
virtual void resize_terminal() = 0;
|
||||||
|
|
||||||
virtual void refresh_virtual_terminal() = 0;
|
virtual void refresh_virtual_terminal() = 0;
|
||||||
|
|
14
debugger.cpp
14
debugger.cpp
|
@ -82,10 +82,10 @@ std::optional<disk_backend *> select_disk_file(console *const c)
|
||||||
#if IS_POSIX
|
#if IS_POSIX
|
||||||
c->put_string_lf("Files in current directory: ");
|
c->put_string_lf("Files in current directory: ");
|
||||||
#else
|
#else
|
||||||
c->debug("MISO: %d", int(MISO));
|
c->put_string_lf(format("MISO: %d", int(MISO)));
|
||||||
c->debug("MOSI: %d", int(MOSI));
|
c->put_string_lf(format("MOSI: %d", int(MOSI)));
|
||||||
c->debug("SCK : %d", int(SCK ));
|
c->put_string_lf(format("SCK : %d", int(SCK )));
|
||||||
c->debug("SS : %d", int(SS ));
|
c->put_string_lf(format("SS : %d", int(SS )));
|
||||||
|
|
||||||
c->put_string_lf("Files on SD-card:");
|
c->put_string_lf("Files on SD-card:");
|
||||||
|
|
||||||
|
@ -96,9 +96,9 @@ std::optional<disk_backend *> select_disk_file(console *const c)
|
||||||
if (!SD.begin(SS, SD_SCK_MHZ(15))) {
|
if (!SD.begin(SS, SD_SCK_MHZ(15))) {
|
||||||
auto err = SD.sdErrorCode();
|
auto err = SD.sdErrorCode();
|
||||||
if (err)
|
if (err)
|
||||||
c->debug("SDerror: 0x%x, data: 0x%x", err, SD.sdErrorData());
|
c->put_string_lf(format("SDerror: 0x%x, data: 0x%x", err, SD.sdErrorData()));
|
||||||
else
|
else
|
||||||
c->debug("Failed to initialize SD card");
|
c->put_string_lf("Failed to initialize SD card");
|
||||||
|
|
||||||
return { };
|
return { };
|
||||||
}
|
}
|
||||||
|
@ -355,7 +355,7 @@ int disassemble(cpu *const c, console *const cnsl, const uint16_t pc, const bool
|
||||||
);
|
);
|
||||||
|
|
||||||
if (cnsl)
|
if (cnsl)
|
||||||
cnsl->debug(result);
|
cnsl->put_string_lf(result);
|
||||||
else
|
else
|
||||||
DOLOG(debug, false, "%s", result.c_str());
|
DOLOG(debug, false, "%s", result.c_str());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue