LLDB – Raz https://blog.razb.me Computer stuff Sun, 13 Jan 2019 01:25:31 +0000 en-US hourly 1 https://wordpress.org/?v=5.0.3 https://i2.wp.com/blog.razb.me/wp-content/uploads/2018/04/cropped-Untitled.png?fit=32%2C32&ssl=1 LLDB – Raz https://blog.razb.me 32 32 108306310 [LLDB/Xcode] Manipulating the currently executing line https://blog.razb.me/manipulating-the-currently-executing-line/ https://blog.razb.me/manipulating-the-currently-executing-line/#respond Fri, 25 Mar 2016 05:17:38 +0000 http://razb.me/?p=68 Read more…]]> Have you ever wanted to quickly see the result of a particular code path, but realized you had to stop the app, comment out or modify some code, and run the app again so that the new code follows a different path? There may be a quicker way to achieve this. Consider the following example:

The result is YES under normal circumstances, but we want to test what happens if the result was ever NO.

One way to do that is by dragging the little green arrow next to the breakpoint marker down into the else statement so that it looks like this:

The result is YES, but we have managed to get ourselves into the else condition to test what happens going down that code path.

Upon dragging the green arrow, Xcode will display the following error:

Take a second to read the error and understand it. Then, press ‘Move’ to move the instruction pointer. Now, simply resume execution of the program. Voila, you have just tested your alternative code path without stopping, commenting out or modifying the code, and restarting the app.

]]>
https://blog.razb.me/manipulating-the-currently-executing-line/feed/ 0 68