HyperDbg Debugger
Loading...
Searching...
No Matches
i.cpp File Reference

i command More...

#include "pch.h"

Functions

VOID CommandIHelp ()
 help of the i command
VOID CommandI (vector< CommandToken > CommandTokens, string Command)
 handler of i command

Variables

BOOLEAN g_IsSerialConnectedToRemoteDebuggee
 Shows if the debugger was connected to remote debuggee over (A remote guest).
BOOLEAN g_IsInstrumentingInstructions
 Shows whether the user is running 't', 'p', or 'i' command.
ACTIVE_DEBUGGING_PROCESS g_ActiveProcessDebuggingState
 State of active debugging thread.

Detailed Description

i command

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.1
Date
2021-03-19

Function Documentation

◆ CommandI()

VOID CommandI ( vector< CommandToken > CommandTokens,
string Command )

handler of i command

Parameters
CommandTokens
Command
Returns
VOID
57{
58 UINT32 StepCount;
59
60 //
61 // Validate the commands
62 //
63 if (CommandTokens.size() != 1 && CommandTokens.size() != 2)
64 {
65 ShowMessages("incorrect use of the '%s'\n\n",
66 GetCaseSensitiveStringFromCommandToken(CommandTokens.at(0)).c_str());
68 return;
69 }
70
71 //
72 // Check if we're in VMI mode
73 //
75 {
76 ShowMessages("the instrumentation step-in is only supported in Debugger Mode\n");
77 return;
78 }
79
80 //
81 // Check if the command has a counter parameter
82 //
83 if (CommandTokens.size() == 2)
84 {
85 if (!ConvertTokenToUInt32(CommandTokens.at(1), &StepCount))
86 {
87 ShowMessages("please specify a correct hex value for [count]\n\n");
89 return;
90 }
91 }
92 else
93 {
94 StepCount = 1;
95 }
96
97 //
98 // Check if the remote serial debuggee or user debugger are paused or not
99 //
101 {
102 //
103 // Indicate that we're instrumenting
104 //
106
107 for (SIZE_T i = 0; i < StepCount; i++)
108 {
109 //
110 // For logging purpose
111 //
112 // ShowMessages("percentage : %f %% (%x)\n", 100.0 * (i /
113 // (float)StepCount), i);
114 //
115
116 //
117 // It's stepping over serial connection in kernel debugger
118 //
120
121 if (CompareLowerCaseStrings(CommandTokens.at(0), "ir"))
122 {
123 //
124 // Show registers
125 //
127
128 if (i != StepCount - 1)
129 {
130 ShowMessages("\n");
131 }
132 }
133
134 //
135 // Check if user pressed CTRL+C
136 //
138 {
139 break;
140 }
141 }
142
143 //
144 // We're not instrumenting instructions anymore
145 //
147 }
148 else
149 {
150 ShowMessages("err, stepping (i) is not valid in the current context, you "
151 "should connect to a debuggee\n");
152 }
153}
BOOLEAN g_IsSerialConnectedToRemoteDebuggee
Shows if the debugger was connected to remote debuggee over (A remote guest).
Definition globals.h:253
ACTIVE_DEBUGGING_PROCESS g_ActiveProcessDebuggingState
State of active debugging thread.
Definition globals.h:372
#define TRUE
Definition BasicTypes.h:114
#define FALSE
Definition BasicTypes.h:113
unsigned int UINT32
Definition BasicTypes.h:54
std::string GetCaseSensitiveStringFromCommandToken(CommandToken TargetToken)
Get case sensitive string from command token.
Definition common.cpp:467
BOOLEAN CompareLowerCaseStrings(CommandToken TargetToken, const CHAR *StringToCompare)
Compare lower case strings.
Definition common.cpp:503
BOOLEAN ConvertTokenToUInt32(CommandToken TargetToken, PUINT32 Result)
check and convert command token to a 32 bit unsigned integer
Definition common.cpp:546
BOOLEAN g_IsInstrumentingInstructions
Shows whether the user is running 't', 'p', or 'i' command.
Definition globals.h:571
VOID CommandIHelp()
help of the i command
Definition i.cpp:27
BOOLEAN HyperDbgRegisterShowAll()
handler of r show all registers
Definition r.cpp:354
BOOLEAN SteppingInstrumentationStepIn()
Perform Instrumentation Step-in.
Definition steppings.cpp:26

◆ CommandIHelp()

VOID CommandIHelp ( )

help of the i command

Returns
VOID
28{
29 ShowMessages(
30 "i : executes a single instruction (step-in) and guarantees that no "
31 "other instruction is executed other than the displayed instruction "
32 "including user to the kernel (syscalls) and kernel to the user "
33 "(sysrets) and exceptions and page-faults and optionally displays all "
34 "registers and flags' resulting values.\n\n");
35
36 ShowMessages("syntax : \ti\n");
37 ShowMessages("syntax : \ti [Count (hex)]\n");
38 ShowMessages("syntax : \tir\n");
39 ShowMessages("syntax : \tir [Count (hex)]\n");
40
41 ShowMessages("\n");
42 ShowMessages("\t\te.g : i\n");
43 ShowMessages("\t\te.g : ir\n");
44 ShowMessages("\t\te.g : ir 1f\n");
45}

Variable Documentation

◆ g_ActiveProcessDebuggingState

ACTIVE_DEBUGGING_PROCESS g_ActiveProcessDebuggingState
extern

State of active debugging thread.

372{0};

◆ g_IsInstrumentingInstructions

BOOLEAN g_IsInstrumentingInstructions
extern

Shows whether the user is running 't', 'p', or 'i' command.

◆ g_IsSerialConnectedToRemoteDebuggee

BOOLEAN g_IsSerialConnectedToRemoteDebuggee
extern

Shows if the debugger was connected to remote debuggee over (A remote guest).