Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F12 not working in Delphi debugger on Windows 7/8

Pressing F12 while the program is running in the debugger should break the execution and open the debugger. This works correctly on Windows XP (tested with D2007 and XE2) but fails on Windows 7 and 8 (also tested with D2007 and XE2; tested on three computers).

Registry is set up properly (Windows 7):

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug] "UserDebuggerHotKey"=dword:00000000 "Debugger"="\"C:\Windows\system32\vsjitdebugger.exe\" -p %ld -e %ld"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\AutoExclusionList] "DWM.exe"=dword:00000001

The XP installation also sets "Auto"="1" and omits the AutoExclusionList but duplicating those changes on the Windows 7 machine accomplishes nothing.

The weird thing is that Delphi seems to be aware of the F12 being pressed. When I run a program in a debugger on a Windows 7 machine and press F12, Event Log window in Delphi shows

Thread Start: Thread ID: 4080. Process Project73.exe (7108)

Thread Exit: Thread ID: 4080. Process Project73.exe (7108)

It's just that the breakpoint is not triggered and application keeps running.

Does anybody know how to restore this functionality in Windows 7/8?

like image 585
gabr Avatar asked Dec 20 '12 10:12

gabr


1 Answers

The Debugger sees that a new thread is started by Windows, but it doesn't know what that thread is. In XP this thread runs into a int 3 break point (DebugBreak()), but under Vista and Windows 7+ the breakpoint isn't hit anymore even if you set the registry key.

There exists a Delphi IDE plugin that catches the thread and calls the DebugBreak() WinAPI function. http://andy.jgknet.de/blog/ide-tools/unsupported-tools/

like image 115
Andreas Hausladen Avatar answered Nov 09 '22 05:11

Andreas Hausladen