Part 33 – Debugging Double Variables

For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in addition to the topics it will cover. https://github.com/mytechnotalent/Reverse-Engineering-Tutorial

Let’s review our code.

  1. int main(void) {
  2. double myNumber = 1337.77;
  3. std::cout << myNumber << std::endl;
  4. return 0;
  5. }

Part 33 – Debugging Double Variables - 图1

Let’s debug!

Part 33 – Debugging Double Variables - 图2

Let’s set a breakpoint at main+24 and continue.

Part 33 – Debugging Double Variables - 图3

We see the strd r2, [r11, #-12] and we have to fully understand that this means we are storing the value at the offset of -12 from register r11 into r2. Let’s now examine what exactly resides there.

Part 33 – Debugging Double Variables - 图4

Voila! We see 1337.77 at that offset location or specifically stored into 0x7efff230 in memory.

Part 33 – Debugging Double Variables - 图5

Let’s step into twice which executes the vldr d0, [r11, #-12] as we understand that 1337.77 will now be loaded into the double precision math co-processor d0 register. Let’s now print the value at that location below.

Part 33 – Debugging Double Variables - 图6

Finally let’s continue and watch the value echo to the terminal. This completes our cout c++ function.

Part 33 – Debugging Double Variables - 图7

Next week we will dive into Hacking Double Variables.