Added breakpoint commands to debugger

This commit is contained in:
OmniaX-Dev 2025-10-21 07:27:05 +02:00
parent 7f3530ea78
commit 0ab126ad33
7 changed files with 74 additions and 7 deletions

View file

@ -1 +1 @@
1621 1622

Binary file not shown.

View file

@ -4,7 +4,6 @@
.header KERNEL0_BOOT .header KERNEL0_BOOT
@include <../../sdk/bios_api.dss> @include <../../sdk/bios_api.dss>
@include <../../sdk/palette.dss>
@include <../drivers/keyboard_driver.dss> @include <../drivers/keyboard_driver.dss>
@include <../drivers/display_driver.dss> @include <../drivers/display_driver.dss>
@include <memory.dss> @include <memory.dss>

View file

@ -1,5 +1,5 @@
## -- ## --
## -- This file is automatically generated by the DragonAssembler (version 0.4.1620) ## -- This file is automatically generated by the DragonAssembler (version 0.4.1622)
## -- Please do not modify this file in any way. ## -- Please do not modify this file in any way.
## -- ## --

View file

@ -66,8 +66,6 @@ namespace dragon
{ {
ostd::String line = lines[i]; ostd::String line = lines[i];
line.trim(); line.trim();
if (line.new_toLower().contains("memory.dss"))
std::cout << line << "\n";
if (line.new_toLower().startsWith("@include") && line.len() > 8) if (line.new_toLower().startsWith("@include") && line.len() > 8)
{ {
line.substr(8).trim(); line.substr(8).trim();

View file

@ -126,6 +126,34 @@ namespace dragon
return out; return out;
} }
void Debugger::Utils::removeBreakPoint(uint16_t addr)
{
if (debugger.manualBreakPoints.size() == 0)
return;
int32_t i = 0;
for ( ; i < debugger.manualBreakPoints.size(); i++)
{
if (debugger.manualBreakPoints[i] == addr)
break;
}
if (i >= debugger.manualBreakPoints.size())
return;
debugger.manualBreakPoints.erase(debugger.manualBreakPoints.begin() + i);
}
bool Debugger::Utils::isBreakPoint(uint16_t addr)
{
for (const auto& b : debugger.manualBreakPoints)
if (b == addr) return true;
return false;
}
void Debugger::Utils::addBreakPoint(uint16_t addr)
{
debugger.manualBreakPoints.push_back(addr);
}
@ -1530,6 +1558,44 @@ namespace dragon
Display::printPrompt(); Display::printPrompt();
data().command = getCommandInput(); data().command = getCommandInput();
} }
else if (data().command.startsWith("b ") || data().command.startsWith("break "))
{//0x2C1D
data().command.substr(data().command.indexOf(" ") + 1).trim();
uint16_t addr = 0;
bool valid = false;
if (data().command.isNumeric())
{
addr = (uint16_t)data().command.toInt();
valid = true;
}
else if (data().command.startsWith("$"))
{
addr = Utils::findSymbol(debugger.labels, data().command);
if (addr == 0x0000 || addr == 0xFFFF)
output().fg(ostd::ConsoleColors::Red).p("Invalid symbol: ").p(data().command).reset().nl();
else
valid = true;
}
else
{
output().fg(ostd::ConsoleColors::Red).p("Invalid value for <break> command.").reset().nl();
}
if (valid)
{
if (Utils::isBreakPoint(addr))
{
Utils::removeBreakPoint(addr);
output().fg(ostd::ConsoleColors::Yellow).p("Breakpoint removed at address: ").p(ostd::Utils::getHexStr(addr, true, 2)).reset().nl();
}
else
{
Utils::addBreakPoint(addr);
output().fg(ostd::ConsoleColors::Yellow).p("Breakpoint set at address: ").p(ostd::Utils::getHexStr(addr, true, 2)).reset().nl();
}
}
Display::printPrompt();
data().command = getCommandInput();
}
else else
data().command = Display::changeScreen(); data().command = Display::changeScreen();
} }

View file

@ -34,10 +34,11 @@ namespace dragon
DisassemblyList data; DisassemblyList data;
std::vector<uint16_t> trackedAddresses; std::vector<uint16_t> trackedAddresses;
ostd::String command; ostd::String command;
int32_t labelLineLength { 20 }; int32_t labelLineLength { 40 };
uint16_t currentAddress { 0 }; uint16_t currentAddress { 0 };
bool userQuit { false }; bool userQuit { false };
ostd::String disassemblyDirectory { "disassembly" }; ostd::String disassemblyDirectory { "disassembly" };
std::vector<uint16_t> manualBreakPoints;
}; };
struct tCloseEventListener : public ostd::BaseObject struct tCloseEventListener : public ostd::BaseObject
{ {
@ -59,6 +60,9 @@ namespace dragon
static bool isEscapeKeyPressed(bool blocking = false); static bool isEscapeKeyPressed(bool blocking = false);
static ostd::ConsoleOutputHandler& printFullLine(char c, const ostd::ConsoleColors::tConsoleColor& foreground); static ostd::ConsoleOutputHandler& printFullLine(char c, const ostd::ConsoleColors::tConsoleColor& foreground);
static ostd::ConsoleOutputHandler& printFullLine(char c, const ostd::ConsoleColors::tConsoleColor& foreground, const ostd::ConsoleColors::tConsoleColor& background); static ostd::ConsoleOutputHandler& printFullLine(char c, const ostd::ConsoleColors::tConsoleColor& foreground, const ostd::ConsoleColors::tConsoleColor& background);
static void removeBreakPoint(uint16_t addr);
static bool isBreakPoint(uint16_t addr);
static void addBreakPoint(uint16_t addr);
}; };
public: class Display public: class Display
{ {