BC文件生成
BC文件用于内存一致性检查和向量化检查。
命令功能
通过编译源码文件生成对应的BC文件。

用于生成BC文件的源码文件需要确保可以在本地使用提供的编译命令编译通过。
命令格式
1 | devkit advisor bc-gen [-h | --help] {-c COMMAND | --command COMMAND} [-o OUTPUT_PATH | --output OUTPUT_PATH] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT] [-t THREADS | --thread THREADS] |
参数说明
参数 |
参数选项 |
参数说明 |
---|---|---|
-h/--help |
- |
获取帮助信息。 |
-c/--command |
command |
必选参数,源码构建命令。在服务器中正常执行的构建命令,若存在多个构建命令需使用英文分号分割并用英文单/双引号包住;命令中如有空格,也需要用英文单/双引号包住。 例如:"mkdir build;cd build;cmake ..;make"。 说明:
命令行工具源码构建命令不支持设置变量和export环境变量。 例如:"CFLAGS='-O0 -g';make"或"export CFLAGS='-O0 -g';make"。 |
-o/--output |
output_path |
生成BC文件的存放路径,需要有写权限。报告默认存放在当前路径下,名称默认为“模块名称_时间戳”。 |
--set-timeout |
time |
任务超时时间,单位为分钟,若执行时间超过超时时间则退出执行。默认无超时时间,任务将持续执行直到结束。 |
-l/--log-level |
0/1/2/3 |
设置日志级别,默认为1。
|
-t/--threads |
thread_num |
编译BC文件的线程数,默认线程数为当前环境CPU总数的一半。 |
使用示例
执行以下命令,生成BC文件。
此处以扫描“/home/test”下源码文件,编译命令为cmake .、make,BC文件保存在“/home/test/bc_files”下为例,请根据实际情况进行修改。
1 2 | cd /home/test && cmake . devkit advisor bc-gen -c make -o /home/test/bc_files |
返回信息如下,并输出报告。
Executing static memory consistency check task, please wait... Current progress: ###### [20%] Start to get the compile database Current progress: ################ [50%] Start to generate the bc files Current progress: ################################# [100%] Configuration: Generate bc files path: /home/test/bc_files Compile command: make Threads: The threads is not set, using the half number of cores. Task Timeout Interval: The timeout period is not set. Log level: info Summary: Scanned all source files, there are 5 linked bc files and 5 object bc files generated. For the detail information, please check: Output path of linked bc files: /home/test/bc_files/bc-gen_20250408112730_d397/bin Output path of object bc files: /home/test/bc_files/bc-gen_20250408112730_d397/object There are 3 linked bc files fail to be generated. For the causes of the failure to generate all the bc files and their intermediates, please check: Log path: /install_path/advisor/logs/affinity/affinity.log Warning and error messages when generate all the bc files: /current_path/bc_warning.json
父主题: 亲和分析