Hi
I have a simple C function,say -
{int a;
a++;
b=a+10;
}
Through the scripting console, I am giving a new value to the memory location of a in each iteration of a for loop - and then I am debugging it and executing it.
The problem is - after the end of execution, I can see the value of a is the same as that written into the memory location ( I checked this through the Expression window). However, a++ and b=a+10; are not working with the data. b shows a value of 0 at the end. I tried including a breakpoint and giving a pause of 10 seconds after the memory was written into - but it had no effect. Can anybody please explain where I am going wrong?
This is a snippet of what I am doing while reading and writing from the C code -
var firstBP = debugSession.breakpoint.add("main.c", 5); //inserts breakpoint at line "int a "
print("Breakpoint added");
var a = debugSession.symbol.getAddress("a");
if (!debugSession.target.isHalted())
{
debugSession.target.halt();
}
debugSession.memory.writeData(0,a,t[j], 32);
insert_pause(10000);
debugSession.target.restart();
var secondBP = debugSession.breakpoint.add("main.c", 8); //inserts breakpoint AFTER the line b=a+10
insert_pause(5000);
var b = debugSession.symbol.getAddress("b");
debugSession.target.restart();
var result = debugSession.memory.readData(Memory.Page.PROGRAM,b, 32, false)
debugSession.terminate();