2

I coded (with visual studio 2019 on windows 10) an ultra naive chess engine that complies with UCI engine interface rules. Before starting to develop it in more fancy ways, I want to make sure that I can debug my code via using my engine from a chess GUI. Hence I decided to debug it with Arena.

I tried the following two standard debugging methods :

  • In the properties of the project used to compile my engine I put (the path to) arena.exe in the command to execute when the debug is launched, and then, when debug is triggered and arena opened, I load in Arena a new engine corresponding to my engine, I put breakpoints in my code but each has a "no symbols loaded".

  • I launch Arena, I load a new engine in it, the engine being the compiled debug version of my engine, and then in visual studio I make an "attach to process" and add Arena as process to attach to. Then the breakpoints in my code in visual studio have also "no symbols loaded".

Am I missing something or not?

I am not sure if CSE is the most suitable place to post this question but I wanted to give it a try before maybe posting on gamedev.stackexchange.com.

Precision 1. I have the same problem if I take StockFish's source code, compile it in a console project in Visual Studio 2019 and try to do as explained above.

Precision 2. I also finally posted on SE here https://stackoverflow.com/questions/59687256/debugging-a-console-chessengine-exe-used-in-another-application-a-chess-gui

1

Did you set she compiler / linker flags correctly? (/DEBUG in the linker, /Od and /Zi in the compiler - which flags did you set?) Is the pdb-file located in the same directory as the executable? You can also manually load the pdb after breaking in your code and see, if symbols appear. If not, look at the flags.

To avoid the "attach to process", you can also put a

__debugbreak();

in your code. This also avoids any mishaps with choosing the wrong process to attach to. I would probably put the break somewhere where the "uci" command is handled.

But both methods to attach the debugger are valid and should normally work.

  • 1
    Well I used visual studio 2019's "console app" project template, which indeed (for debug configuration) sets a /DEBUG for the linker, an /Od for the optimization and a /Zl (and not a /Zi, see the difference here docs.microsoft.com/en-us/cpp/build/reference/…, it should be fine) for the pdb generation, which should be fine. The .exe of the engine is compiled and placed in the same folder as its associated pdb file, so that there should not be a problem. – Olorin Jan 10 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.