Login
User Name:

Password:



Register

Forgot your password?
do_owhere recursive
Author: Khonsu
Submitted by: Khonsu
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
Users Online
AhrefsBot

Members: 0
Guests: 13
Stats
Files
Topics
Posts
Members
Newest Member
489
3,794
19,651
597
Aileenutz

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » General » Coding » Visual studio setup - pdb ext...
Forum Rules | Mark all | Recent Posts

Visual studio setup - pdb extraction and stepping into code
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Apr 24, 2024 12:48 pm   
Go to the top of the page
Go to the bottom of the page

Gdub
Fledgling
GroupMembers
Posts4
JoinedFeb 24, 2024

 
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 https://imgur.com/F2V6Jil
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. https://imgur.com/4ZcbODo
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. - https://imgur.com/uVCNYv3
6) in you makefile, make sure -o0 is set. This ensures the debug info is available for you later. - https://imgur.com/BitIUKr
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... https://imgur.com/CvFoght
13) Debug menu - options - https://imgur.com/1jtGxv4
14) make sure your area folder (or whenever your .pdb is) is set properly - https://imgur.com/miqdS6b
15) Debug menu - attach to process - find smaug.exe in the list - https://imgur.com/NHsBlfF
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 - https://imgur.com/szLo72Z
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 (?) - https://imgur.com/AnHL7BB
18) See the watch window where some variables are auto populated and others can be set up to watch - https://imgur.com/6c7jyfe

image depot - https://imgur.com/a/1eZd1AJ

Pages:<< prev 1 next >>