我要评分
获取效率
正确性
完整性
易理解

Byte Alignment Check

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

Command Function

Checks the byte alignment of structure variables in the source code.

Syntax

devkit advisor addr-align [-h | --help] {-i INPUT_PATH | --input INPUT_PATH} {-c COMMAND | --cmd COMMAND} [-o OUTPUT_PATH | --output OUTPUT_PATH] [-r {all,json,html,csv} | --report-type {all,json,html,csv}] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT]

Parameter Description

Table 1 Parameter description

Parameter

Option

Description

-h/--help

-

Obtains help information.

-i/--input

input_path

Path of the source code folder to be scanned. This parameter is mandatory.

-c/--cmd

command

Source code build command. This parameter is mandatory. If there are multiple build commands executed on the server, separate them with semicolons (;) and enclose them with double quotation marks ("). If a command contains spaces, enclose the spaces as well.

Example: "mkdir build;cd build;cmake ..;make"

NOTE:

The source code build command in the command line tool does not support variable setting and environment variable export.

Example: "CFLAGS='-O0 -g';make" or "export CFLAGS='-O0 -g';make"

-o/--output

output_path

Path for storing scan reports. By default, scan reports are stored in the current execution path. A report name is the format of Module name_Timestamp.

--set-timeout

time

Timeout interval of a task, in minutes. If the execution duration exceeds the timeout interval, the task exits. By default, there is no timeout interval. The task will be executed until it is complete.

-l/--log-level

0/1/2/3

Log level, which defaults to 1.
  • 0: DEBUG
  • 1: INFO
  • 2: WARNING
  • 3: ERROR

-r/--report-type

all/json/html/csv

Scan report format, which defaults to all.
  • all: generates reports in JSON, HTML, and CSV formats.
  • json: generates a report only in JSON format.
  • html: generates a report only in HTML format.
  • csv: generates a report only in CSV format.

Example

In this example, the source code in the /opt/DevKit/wtdbg2-2.5 directory is scanned, the build command is make, and the log level is DEBUG. Replace the example parameter values with the actual ones.

devkit advisor addr-align -i /opt/DevKit/wtdbg2-2.5 -c make -l 0 

If you check byte alignment in the source code path, the directory is empty when the ls command is executed after the analysis is complete. In this case, return to the parent directory, go to the source code path again, and run the ls command to view related files.

The following information is displayed and a report is generated:

Scanned time: 2024/02/29 02:44:48
Configuration:
    Scan source code path: /opt/DevKit/wtdbg2-2.5
    Generate report path: /opt/DevKit/workspace/devadmin/porting/package
    Generate report type: all
    Task Timeout Interval: The timeout period is not set.
    Log level: debug

For the detailed information, please check:
    /opt/DevKit/workspace/devadmin/porting/package/addr-align_20240229024448_4d53.html
    /opt/DevKit/workspace/devadmin/porting/package/addr-align_20240229024448_4d53.json
    /opt/DevKit/workspace/devadmin/porting/package/addr-align_20240229024448_4d53.csv

Output Report

Table 2 Output report parameters

Parameter

Description

Configuration

Displays the software source file path.

Source File to Be Modified

Displays information such as the path of the source file requires byte alignment.