1

I have used Visual Studio debugger and one of the perks of using Visual Studio is I can see the memory space while debugging, I can see the variables being created on specific addresses. Is there any way to see actual memory space while debugging C++ code or C code in Linux.

Thanks in advance.

EDIT:

I am sorry if my question was not clear, I am talking about getting the snapshot of the main memory to check variables being created. I have attached a screenshot of the basic code below.

Image

  • It's using POSIX getrusage Please check the following post: https://stackoverflow.com/questions/5120861/how-to-measure-memory-usage-from-inside-a-c-program – Aldin Mar 17 '21 at 23:39
  • I think the OP is talking about a dump of the bytes of memory from the address space of the application you are debugging. – drescherjm Mar 17 '21 at 23:44
  • Does Visual Studio Code have similar features? It's available for Linux. – Barmar Mar 17 '21 at 23:46
  • Yes, gdb provides a mechanism to display var's. "Actual' memory space? Are you referring to physical memory instead of virtual memory? I'm not sure why you would want to access physical memory. On embedded systems, (g++ and gdb on vxWorks, for example) access to physical memory is often required, in support of memory mapped i/o devices. – 2785528 Mar 17 '21 at 23:57
  • 2
    Visual Studio Community / Pro / Enterprise has a memory view that allows you to view the bytes of any valid location inside the running application's address space. This is not looking at physical ram or anything outside the allocated bytes of the process. – drescherjm Mar 18 '21 at 00:10
  • 1
    The Windows development environment is definitely very pretty and is probably the best visual development environment around (I hear XCode is also Good) without any good equivalents on Linux. The debugging environments on Linux will get you the same data, but it is more command line driven (fewer windows and less mouse pointer availability). – Martin York Mar 18 '21 at 00:14

0 Answers0