Rate This Document
Findability
Accuracy
Completeness
Readability

Byte Alignment Check

The tool checks the byte alignment of structure variables in the source code.

Prerequisites

You have logged in to the Kunpeng DevKit.
  • /opt/DevKit is the default installation directory of the tool. The following uses this directory as an example. Replace it with the actual directory.
  • To perform a 64-bit running mode check on the WebUI, you need to manually upload files or compressed packages. In the IDE, you can simply scan local projects to run the check.

Procedure

  1. On the left pane of the page, choose Affinity Analyzer > Byte Alignment Check and click to create a task. See Figure 1.
    Figure 1 Byte alignment check
    Table 1 Parameter description

    Parameter

    Description

    Task Name

    A task name is automatically generated by default, which can be modified as required.

    Source File Path

    Set this parameter using either of the following methods:

    • If you want to use uploaded source code, click the text box and select a source code path from the drop-down list or manually enter a source code path.
    • Click Upload on the right to upload the package or folder. (The package is automatically decompressed during the upload.)
    NOTE:
    • Only TAR, TAR.BZ, TAR.BZ2, TAR.GZ, TAR.XZ, TBZ, TBZ2, TGZ, TXZ and ZIP packages can be uploaded. Only one package can be uploaded at a time. The source package cannot exceed 1 GB, and the extracted files cannot take up more than half of the remaining drive space.
    • Only one folder can be uploaded at a time. The size of the folder must be less than or equal to half of the remaining drive space.
    • Before manually uploading a software package, check whether the target directory exists. If it does not exist, create such a directory and grant the read, write, and execute permissions to the devkit user.

    Build Tool

    Build tool to be used. The options are:

    • make
    • cmake
    • automake

    Compile Command

    Command to be used to compile the source code.

    The compile command varies according to the build tool configuration file. For details, see Identifying Compile Commands Using the Build Tool Configuration File.

  2. Click Check. After the check is complete, the check report page is displayed. See Figure 2.
    Figure 2 Byte alignment check report

    Click the View Suggested Source Code tab to switch to the alignment check result page. See Figure 3.

    Figure 3 Suggested code
    Table 2 Parameter description

    Parameter

    Description

    Original Source Code

    Original source code.

    Structure Variable Memory Allocation

    Displays the 32-bit and 64-bit memory spaces that need to be aligned in the code.

    • The tool supports concurrent running of multiple byte alignment check tasks.
    • To cancel a task, click Close during the task running process.
    • Only one of the 64-bit mode check and byte alignment check can be performed by a user at a time.
    • You can click the arrow keys in the upper right corner of Original Source Code to view the code.
    • If you use shortcut keys to modify the source code, pay attention to shortcut key conflicts caused by the input method or IDE environment.
    • The analysis result may vary according to the environment, which is normal.
    • If the scan result does not match the code, macro expansion may be involved.
    • If the system displays a message indicating that the task times out, rectify the fault by following instructions in Task Timed Out.