最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

debugging - Breakpoints do not work when using Attach to Process in Delphi 12 - Stack Overflow

programmeradmin3浏览0评论

In Delphi 12, I made a Windows service that I know is running because I can see that it is executing some queries in the database, but there are some functionalities that are not working well.

I try to do an "Attach to Process" (start Delphi as administrator) and I put breakpoints everywhere in the code. When I do "Attach", it sends me directly to a tab that says "CPU" with assembler code, and I press F9 to continue the execution, but it does not stop on any of the breakpoints. I know that it is running because I see that it continues making queries to the DB automatically.

Am I missing some configuration, or something in the code that allows me to do debugging?

In Delphi 12, I made a Windows service that I know is running because I can see that it is executing some queries in the database, but there are some functionalities that are not working well.

I try to do an "Attach to Process" (start Delphi as administrator) and I put breakpoints everywhere in the code. When I do "Attach", it sends me directly to a tab that says "CPU" with assembler code, and I press F9 to continue the execution, but it does not stop on any of the breakpoints. I know that it is running because I see that it continues making queries to the DB automatically.

Am I missing some configuration, or something in the code that allows me to do debugging?

Share Improve this question edited 13 hours ago Remy Lebeau 597k36 gold badges500 silver badges844 bronze badges asked 21 hours ago Robe79Robe79 353 bronze badges 4
  • Debugging a service like this is tricky, and I would not recommend it. There are two common approaches. Use logging to learn about its behaviour. And you should have good logging anyway, especially in a service. Or have the process be coded so that it can operate in a standard process, and not as a service, as an option. Typically switched by a command line option. This makes debugging using the IDE trivially easy. – David Heffernan Commented 17 hours ago
  • @DavidHeffernan Debugging a service like this is perfectly normal, I'd say. Why do you recommend against it? Did you mean simply because it is tricky (and Delphi does not seem to behave well always - my experience, too, from attaching to service processes with newer Delphi versions), or do you see some deeper reason not to do it? Your alternative suggestions are good, too, but why would debugging the service be not recommended? – Matthias B Commented 17 hours ago
  • I have no answer to your question, but I can tell you that I experience the same. Sometimes breakpoints don't work at all, and even though Attach to process seems to have been successful, there is nothing I can do in the debugger. I'm hoping for improvements from Embarcadero, but in the meantime, I'm also curious about any tipos on how to make debugging with "Attach to Process" more stable and predictable. – Matthias B Commented 16 hours ago
  • @MatthiasB I just find it to be flaky and unreliable – David Heffernan Commented 10 hours ago
Add a comment  | 

1 Answer 1

Reset to default 0

I tried installing it from the same Debug folder of my project and running it from the services screen. Then I attached it to process and it worked perfectly.

发布评论

评论列表(0)

  1. 暂无评论