I l @ ve RuBoard |
Reverse Engineering Using the C++ AnalyzerStep 1: Create a ProjectA C++ Analyzer project contains the information needed to extract a Rose design from source-code files. An analyzer project contains the following information:
Once a project is created, it is saved with a .pjt extension. CREATING A PROJECT IN THE C++ ANALYZER
The C++ Analyzer Project window is shown in Figure A-8. Figure A-8. C++ Analyzer Project Window
Step 2: Add Project CaptionJust as code is documented for future use, analyzer projects are also documented. Each project should contain a caption. This is typically descriptive information about the project such as its title and purpose. This information may be used by other teams to determine if the project has reuse potential either as a standalone project or as a base project. ADDING A CAPTION IN THE C++ ANALYZER
The Caption window is shown in Figure A-9. Figure A-9. Caption Window
Step 3: Add Referenced Libraries and Base ProjectsThe directory list contains a list of directories used by the C++ Analyzer. The directory containing a file to be analyzed must be in the directory list. In addition, the directory for any included file must also be in the directory list. CREATING THE DIRECTORY LIST IN THE C++ ANALYZER
The Project Directory List window is shown in Figure A-10. Figure A-10. Project Directory List Window
An analyzer project may use information from another project, called a base project. Typically, base projects contain information about header files for compiler-specific libraries or class libraries on which the program is built. Rather than reanalyze this information in every project that uses these files, a base project is created. The base project may then be used by any other project that needs information about the files in the base project. Base projects are identified in the base project list. If the Analyzer cannot find a file in the project directory list, it will look for the file in a base project, which are searched in the order in which they appear in the base project list. ADDING BASE PROJECTS IN THE C++ ANALYZER
The Base Projects window is shown in Figure A-11. Figure A-11. Base Projects Window
Step 4: Set the File Type and Analyze the FilesThe analyzer categorizes files into three different file typesType 1, Type 2, and Type 3. When a file is added to the file list it is made a Type 1 file. This type of file is syntactically complete and context independent. That is, the file is a list of complete C++ declarations at file scope and either contains all information that it needs or obtains the information from its #include directives. A Type 2 file is syntactically complete but context-dependent; that is, the file is a list of complete C++ declarations at file scope but the file contains symbols whose definitions are provided by the context in which it is included. A Type 3 file is syntactically incomplete. Type 3 files are always processed as they are encountered . TO CHANGE THE ANALYSIS TYPE IN THE C++ ANALYZER
The C++ Analyzer may process a single file or a group of files. The Analyzer creates and stores analysis information in a data file for each file it processes. This data may be used the next time the file is analyzed. The status of each file is updated in the files list as the file is processed. The status may be
ANALYZING FILES IN THE C++ ANALYZER
The analyzer window along with an analysis status is shown in Figure A-12. Figure A-12. Analyzer Status
Step 5: Evaluate the ErrorsThe Analyzer writes all errors to the Log window. Errors can also be viewed in the files list by double-clicking on the file. Each error should be evaluated as to its severity. Some common errors are
The analyzer window, along with the errors encountered during analysis, is shown in Figure A-13. Figure A-13. Analyzer Errors
Step 6: Select Export Options and Export to RoseThe export options specify what elements should be modeled and drawn in the exported file. For example, a class can be modeled and drawn, comments can be added, associations can be modeled and drawn, and dependency relationships can be modeled. If an element is modeled and drawn, it will be visible in the created or updated Rose model. If an element is modeled, it can be drawn within Rose once a Rose model is created or updated. If it is not modeled , then it can never be drawn in Rose. The C++ Analyzer has multiple export options sets already set up for your use. They are
You have the option of using one of the preexisting export option sets, modifying one of the preexisting export option sets, or creating your own export option set. EXPORTING TO ROSE IN THE C++ ANALYZER
The Export to Rose window is shown in Figure A-14. Figure A-14. Export to Rose
Step 7: Update Rose ModelOnce the .red file is created by the Analyzer, it is used to update the Rose model. This will replace elements of the Rose model with elements extracted from the source code. In addition, any elements in the code that are not in the model are added to the model. UPDATING A ROSE MODEL
|
I l @ ve RuBoard |