Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUDs ➜ General ➜ Visual studio setup - pdb extraction and stepping into code

Visual studio setup - pdb extraction and stepping into code

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Gdub   (35 posts)  Bio
Date Wed 24 Apr 2024 04:06 PM (UTC)

Amended on Thu 25 Apr 2024 08:29 PM (UTC) by Nick Gammon

Message
hi all,

Hoping someone finds this valuable. I'm sure a lot of folks are doing this but I was unable to find a comprehensive walk through of how to get any (?) mud setup in visual studio and start stepping through the code.

If anyone has suggestions or additional hints, please contribute! I am still fiddling with settings in an attempt to get access to all the debugging data in the watch windows but this was a MASSIVE step forward for me.

PREREQUISITES - mud compiling via cygwin. if you don't have that working yet, this isn't the starting point for you.




  1. Download visual studio - https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&channel=Release&version=VS2022&source=VSLandingPage&cid=2030&passive=false

  2. Install using defaults

  3. Open visual studio and select the "open a local folder" option - select the SRC folder on your local hard drive


  4. You should now see something like this - project files on the left, Right click the SRC folder and 'open in terminal' this opens powershell and is where you'll make/clean and run your game. I suggest pinning it for easy access later.


  5. This what the the powershell looks like. please note that I sometimes have to repeat step 4 a few times to get the prompt - no clue why. once you have the prompt. PIN it and close the other prompt windows.


  6. In your makefile, make sure -o0 is set. This ensures the debug info is available for you later. That is "hyphen lower-case-o zero"



  7. Make clean and compile.

  8. Download and compile this program and put the .exe in your /src folder. It is going to extract the debug symbols from the .exe (smaug in my case) - https://github.com/rainers/cv2pdb

  9. In your startup script - run the cv2pdb on your .exe and then mv the .pdb file it creates into the /area folder (again, smaug specific? but wherever the exe lives is where the .pdb should live)


  10. Launch your game using the startup script. If successful to this point, you should now have a smaug.pdb in your area folder. Login with your immortal

  11. Back to Visual studio - find a piece of code and set a breakpoint. something easy to get at... maybe "do_look()" etc..

  12. Left click in the far left column. A red dot will appear...


  13. Debug menu - options


  14. Make sure your area folder (or whenever your .pdb is) is set properly


  15. Debug menu - attach to process - find smaug.exe in the list


  16. Back to your immortal - run the command that has the breakpoint set (i.e "look") or in my case "inscribe" and your game will 'break' at the breakpoint so you can see what's going on in the code


  17. Controls are here: Continue, stop, step in , step over, step out - experiment or do some reading on what these do. They should be reasonably straight forward to understand (?) -


  18. See the watch window where some variables are autopopulated and others can be set up to watch




Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


991 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.