Is there any platform independent way of dumping the variables created by your program onto a screen? say i write the program
#include <iostream>
void f(){
std::string interal_data = "hello world";
}
int main(){
f();
}
is there any way to get internal_data out without adding a std::cout/std::stream to f()? i want to output all of the data from my program, which is quite big, and i dont want to go to every other line and place a std::cout. how do debuggers do it?
im looking for ways to do this in c++
Ehm… “without adding a
std::cout/std::stream” is nonsense, if you want to output something, just do it. Debuggers work with magic, namely inspect your process and stuff, and have debugging symbols for your process which you do not have.Edit: Of course, this may only be true for C++, as Python is a somewhat interpreted language, so you might pull it off with that. As I have no experience whatsoever with Python, I can’t comment on that though. 🙂