20 #include "pedigree/kernel/debugger/commands/BreakpointCommand.h" 21 #include "pedigree/kernel/processor/Processor.h" 22 #include "pedigree/kernel/processor/types.h" 37 output =
"[ {0,1,2,3} {address,trigger,size,enable} [{parameter}] ]";
45 if (input ==
"breakpoint")
48 output =
"Current breakpoint status:\n";
51 DebugFlags::FaultType nFt;
57 const char *pFaultType = 0;
60 case DebugFlags::InstructionFetch:
61 pFaultType =
"InstructionFetch";
63 case DebugFlags::DataWrite:
64 pFaultType =
"DataWrite";
66 case DebugFlags::IOReadWrite:
67 pFaultType =
"IOReadWrite";
69 case DebugFlags::DataReadWrite:
70 pFaultType =
"DataReadWrite";
74 const char *pEnabled =
"disabled";
79 output.append(nAddress, 16,
sizeof(uintptr_t) * 2,
'0');
81 output.append(pFaultType);
85 output.append(pEnabled);
93 int32_t nBp = input.intValue();
97 output =
"Invalid breakpoint number.\n";
101 bool bSpaceFound =
false;
102 for (
size_t i = 0; i < inputCopy.length(); i++)
103 if (inputCopy[i] ==
' ')
105 inputCopy.stripFirst(i + 1);
112 output =
"Command not recognised\n";
119 for (
size_t i = 0; i < inputCopy.length(); i++)
120 if (inputCopy[i] ==
' ')
122 command = inputCopy.left(i);
123 inputCopy.stripFirst(i + 1);
130 output =
"Command not recognised\n";
137 for (
size_t i = 0; i < inputCopy.length(); i++)
138 if (inputCopy[i] ==
' ')
140 argument = inputCopy.left(i);
145 argument = inputCopy;
147 if (argument.length() == 0)
149 output =
"Parameter had zero length!\n";
154 DebugFlags::FaultType nFaultType;
160 if (command ==
"address")
162 address = argument.intValue();
165 else if (command ==
"trigger")
168 else if (command ==
"enabled")
170 if (argument ==
"yes" || argument ==
"true")
173 nBp, address, nFaultType, nLength);
182 output =
"Unrecognised command.\n";
static uintptr_t getDebugBreakpoint(size_t nBpNumber, DebugFlags::FaultType &nFaultType, size_t &nLength, bool &bEnabled)
void autocomplete(const HugeStaticString &input, HugeStaticString &output)
static void enableDebugBreakpoint(size_t nBpNumber, uintptr_t nLinearAddress, DebugFlags::FaultType nFaultType, size_t nLength)
static void disableDebugBreakpoint(size_t nBpNumber)
static size_t getDebugBreakpointCount()
bool execute(const HugeStaticString &input, HugeStaticString &output, InterruptState &state, DebuggerIO *screen)