48 3. IOS SOFTWARE DEVELOPMENT TOOLS
Begin by acquiring the C code to be used for this lab.
Open the folder containing the project.
Double click on the file with the extension .xcodeproj.
Navigate to the C code in the Project Navigator.
e app can be built by going to Product -> Build.
After the project is successfully built, debug points can be placed inside the C code. e
debug points can be placed by clicking on the column next to the line to be debugged or by
pressing CMD + . A blue arrow appears (see Figure L2.1) that points toward the line to be
debugged.
Figure L2.1: Debug point.
e Xcode debugger allows one to:
pause the execution at a particular line of code,
know the value of the variable at that particular instant of execution, and
navigate from function call to function execution as it is executed.
e recent Xcode version at the time of this writing includes the LLDB debugger, which
allows one to view data in an array with a pointer by typing the following command in the debug
console after the debug point is encountered:
memory read -t [Data Type of the array] -c [Number of elements]
`[Name of the array]'
For example, memory read -t float -c12 `buffer'
When this command executes, the output appears, as shown in Figure L2.2.
L2.1 LAB EXERCISE
Debug the broken C code named Lab2BrokenFilter using the Xcode debugger. is code is
supposed to filter out the higher frequency (3600 Hz) sinusoidal signal of a test signal made up
L2. LAB 2: IPHONE APP DEBUGGING 49
Figure L2.2: Output appearance.
of two sinusoids (the test signal previously loaded onto the device) and pass through its lower
frequency (500 Hz) sinusoidal signal. Indicate how both the syntax and logical errors in this
code can be fixed.
HintsWhen attempting to debug with Xcode, first get the code to a point where it will
compile. en, fix the logical errors in the code. e code will compile as is, but the processing
functionality is commented out. When testing, the reference output found in lab2_testsignal.txt
can be used to verify the result. is should match the output from the C code in your app.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.173.227