Difference between revisions of "Lua:debugProcess"

From Cheat Engine
Jump to navigation Jump to search
(Created page with ''''function''' debugProcess(''Interface'' Optional) starts the debugger for the currently attached process. ===Function Parameters=== {|width="85%" cellpadding="10%" cellpadd…')
 
(Major overhaul of the post.)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
'''function''' debugProcess(''Interface'' Optional)
+
[[Category:Lua]]
 
+
{{CodeBox|'''function''' debugProcess(''interface'' OPTIONAL) ''':''' void}}
starts the debugger for the currently attached process.
 
  
 +
Starts the debugger for the currently opened process without asking the user.
  
 +
If no debugger interface is specified, the default debugger interface is used.
  
 
===Function Parameters===
 
===Function Parameters===
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
 
!align="left"|Parameter
 
!align="left"|Parameter
 
!align="left"|Type
 
!align="left"|Type
 
!style="width: 80%;background-color:white;" align="left"|Description
 
!style="width: 80%;background-color:white;" align="left"|Description
 
|-
 
|-
|Interface
+
|interface
|Integer
+
|Integer OPTIONAL
|Which debugger interface to use.<br>
+
|The debugger interface to use. 0 = default, 1 = Windows debugger, 2 = VEH debugger, 3 = kernel debugger.
0=default<br>
 
1=windows debug<br>
 
2=VEHDebug<br>
 
3=Kerneldebug
 
 
|}
 
|}
  
 +
===Debugger Interfaces===
 +
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
 +
!align="left"|Value
 +
!align="left"|Interface
 +
!style="width: 80%;background-color:white;" align="left"|Description
 +
|-
 +
|0
 +
|Default
 +
|Uses Cheat Engine's default debugger interface.
 +
|-
 +
|1
 +
|Windows debugger
 +
|Uses the Windows debugging interface.
 +
|-
 +
|2
 +
|VEH debugger
 +
|Uses the VEH debugger.
 +
|-
 +
|3
 +
|Kernel debugger
 +
|Uses the kernel debugger.
 +
|}
 +
 +
===Returns===
 +
This function does not return a value.
 +
 +
===Examples===
 +
 +
====Start the debugger with the default interface====
 +
<syntaxhighlight lang="lua" line highlight="1">
 +
debugProcess()
 +
</syntaxhighlight>
 +
 +
====Start the debugger explicitly with the default interface====
 +
<syntaxhighlight lang="lua" line highlight="1">
 +
debugProcess(0)
 +
</syntaxhighlight>
 +
 +
====Start the Windows debugger====
 +
<syntaxhighlight lang="lua" line highlight="1">
 +
debugProcess(1)
 +
</syntaxhighlight>
 +
 +
====Start the VEH debugger====
 +
<syntaxhighlight lang="lua" line highlight="1">
 +
debugProcess(2)
 +
</syntaxhighlight>
 +
 +
====Start the kernel debugger====
 +
<syntaxhighlight lang="lua" line highlight="1">
 +
debugProcess(3)
 +
</syntaxhighlight>
 +
 +
====Open a process and start debugging it====
 +
<syntaxhighlight lang="lua" line highlight="4">
 +
openProcess("target.exe")
 +
 +
if getOpenedProcessID() ~= 0 then
 +
  debugProcess()
 +
end
 +
</syntaxhighlight>
 +
 +
====Choose the debugger interface through a variable====
 +
<syntaxhighlight lang="lua" line highlight="3">
 +
local debuggerInterface = 2
 +
 +
debugProcess(debuggerInterface)
 +
</syntaxhighlight>
 +
 +
====Use a guarded debugger selection====
 +
<syntaxhighlight lang="lua" line highlight="9">
 +
local debuggerInterface = 2
 +
 +
if debuggerInterface < 0 or debuggerInterface > 3 then
 +
  print("Invalid debugger interface")
 +
  return
 +
end
 +
 +
if getOpenedProcessID() ~= 0 then
 +
  debugProcess(debuggerInterface)
 +
end
 +
</syntaxhighlight>
 +
 +
====Ask for the debugger interface====
 +
<syntaxhighlight lang="lua" line highlight="11">
 +
local result, value = inputQuery("Debugger", "Interface: 0=Default, 1=Windows, 2=VEH, 3=Kernel", "0")
 +
 +
if result then
 +
  local debuggerInterface = tonumber(value)
 +
 +
  if debuggerInterface == nil or debuggerInterface < 0 or debuggerInterface > 3 then
 +
    print("Invalid debugger interface")
 +
    return
 +
  end
 +
 +
  debugProcess(debuggerInterface)
 +
end
 +
</syntaxhighlight>
  
== See also ==
+
{{LuaSeeAlso}}
* [[Lua]]
 

Latest revision as of 00:48, 27 June 2026

<> Lua API Reference

function debugProcess(interface OPTIONAL) : void

Starts the debugger for the currently opened process without asking the user.

If no debugger interface is specified, the default debugger interface is used.

Function Parameters[edit]

Parameter Type Description
interface Integer OPTIONAL The debugger interface to use. 0 = default, 1 = Windows debugger, 2 = VEH debugger, 3 = kernel debugger.

Debugger Interfaces[edit]

Value Interface Description
0 Default Uses Cheat Engine's default debugger interface.
1 Windows debugger Uses the Windows debugging interface.
2 VEH debugger Uses the VEH debugger.
3 Kernel debugger Uses the kernel debugger.

Returns[edit]

This function does not return a value.

Examples[edit]

Start the debugger with the default interface[edit]

1 debugProcess()

Start the debugger explicitly with the default interface[edit]

1 debugProcess(0)

Start the Windows debugger[edit]

1 debugProcess(1)

Start the VEH debugger[edit]

1 debugProcess(2)

Start the kernel debugger[edit]

1 debugProcess(3)

Open a process and start debugging it[edit]

1 openProcess("target.exe")
2 
3 if getOpenedProcessID() ~= 0 then
4   debugProcess()
5 end

Choose the debugger interface through a variable[edit]

1 local debuggerInterface = 2
2 
3 debugProcess(debuggerInterface)

Use a guarded debugger selection[edit]

 1 local debuggerInterface = 2
 2 
 3 if debuggerInterface < 0 or debuggerInterface > 3 then
 4   print("Invalid debugger interface")
 5   return
 6 end
 7 
 8 if getOpenedProcessID() ~= 0 then
 9   debugProcess(debuggerInterface)
10 end

Ask for the debugger interface[edit]

 1 local result, value = inputQuery("Debugger", "Interface: 0=Default, 1=Windows, 2=VEH, 3=Kernel", "0")
 2 
 3 if result then
 4   local debuggerInterface = tonumber(value)
 5 
 6   if debuggerInterface == nil or debuggerInterface < 0 or debuggerInterface > 3 then
 7     print("Invalid debugger interface")
 8     return
 9   end
10 
11   debugProcess(debuggerInterface)
12 end

Main Pages

Core Lua documentation entry points

Lua
Script Engine