2

I have an executable on a Windows system, e.g. test.exe and it is started by a process parent.exe. When I debug it in Visual Studio, I use "attach to process" to debug the test.exe, but by the time I attach the debugger to process, the entry point function in test.exe has already been called.

Is there a way to set a breakpoint on the entry point function in this setup?

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
user1254554
  • 203
  • 1
  • 4
  • 14

2 Answers2

1

If you control the executable, add __debugbreak to main. This hardcodes a breakpoint which you'd usually set at runtime.

When this statement is executed, Windows will start the Just In Time debugger

Community
  • 1
  • 1
MSalters
  • 173,980
  • 10
  • 155
  • 350
0

Use WinDbg instead. File->Open Executable and check the box "Debug child processes also".

rainhaven
  • 138
  • 3