GDB: Force through an if statement

c, gdb

Solution

You can jump to `// Some code` after stopping on `if` statement in gdb, unless `// Some code` was not optimized out, see 17.2 Continuing at a Different Address. Assuming you stopped on `if`, you can:

jump +2

Problem

This is the structure of my code ``` if(someFunction()) { // Some code } ``` where `someFunction()` evaluates to `0` most of the time When GDB is at line 1 above, if I do `next` then `// Some code` will not be executed. Is there a way to tell GDB to execute the code inside the `if` statement?

Original source