1. SylixOS debugging method introduction
SylixOS implements a powerful debugging stub, which can debug the application online on the device or simulator, and RealEvo-IDE also provides a matching debugging plug-in. Currently, RealEvo-IDE supports both automatic push debugging and the traditional debugging method of manually starting gdbserver. Several debugging methods that are very practical in daily development are not described in detail in the official manual. We create several new App projects to demonstrate correspondingly, mainly including code static analysis, code coverage inspection, performance analysis and A demonstration of a practical case. This article mainly introduces static analysis and debugging of code.
2. Detailed explanation of SylixOS debugging steps
Code static analysis is mainly used to check wild pointers, array out-of-bounds problems, etc. We build a static_check_app to demonstrate code static analysis. The program listing is shown in program listing 21.
Program Listing 2-1 static_check_app list
#include<stdio.h> intmain (intargc, char **argv) { charcBuf[10]; char *pTemp; int i; for (i=0; i<=10; i++) { cBuf[i] = 0; } printf("out put %s\n", pTemp); return (0); }
|
The demo program used is compiled without error, and can be uploaded successfully. The program compilation result is shown in Figure 2-1. Developers often encounter such problems in the development process. When the amount of code is large, the workload of manual verification is too large to be accurate. rate is not guaranteed. These errors will not be found during the compilation process, and these errors will greatly reduce the code quality and security. We can effectively avoid these problems through code static analysis.
Figure 2-1 Compilation result
Select the project to be debugged, here select the "static_check_app" project, right-click the project and select "SylixOS Code StaticAnalysis", click "Run CodeStatic Analysis", or use the shortcut key "Ctrl+Shift+C", the operation is shown in Figure 2-2 .
Figure 2-2 Operation steps
The running result is shown in Figure 2-3. Lines 11 and 14 show an array out of bounds and a wild pointer error, respectively.
Figure 2-3 Static code analysis results
After the check is completed, select the project to be debugged, here select the "static_check_app" project, right-click the project and select "SylixOS Code Static Analysis", click "ClerMarks", or use the shortcut key "Ctrl+Alt+M", the running result is shown in Figure 24 As shown, lines 11 and 14 error messages are cleared to provide a new material template for the next inspection.
Figure 2-4 Clear the error message
3. Summary
In SylixOS, we can use a variety of debugging methods for related debugging. We can debug the program according to the actual situation. This section mainly introduces the specific debugging methods of code static inspection. The next section will introduce code coverage analysis and debugging in detail.
4. References
"SylixOS Application Development Manual"
"RealEvo-IDE User Manual"