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

p command More...

#include "pch.h"

Functions

VOID CommandPHelp ()
 help of the p command
VOID CommandP (vector< CommandToken > CommandTokens, string Command)
 handler of p 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

p command

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.1
Date
2020-12-29

Function Documentation

◆ CommandP()

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

handler of p command

Parameters
CommandTokens
Command
Returns
VOID
54{
55 UINT32 StepCount;
57
58 //
59 // Validate the commands
60 //
61 if (CommandTokens.size() != 1 && CommandTokens.size() != 2)
62 {
63 ShowMessages("incorrect use of the '%s'\n\n",
64 GetCaseSensitiveStringFromCommandToken(CommandTokens.at(0)).c_str());
66 return;
67 }
68
69 //
70 // Set type of request
71 //
73
74 //
75 // Check if the command has a counter parameter
76 //
77 if (CommandTokens.size() == 2)
78 {
79 if (!ConvertTokenToUInt32(CommandTokens.at(1), &StepCount))
80 {
81 ShowMessages("please specify a correct hex value for [count]\n\n");
83 return;
84 }
85 }
86 else
87 {
88 StepCount = 1;
89 }
90
91 //
92 // Check if the remote serial debuggee or user debugger are paused or not
93 //
95 {
96 //
97 // Check if the thread is paused or not
98 //
100 {
101 ShowMessages("the target process is running, use the "
102 "'pause' command or press CTRL+C to pause the process\n");
103 return;
104 }
105
106 //
107 // Indicate that we're instrumenting
108 //
110
111 for (SIZE_T i = 0; i < StepCount; i++)
112 {
113 //
114 // For logging purpose
115 //
116 // ShowMessages("percentage : %f %% (%x)\n", 100.0 * (i /
117 // (float)StepCount), i);
118 //
119
120 //
121 // Perform Step-over
122 //
124
125 if (CompareLowerCaseStrings(CommandTokens.at(0), "pr"))
126 {
127 //
128 // Show registers
129 //
131
132 if (i != StepCount - 1)
133 {
134 ShowMessages("\n");
135 }
136 }
137
138 //
139 // Check if user pressed CTRL+C
140 //
142 {
143 break;
144 }
145 }
146
147 //
148 // We're not instrumenting instructions anymore
149 //
151 }
152 else
153 {
154 ShowMessages("err, stepping (p) is not valid in the current context, you "
155 "should connect to a debuggee\n");
156 }
157}
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
@ DEBUGGER_REMOTE_STEPPING_REQUEST_STEP_OVER
Definition RequestStructures.h:1050
enum _DEBUGGER_REMOTE_STEPPING_REQUEST DEBUGGER_REMOTE_STEPPING_REQUEST
stepping and tracking types
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 CommandPHelp()
help of the p command
Definition p.cpp:27
BOOLEAN HyperDbgRegisterShowAll()
handler of r show all registers
Definition r.cpp:354
BOOLEAN SteppingStepOver()
Perform Step-over.
Definition steppings.cpp:117

◆ CommandPHelp()

VOID CommandPHelp ( )

help of the p command

Returns
VOID
28{
29 ShowMessages(
30 "p : executes a single instruction (step) and optionally displays the "
31 "resulting values of all registers and flags.\n\n");
32
33 ShowMessages("syntax : \tp\n");
34 ShowMessages("syntax : \tp [Count (hex)]\n");
35 ShowMessages("syntax : \tpr\n");
36 ShowMessages("syntax : \tpr [Count (hex)]\n");
37
38 ShowMessages("\n");
39 ShowMessages("\t\te.g : p\n");
40 ShowMessages("\t\te.g : pr\n");
41 ShowMessages("\t\te.g : pr 1f\n");
42}

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).