In the previous step, the execution flow of the example application reached the end, but the result of the string lowercase conversion did not succeed because the ‘Z’ character is not lowercased.
Because the lowercase conversion is performed in a “while” loop without any exit point on failure, the only way to check the execution flow for the mentioned element in the array with a breakpoint is by actually stepping through the loop until you reach the appropriate index. Adding a watchpoint can help you to avoid this approach, setting a conditional breakpoint to stop when the element ‘Z’ in the buffer is read.
Add a watchpoint triggered by a read operation on element 16 of ZDmaDstBuf.
Launch the debug session and run through the code until the execution is stopped.
Stepping through the code confirms that the lowercase conversion has not been not performed for the ‘Z’ character. A review of the if
statement shows that the upper limit has been set incorrectly: the lower and upper limit should be >= 65 and <= 90, according to the ASCII table specification.
Modify the comparison statement to include the correct boundaries for uppercase ASCII characters as shown in the following example:
if((bufptr[idx] >= 65) && (bufptr[idx] <= 90)) {
Build the application and launch the debug session again. This time, the application is executed completely, and the original string is lowercased properly in the destination buffer.
Copyright © 2020–2024 Advanced Micro Devices, Inc