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
1 | devkit advisor addr-align [-h | --help] {-i INPUT_PATH | --input INPUT_PATH} {-c COMMAND | --cmd COMMAND} [-o OUTPUT_PATH | --output OUTPUT_PATH] [-l {0,1,2,3} | --log-level {0,1,2,3}] [-r {all,json,html,csv} | --report-type {all,json,html,csv}] [--set-timeout TIMEOUT] |
Parameter Description
Parameter |
Option |
Description |
|---|---|---|
-h/--help |
- |
Obtains help information. This parameter is optional. |
-i/--input |
- |
Path to the source code folder to be scanned. This parameter is mandatory. |
-c/--cmd |
- |
Source code build command. This parameter is mandatory. Builds source code. If there are multiple build commands, separate them with semicolons (;) and enclose them with single quotation marks (') or double quotation marks ("). If a command contains spaces, enclose it with single or double quotation marks. 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 |
- |
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. This parameter is optional. |
-l/--log-level |
0/1/2/3 |
Log level, which defaults to 1. This parameter is optional.
|
-r/--report-type |
all/json/html/csv |
Scan report format, which defaults to all. This parameter is optional.
|
--set-timeout |
- |
Timeout interval of a task, in minutes. If the execution duration exceeds the timeout interval, the task exits. This parameter is optional. By default, there is no timeout interval. The task will be executed until it is complete. |
Example
In this example, the source code in the /opt/DevKit/wtdbg2-2.5 folder is scanned, the build command is make, the scan report is stored in the /opt/DevKit directory, and the log level is DEBUG. Replace the example parameter values with the actual ones.
1 | devkit advisor addr-align -i /opt/DevKit/wtdbg2-2.5 -c make -o /opt/DevKit -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:
Executing byte alignment check task, please wait...
Current progress: # [5%]
Start to obtain the compile database
Current progress: ###### [20%]
Start to obtain the preview compilation result
Current progress: ################ [50%]
Start to obtain the byte alignment result
Current progress: ################################# [100%]
Scanned time: 2025/04/08 09:39:58
Configuration:
Scan source code path: /opt/DevKit/wtdbg2-2.5
Generate report path: /opt/DevKit
Generate report type: all
Task Timeout Interval: The timeout period is not set.
Log level: debug
For the detailed information(This is the full scan result. Please make sure that the project can be successfully compiled with "make"), please check:
/opt/DevKit/addr-align_20250408093958_c6f3.json
/opt/DevKit/addr-align_20250408093958_c6f3.html
/opt/DevKit/addr-align_20250408093958_c6f3.csv
Output Report
Parameter |
Description |
|---|---|
Configuration |
Displays the software source file path. |
Source File to Be Modified |
Displays information such as the path to the source file requires byte alignment. |