- Your
std::string
is not a plain ascii string it is a structure (actually a class) so you cannot take the address and find the string.
In your specific case since your string test's length is less than the threshold you are lucky you can see it in your screenshot look for 74 65 73 74 as ascii you will notice it is "test"
- It appears your
int i
is visible
try looking at 0xa == 0n10
Edit
Your source slightly modified to show the results of above statements
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
//small string will be embedded inside std::string class
// you can see 74657374 (hex for "test")
string s1{ "test" };
cout << s1 << endl;
cout << &s1 << endl;
printf("%llx\n", *(__int64 *)(&s1) );
printf("%p\n" , s1.c_str());
printf("%s\n" , s1.c_str());
cout << "\n=========================================================================\n" ;
// big string a pointer will be present to the c_str member
// you cannot see the string unless you dereference the pointer for c_str() member
string s2 { "this is a very very very very very very biggy biggy biggy stringyyyyyy" };
cout << s2 << endl;
cout << &s2 << endl;
printf("%llx\n", *(__int64 *)&s2 );
printf("%p\n" , s2.c_str());
printf("%s\n" , s2.c_str());
return getchar();
}
Results
>ogrish.exe
test
001AF7C8
eafc0074736574 <<<< see the hex embedded
001AF7C8 << both &std::string and std::strin.c_str() are same
test << c_str()
=========================================================================
this is a very very very very very very biggy biggy biggy stringyyyyyy
001AF7E0 &std::string
1af7f000265cf0 << address of std::string and c_str() are different
00265CF0 & string->c_str()
this is a very very very very very very biggy biggy biggy stringyyyyyy << c_str()
and btw keep in mind if you attach to this console process all the code has already run and everything that is on stack can be out of scope and contain bogus values you need to step through for checking things on debugger
not execute and attach.