1 Installation of Pgrelief
Hardware: Cpu:intel series in the PIII 1G or above, SPARC in the 300MHZ or more
Can. Memory: Recommended for more than 1G of memory.
Software: The current GUI version of Pgrelief can be run on the following software platform:
WINDOWS2000/XP Japanese version
Redhat Linux 7.3/9.0 Japanese version
Solaris 7/8/9 Japanese version
2 Use of Pgrelief interface Edition
The process of static analysis using Pgrelief is basically divided into four steps: Creating an analysis project, configuring analysis options, analyzing it, and viewing the results of the analysis.
2.1 Creating an Analysis project
Create a new project: Click the main file--new project
Set up project information
Include the following:
Set the project name
Set the project file storage path
Description Project summary Information
Select the Parsing object code (select which source code you want to parse.) Currently, Pgrelief only supports check of C + + code)
2.2 Configuration Analysis Options
The configuration analysis option is a difficult and troublesome step in the entire analysis process and is only properly configured to enable Pgrelief to parse the code correctly.
Where you must set the compilation, macro definition, and header file path.
2.2.1 Setting the compiler
Because different compilers and different operating systems handle some of the details of the C + + language in different ways
Must be selected according to the original development environment (operating system and compiler) of the code being analyzed, and the Pgrelief
The compiler option that should be applied.
2.2.2 Macro Settings
Here you can define or unassign some macros, as shown in:
In general there is no need for special settings, but if you are compiling a program, you define some
Important Macros that affect program compilation need to be defined here, as in Linux makefile
The macro defined inside.
2.2.3 Standard header files and user-defined header files
User-Defined header file: Use the account file directory settings, it is necessary for users to manually add: The current resolution of the CPP or C files, the use of all the user-defined header file path. Note that there is no omission.
Standard header file: The standard header file directory settings are similar to the user header file directory settings, it is necessary for users to manually add: the current
Resolves the path of the CPP or C file to the header file of all the standard libraries to be used. Note that there can be no omission, and there should be precedence.
2.2.4 Other
In addition to the above three items are required, the remaining options are optional. Users can meet their own requirements, and combine the help
Documentation to make it more detailed, in accordance with your own requirements of the settings.
2.3 for analysis
Steps to analyze
After the configuration of the analysis options is complete, you are ready to begin parsing. An analysis of a project consists of two phases:
Single file analysis (at this stage, each file in the project is analyzed individually); Inter-file analysis (the global information for all files is analyzed when all files are completed by a single file analysis).
The way of analysis
The user can choose several ways to parse:
Resolution: Parse all files under the current project, including single-file analysis and inter-file analysis
Select Parse: Parse a selected file or files, and only perform single-file analysis at this time
Differential parsing: Analyze all files in the project that have not yet been analyzed, and finally perform inter-file analysis.
Resolution of analysis errors
In general, file analysis interrupts are mainly caused by a header file not found or the source file does not conform to the C + + standard. Under
In our experience, we summarize the following kinds of error situations:
Break phenomenon |
interrupt reason |
workaround |
Cannot find header file |
Forget to add header file |
Add header file |
file in #include <****.h> format package With user-written header files |
Based on the referenced format of the header file, the header file should be added to the standard header file |
Header The file is contained in a relative path, such as #include "****.h" &NBSP; |
The system sets the header file path as the current path, and needs to reset the header file path |
Note: The header file needs to be reconfigured because of an interrupt caused by a header file configuration error.
2.3.4 Other parsing operations
Save parsing information: see:
2.4 Viewing analysis results
You can view the accusation information in the following 2 ways: To view the accusation information according to the accusation number, and to view the accusation information according to the file which is accused of appearing.
Other operations:
View the source file of the accusation: Select a accusation message-click on the main menu to open PGR, the system will automatically locate the location of the accusation
3 Pgrelief use of the command line
3.1 Configuration Analysis Options
3.1.1 Setting the compiler
-K
Specifies the compiler.
Usage:
Pgr-k GNU/GCC3 a.cc
[List of supported compilers]
Company |
Compiler |
[DIAB DATA Company] |
Diabdata/dccansi, Diabdata/dcckandr, Diabdata/dccstrict, DIABDATA/DCC |
[FUJITSU Products |
fujitsu/fcc401, fujitsu/fcc401c, fujitsu/fcc401, fujitsu/softunef2mc16b FUJITSU/SOFTUNEFRB, FUJITSU/SOFTUNEFR |
[GNU Products] |
GNU/GCC, GNU/GCC3, Gnu/gcc3_c90, GNU/GCC4, gnu/gcc4_c++03, GNU/GCC3_C90 |
[Microsoft Visual C + + Compiler] |
MS/VC1, Ms/vc4mfc, Ms/vc4, Ms/vc42, Ms/vc42mfc, Ms/vc5, Ms/vc5mfc, MS/VC6, Ms/vc6mfc, Ms/vc6win64, MS/VC2003, MS/ VC2003MFC, ms/vc2005, MS/VC2005MFC ms/vc2008, Ms/vc2008mfc, ms/vc2010, MS/VC2010MFC, MS/VC2010CLR |
[Mentor Graphics Japan Co.Ltd. Products] |
MGJ/MRIPC, Mgj/mrisun |
[HITACHI Products] |
Hitachi/sh, Hitachi/h8 |
[RENESAS Company] |
RENESAS/78K0R, renesas/740, renesas/7770, renesas/h8--300, renesas/h8s, renesas/m16c Renesas/m16c80, renesas/m32c, renesas/m32r, renesas/rx\ Renesas/superh |
Sun Microsystems |
SUN/SPARC3, SUN/SPARC4, SUN/SPARC4C, sun/sparc4s, SUN/SPARC5, sun/sparc5c, sun/sparc5s, Sun/sparc42, SUN/SPARC42C, SUN/ Sparc42s, sun/sparc201, sun/sparc301, SUN/SPARC301C, sun/sparc301s |
Nfc |
Nfc/78k0, nfc/78k0s, Nfc/78k4, nfc/v850 |
3.1.2 Macro Settings
-D macro
Specify a macro
Usage:
PGR-D Macro a.cc
Effect:
Equivalent, at the beginning of a.cc wrote #define Macro 1
-D Mac=value
Specify a macro
Usage: (note mac=value cannot have spaces, value can make any value)
pgr-d Mac=value a.cc
-U macro
Specifies the system macro.
Usage:
Pgr-u __line__ a.cc
Parameters of the option:
__line__, __file__, __time__, __date__, __stdc__, etc.
C + + __cplusplus
C99 _stdc_hosted__, __stdc_version__
3.1.3 Standard header files and user-defined header files
-I.
To set a lookup path for a custom header file
Usage:
Pgr-i Path a.cc
Note: path is preferably the full path of the header file, or the correct relative path. It's a folder, don't be mistaken.
-Y
Find a way to set standard header files
Pgr-y Path a.cc
4 FAQs
4.1 Resolution of parsing errors
In general, file analysis interrupts are mainly caused by a header file not found or the source file does not conform to the C + + standard. Under
In our experience, we summarize the following kinds of error situations:
Interrupt phenomenon |
Reason for interruption |
Workaround |
I can't find them. Header file |
Forget to add header file |
Add header File |
File in #include <****.h> format package Header files with user-written |
To set the header file path using the –y option |
The header file is contained in a relative path, such as #include "****.h" |
Use the –i option to set the current path to the header file path |
Pgrelief Usage Guide (Windows edition)