Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does VS Code have a memory viewer and/or a disassembler for C++ extension?

I am using Visual Studio Code (VS Code) for debugging my C++ program. I'd like to view the memory at a variable's address and also be able to view the assembly code of my program. I am looking around on VS Code and I am not seeing an option for such views. I checked around on the marketplace and I don't anything out there.

Not sure if I am not looking in the right place, but do these features exist for VS Code?

Thanks!

like image 934
DanB91 Avatar asked Jul 24 '16 21:07

DanB91


People also ask

What is the extension of C in VS Code?

C/C++ for Visual Studio Code. C/C++ support for Visual Studio Code is provided by a Microsoft C/C++ extension to enable cross-platform C and C++ development on Windows, Linux, and macOS.

How can I see disassembly in VS Code?

Use the Disassembly window To enable the Disassembly window, under Tools > Options > Debugging, select Enable address-level debugging. To open the Disassembly window during debugging, select Windows > Disassembly or press Alt+8.


2 Answers

I have been digging for these feature for a few days now. Unfortunately, It seems that it is currently unavailable.

In addition to it not having a memory viewer, it looks like VS Code's "debugger console" is just a simple wrapper for GDB and doesn't allow memory examination commands either.

There is now a feature request for the memory viewer and dissasembly feature. I suggest you up-vote if you are as interested in them as I am.

like image 160
christner Avatar answered Sep 17 '22 18:09

christner


At this time (Feb 2018), it seems that this feature still hasn't made it into VSCode. However it is possible to use the -exec command in the VSCode Debug Console to run GDB commands. See https://code.visualstudio.com/docs/languages/cpp#_gdb-lldb-and-mi-commands-gdblldb

The GDB examine command "x" displays memory in various formats. So in the VSCode Debug Console

-exec x/64b 0x74ae70

will display 64 bytes in hexadecimal from 0x74ae70. See https://sourceware.org/gdb/onlinedocs/gdb/Memory.html for more details.

like image 25
tonyw Avatar answered Sep 16 '22 18:09

tonyw