0% found this document useful (0 votes)
27 views4 pages

Solved - Delphi XE3 64-Bit Debugger Fails To Run - Void

The document discusses an issue with the Delphi XE3 64-bit debugger failing to run, where it sometimes displays a message saying 'Cannot run the debugger' despite successful compilation. The solution involves stopping the 'Internet connection sharing' service, which has been identified as causing permission errors when the debugger attempts to bind to a socket. The irregular behavior of the debugger is attributed to the state of the Internet connection sharing service at the time of launch.

Uploaded by

Bruno Cassucci
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views4 pages

Solved - Delphi XE3 64-Bit Debugger Fails To Run - Void

The document discusses an issue with the Delphi XE3 64-bit debugger failing to run, where it sometimes displays a message saying 'Cannot run the debugger' despite successful compilation. The solution involves stopping the 'Internet connection sharing' service, which has been identified as causing permission errors when the debugger attempts to bind to a socket. The irregular behavior of the debugger is attributed to the state of the Internet connection sharing service at the time of launch.

Uploaded by

Bruno Cassucci
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Solved: Delphi XE3 64-bit debugger fails to run – void https://www.boku.ru/2015/07/03/solved-delphi-xe3-64-bit-debugger-fail...

Skip to content

void

Solved: Delphi XE3 64- Блог

bit debugger fails to run Архив


Рассказы
Программы
Как выучить японский
Руководство по Анки
Обо мне
Symptoms:
Переводы
Delphi XE3 sometimes fails to run 64-bit applications Пересказы Имоты
under a debugger. Code would compile, but the part where Заговоры Харухи
10-й том
Delphi switches to debug layout never happens, Delphi Переводы книг
Remember11
just pops a message saying "Cannot run the debugger".
Поиск
32-bit debugging continues to work normally, and so does Искать
"Run without debugging".
Log in
Register
The funny part is that this happens irregularly. Sometimes
the first attempt would succeed, and then the debugger
would run all the time in all instances of Delphi. But if it
fails the first time then it would always fail even if you
restart Delphi.

I also noticed that the earlier I launch Delphi + debugger,


the higher is the chance it would run (and then continue
working). It seemed like there was something I was doing
or the computer was doing sometime after boot that broke
the debugger if I hadn’t launched it yet.

Solution:
Stop the "Internet connection sharing" service and restart
Delphi.

What might have contributed:

1 of 4 25/10/2023, 18:54
Solved: Delphi XE3 64-bit debugger fails to run – void https://www.boku.ru/2015/07/03/solved-delphi-xe3-64-bit-debugger-fail...

– Uninstalling older versions of Delphi on the same PC.


Блог
– Disabling Windows
Архив Firewall
Рассказы
– Disabling Windows
Программы Defender
Как выучить японский
Руководство по Анки
Обо мне
Diagnostics process:
Переводы
Looking at the successful and failed debugger launches
Пересказы Имоты
with Process
Заговоры Monitor, in both cases Delphi runs a remote
Харухи
10-й том
debugger. But on the successful run it’s
Переводы книг
dbkw64_17_0.exe (64 bit) while failed runs spawn
Remember11

rmtdbg170.exe (32 bit). Both are Delphi debuggers, but


Поиск
I suspected thatИскать
the second one is only supposed to be
usedinfor 32 bit debugging.
Log
Register
Further investigation showed that in both cases
dbkw64_17_0.exe launches initially, but in the second
case it terminates shortly afterwards. Delphi then tries to
connect to it through TCP, unable to do so, and restarts it
automatically. But the code that does the restart probably
wasn’t updated to 64 bit and launches 32-bit
rmtdbg170.exe instead.

Anyway, the problem lies in the initial instance of


dbkw64_17_0.exe terminating. Comparing Process
Monitor logs, both successful and failed runs load the
libraries and then work with winsock. Stack in the final
calls indicates ws2_32.dll‘s socket() is running – the
debugger is probably trying to open it’s command socket
for listening – after which failed instance abruptly
terminates (Thread Exit, Process Exit). I figured
socket() probably returns with an error.

Using rohitab’s Api Monitor I tried to find out the error


code, but this didn’t work out. Api Monitor successfully
traced all the calls until roughly WSAStartup(), but no
further – the last bunch of calls just before the termination
always got lost, perhaps the injected driver wasn’t being
able to send it back to the main app in time before the

2 of 4 25/10/2023, 18:54
Solved: Delphi XE3 64-bit debugger fails to run – void https://www.boku.ru/2015/07/03/solved-delphi-xe3-64-bit-debugger-fail...

application terminated.
Блог
Архив
Then I opened dbkw64_17_0.exe for debugging in
Рассказы
Программы
Visual Studio. I set a breakpoint to
Как выучить японский
{,,ws2_32.dll}socket,
Руководство по Анки caught the execution there
Обо мне
and studied what happens step by step. Turns out,
Переводы
socket() was successful. It was followed by
Пересказы Имоты
setsockopt call, also successful (to know which
Заговоры Харухи
10-й том we were stepping into, I used VS’s standard
functions
Переводы книг
ability to load Windows DLL symbols from Microsoft
Remember11
servers). Then dbkw64_17_0.exe called bind() which
Поиск
failed. Искать

Log
My in
initial guess was that someone else occupied the port it
Register
needed. Checking bind() parameters at MSDN, I looked
into RDX, RCX, R8, R9 registers which host parameters
in x64 calls, namely the memory referenced by RCX, which
kept the requested family and port number. It turned out to
be 0xC0F3 but it was unoccupied.

I then traced the call to bind() and from the internal call
to WSPBind() got the error code: 0x1D27, that is 10013
(WSAEACCES: Permission denied. An attempt was made
to access a socket in a way forbidden by its access
permissions).

This code has no single specific reason for it. From the
internet it looks like it appears when some driver or
network-related service misbehaves. I tried stopping
network related services one by one, until finally bind()
succeeded. The infringing service was "Internet connection
sharing (ICS)". As long as I stop this service, the debugger
launches normally, and so long as ICS is running, the
debugger would not start.

The reason why sometimes the debugger would run and


then run always, is probably that ICS hadn’t yet been
started or did not yet harm the network stack at the time. If
the debugger run at that point, it would bind the socket,

3 of 4 25/10/2023, 18:54
Solved: Delphi XE3 64-bit debugger fails to run – void https://www.boku.ru/2015/07/03/solved-delphi-xe3-64-bit-debugger-fail...

and for whatever reason binding at that port would then


Блог
continue working later. But if the debugger was initially
Архив
Рассказы
launched after the harm has been done, it wouldn’t be
Программы
ableвыучить
Как to bindяпонский
to the port neither once nor at all.
Руководство по Анки
Обо мне
3 July, 2015 в 15:49 Категории: Delphi, In English @en. RSS комментов

Переводы
Пересказы Имоты
Напишите комментарий:
Заговоры Харухи
10-й том
Connect with:
Переводы книг
Remember11

Поиск
Искать
Если хотите, можно залогиниться.

Log in
Комментарий
Register

Имя *

Почта *

Сайт

Save my name, email, and website in this browser for the


next time I comment.

Опубликовать

4 of 4 25/10/2023, 18:54

You might also like