Part 45 – Debugging Pre-Decrement Operator

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 re-examine our code.

  1. #include <iostream>
  2. int main(void) {
  3. int myNumber = 16;
  4. int myNewNumber = --myNumber;
  5. std::cout << myNewNumber << std::endl;
  6. std::cout << myNumber << std::endl;
  7. return 0;
  8. }

We remember when we compile we get 15.

Let’s debug.

Part 45 – Debugging Pre-Decrement Operator - 图1

Let’s break.

Part 45 – Debugging Pre-Decrement Operator - 图2

As we can see r3 holds 15. Keep in mind hacking this value may not be the final place it may be stored. Remember this for next week and re-examine the debug code above to see if you can figure it out.

Part 45 – Debugging Pre-Decrement Operator - 图3

As we can see r1 holds 15 as well. Keep in mind the above statement.

Part 45 – Debugging Pre-Decrement Operator - 图4

As we continue we see our cout function echoing 15 for both areas as expected.

Next week we will dive into the Hacking Pre-Decrement Operator.