The Pedigree Project
0.1
src
system
include
pedigree
kernel
debugger
commands
TraceCommand.h
1
/*
2
* Copyright (c) 2008-2014, Pedigree Developers
3
*
4
* Please see the CONTRIB file in the root of the source tree for a full
5
* list of contributors.
6
*
7
* Permission to use, copy, modify, and distribute this software for any
8
* purpose with or without fee is hereby granted, provided that the above
9
* copyright notice and this permission notice appear in all copies.
10
*
11
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
*/
19
20
#ifndef TRACECOMMAND_H
21
#define TRACECOMMAND_H
22
23
#include "pedigree/kernel/debugger/Backtrace.h"
24
#include "pedigree/kernel/debugger/DebuggerCommand.h"
25
#include "pedigree/kernel/debugger/DebuggerIO.h"
26
#include "pedigree/kernel/debugger/Scrollable.h"
27
#include "pedigree/kernel/processor/state_forward.h"
28
#include "pedigree/kernel/processor/types.h"
29
#include "pedigree/kernel/utilities/StaticString.h"
30
39
class
TraceCommand
:
public
DebuggerCommand
{
40
public
:
44
TraceCommand
();
45
49
~TraceCommand
();
50
54
void
autocomplete
(
const
HugeStaticString
& input,
HugeStaticString
& output);
55
56
void
setInterface(
int
nInterface);
57
61
bool
execute
(
const
HugeStaticString
& input,
HugeStaticString
& output, InterruptState& state,
62
DebuggerIO
* screen);
63
67
const
NormalStaticString
getString
() {
68
return
NormalStaticString
(
"trace"
);
69
}
70
75
int
execTrace
() {
76
return
m_nExec
;
77
}
78
79
private
:
80
class
Disassembly
:
public
Scrollable
{
81
public
:
82
Disassembly
(InterruptState& state);
83
~Disassembly
() {}
84
const
char
* getLine1(
size_t
index,
DebuggerIO::Colour
& colour,
DebuggerIO::Colour
& bgColour);
85
const
char
* getLine2(
size_t
index,
size_t
& colOffset,
DebuggerIO::Colour
& colour,
86
DebuggerIO::Colour
& bgColour);
87
size_t
getLineCount();
88
89
private
:
90
size_t
m_nInstructions;
91
uintptr_t m_nFirstInstruction;
92
uintptr_t m_nIp;
100
size_t
m_LastLine
;
101
uintptr_t m_LastInstructionLocation;
102
};
103
104
class
Registers
:
public
Scrollable
{
105
public
:
106
Registers
(InterruptState& state);
107
~Registers
() {}
108
const
char
* getLine1(
size_t
index,
DebuggerIO::Colour
& colour,
DebuggerIO::Colour
& bgColour);
109
const
char
* getLine2(
size_t
index,
size_t
& colOffset,
DebuggerIO::Colour
& colour,
110
DebuggerIO::Colour
& bgColour);
111
size_t
getLineCount();
112
113
private
:
114
InterruptState& m_State;
115
};
116
117
class
Stacktrace
:
public
Scrollable
{
118
public
:
119
Stacktrace
(InterruptState& state);
120
~Stacktrace
() {}
121
const
char
* getLine1(
size_t
index,
DebuggerIO::Colour
& colour,
DebuggerIO::Colour
& bgColour);
122
const
char
* getLine2(
size_t
index,
size_t
& colOffset,
DebuggerIO::Colour
& colour,
123
DebuggerIO::Colour
& bgColour);
124
size_t
getLineCount();
125
126
private
:
127
Backtrace
m_Bt;
128
};
129
130
void
drawBackground(
size_t
nCols,
size_t
nLines,
DebuggerIO
* pScreen);
131
136
int
m_nExec
;
137
int
m_nInterface;
138
};
139
142
#endif
Backtrace
Definition
Backtrace.h:32
DebuggerCommand
Definition
DebuggerCommand.h:37
DebuggerIO
Definition
DebuggerIO.h:49
DebuggerIO::Colour
Colour
Definition
DebuggerIO.h:54
Scrollable
Definition
Scrollable.h:29
StaticString
Definition
StaticString.h:49
TraceCommand::Disassembly
Definition
TraceCommand.h:80
TraceCommand::Disassembly::m_LastLine
size_t m_LastLine
Definition
TraceCommand.h:100
TraceCommand::Registers
Definition
TraceCommand.h:104
TraceCommand::Stacktrace
Definition
TraceCommand.h:117
TraceCommand
Definition
TraceCommand.h:39
TraceCommand::getString
const NormalStaticString getString()
Definition
TraceCommand.h:67
TraceCommand::autocomplete
void autocomplete(const HugeStaticString &input, HugeStaticString &output)
Definition
TraceCommand.cc:32
TraceCommand::m_nExec
int m_nExec
Definition
TraceCommand.h:136
TraceCommand::~TraceCommand
~TraceCommand()
Definition
TraceCommand.cc:30
TraceCommand::execTrace
int execTrace()
Definition
TraceCommand.h:75
TraceCommand::execute
bool execute(const HugeStaticString &input, HugeStaticString &output, InterruptState &state, DebuggerIO *screen)
Definition
TraceCommand.cc:38
TraceCommand::TraceCommand
TraceCommand()
Definition
TraceCommand.cc:28
Generated on Sat Oct 3 2026 06:38:07 for The Pedigree Project by
1.9.8