Skip to content

Commit 279f32e

Browse files
FantoomForNeVeR
authored andcommitted
add powershell debugger script
1 parent fd0cb1e commit 279f32e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

debugger.ps1

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Param(
2+
[string]$script,
3+
[array]$bps
4+
)
5+
6+
$scriptToDebug = $script
7+
8+
$breakpointAction = {
9+
Write-Host "Breakpoint hit at line: $($PSItem.Line)"
10+
Write-Host "Script: $($PSItem.Script)"
11+
Write-Host "Stack Trace Details:"
12+
Get-PSCallStack | ForEach-Object {
13+
Write-Host $_
14+
}
15+
}
16+
17+
foreach ($breakpointLine in $bps)
18+
{
19+
Set-PSBreakpoint -Script $scriptToDebug -Line $breakpointLine -Action $breakpointAction
20+
}
21+
22+
& $scriptToDebug
23+
24+
Get-PSBreakpoint | Remove-PSBreakpoint

0 commit comments

Comments
 (0)