SNSystems / dexter

DExTer - Debug Experience Tester
MIT License
33 stars 6 forks source link

unable to read memory with clang-cl_vs2015 and vs2015 debugger. #61

Open TomWeaver18 opened 4 years ago

TomWeaver18 commented 4 years ago

If i run dexter with the following command:

py -3 .\dexter.py test .\tests\nostdlib\struct_inline_calls\ --builder clang-cl_vs2015 --debugger vs2015 --cflags="/Zi /Od" --ldflags="/Zi" --verbose

given the following test case, I'm unable to read the memory of a struct passed by value to doSomeMath:

` struct foo { static const size_t size = 7; int a; int b; short c; short data[size]; };

volatile foo * gpAwk;

inline void initABC(foo & bar, const int arg) { bar.a = 6 + arg; bar.b = 10 + arg; // DexLabel('initABC_str') bar.c = 256 + arg; // DexLabel('initABC_end') }

inline void initData(foo & bar, const int arg) { for (size_t ix = 0; ix != bar.size; ++ix) { // DexLabel('initData_str') bar.data[ix] = ix + arg; // DexLabel('initData_end') } }

inline int doSomeMath(foo bar, const int arg) { int someMath = bar.a + bar.b + bar.c; someMath += arg; // DexLabel('doSomeMath_str') return someMath; // DexLabel('doSomeMath_end') }

inline int makeSomePointers(foo & bar) { if (bar.a) { // DexLabel('makeSomePointers_str') gpAwk = &bar; return 0; } return bar.a + bar.b + bar.c; // DexLabel('makeSomePointers_end') }

int main(int argc, const char * argv[]) { argc -= 1; // DexLabel('main_str') foo bar; initABC(bar, argc); initData(bar, argc); makeSomePointers(bar); int math = doSomeMath(bar, argc); return math + bar.a + bar.b + bar.c + bar.data[1] + bar.data[6]; // DexLabel('main_end') }

// DexExpectWatchType('bar', 'foo', from_line='main_str', to_line='main_end')

// DexExpectWatchValue('bar.a', 6, from_line='initABC_str', to_line='initABC_end') // DexExpectWatchValue('bar.b', 0, 10, from_line='initABC_str', to_line='initABC_end') // DexExpectWatchValue('bar.c', 0, from_line='initABC_str', to_line='initABC_end')

// DexExpectWatchValue('bar.a', 6, from_line='initData_str', to_line='initData_end') // DexExpectWatchValue('bar.b', 10, from_line='initData_str', to_line='initData_end') // DexExpectWatchValue('bar.c', 256, from_line='initData_str', to_line='initData_end') // DexExpectWatchValue('bar.data[1]', 0, 1, from_line='initData_str', to_line='initData_end') // DexExpectWatchValue('bar.data[6]', 0, 6, from_line='initData_str', to_line='initData_end')

// DexExpectWatchValue('bar.a', 6, from_line='doSomeMath_str', to_line='doSomeMath_end') // DexExpectWatchValue('bar.b', 10, from_line='doSomeMath_str', to_line='doSomeMath_end') // DexExpectWatchValue('bar.c', 256, from_line='doSomeMath_str', to_line='doSomeMath_end') // DexExpectWatchValue('bar.data[1]', 0, 1, from_line='doSomeMath_str', to_line='doSomeMath_end') // DexExpectWatchValue('bar.data[6]', 0, 6, from_line='doSomeMath_str', to_line='doSomeMath_end')

// DexExpectWatchValue('bar.a', 6, from_line='makeSomePointers_str', to_line='makeSomePointers_end') // DexExpectWatchValue('bar.b', 10, from_line='makeSomePointers_str', to_line='makeSomePointers_end') // DexExpectWatchValue('bar.c', 256, from_line='makeSomePointers_str', to_line='makeSomePointers_end') // DexExpectWatchValue('bar.data[1]', 1, from_line='makeSomePointers_str', to_line='makeSomePointers_end') // DexExpectWatchValue('bar.data[6]', 6, from_line='makeSomePointers_str', to_line='makeSomePointers_end')

// DexExpectWatchValue('bar.a', 0, 6, from_line='main_str', to_line='main_end') // DexExpectWatchValue('bar.b', 0, 10, from_line='main_str', to_line='main_end') // DexExpectWatchValue('bar.c', 0, 256, from_line='main_str', to_line='main_end') // DexExpectWatchValue('bar.data[1]', 0, 1, from_line='main_str', to_line='main_end') // DexExpectWatchValue('bar.data[6]', 0, 6, from_line='main_str', to_line='main_end') `

for all the attempted reads between doSomeMath_str and doSomeMath_end i get the following message: ` test.cpp:25-26 [bar.a] ExpectValue [4/7] result could not be retrieved: step 36 () [-4] step 37 ()

test.cpp:25-26 [bar.b] ExpectValue [4/7] result could not be retrieved: step 36 () [-4] step 37 ()

test.cpp:25-26 [bar.c] ExpectValue [4/7] result could not be retrieved: step 36 () [-4] step 37 ()

test.cpp:25-26 [bar.data[1]] ExpectValue [8/14] result could not be retrieved: step 36 () [-4] step 37 () [-4]

test.cpp:25-26 [bar.data[6]] ExpectValue [8/14] result could not be retrieved: step 36 () [-4] step 37 () [-4] `

however, If I spin up visual studio and run the debugger I have no problems viewing the struct members with the doSomeMath function.

OCHyams commented 4 years ago

You need 3 backticks '`' to format a code block.

` ` `
Like this, without spaces between the backticks.
` ` `