Download - How To Build Busybox with G cov
![Page 1: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/1.jpg)
How To Build Busybox with Gcov
by Yunho KimProvable Software Lab, KAIST
![Page 2: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/2.jpg)
Contents
Yunho Kim, Provable Software Lab, KAIST 2/14
• How to compile busybox with gcov
• How to get coverage information
![Page 3: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/3.jpg)
Compile Busybox
Yunho Kim, Provable Software Lab, KAIST 3/14
• How to compile busybox with gcov
![Page 4: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/4.jpg)
Compile Busybox (Step 1~3)
Yunho Kim, Provable Software Lab, KAIST 4/14
• 1) Download busybox 1.17.3 version and unzip the archive file.
• 2) Execute the following command– $ make allnoconfig
to uncheck all build options
• 3) Execute the following command– $ make menuconfig
This command requires a ncurses library
![Page 5: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/5.jpg)
Compile Busybox (Step 4)
Yunho Kim, Provable Software Lab, KAIST 5/14
• 4) Go to Busybox Settings -> Build Options -> Additional CFLAGS and enter --coverage
![Page 6: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/6.jpg)
Compile Busybox (Step 5)
Yunho Kim, Provable Software Lab, KAIST 6/14
• 5) Go to Busybox Settings -> Debugging Options and check ‘Build BusyBox with extra Debugging symbols’
and ‘Disable compiler optimizations’ option.
![Page 7: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/7.jpg)
Compile Busybox (Step 6)
Yunho Kim, Provable Software Lab, KAIST 7/14
• 6) Check the 5 utilities(vi, expr, prinf, grep, ls) in Applets Coreutils -> expr, printf, lsEditors -> viFinding Utilities -> grep
![Page 8: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/8.jpg)
Compile Busybox (Step 7)
Yunho Kim, Provable Software Lab, KAIST 8/14
• 7) Go to Busybox Settings -> General Configura-tion and check ‘Show terse applet usage mes-sages’ and its sub-options
![Page 9: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/9.jpg)
Compile Busybox (Step 8)
Yunho Kim, Provable Software Lab, KAIST 9/14
• 8) Save your configuration and exit. Then, exe-cute $ make
• When the build process terminates successfully, ‘busybox’ and ‘busybox_unstripped’ files are gen-erated.– ‘busybox’ is stripped version of ‘busybox_unstripped’ – ‘busybox’ does not have any symbol information. – Thus, you should use busybox_unstripped to get symbol
information
![Page 10: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/10.jpg)
Compile Busybox (Step 9)
Yunho Kim, Provable Software Lab, KAIST 10/14
• 9) Execute ./busybox_unstripped and check expr, grep, ls, printf, and vi are defined in the binary.
![Page 11: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/11.jpg)
Compile Busybox (Step 10)
Yunho Kim, Provable Software Lab, KAIST 11/14
• 10) Check that sourcefile.gcno are generated in sub-directories. – If not, you may make a mistake in step 4
![Page 12: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/12.jpg)
Get Coverage Information
Yunho Kim, Provable Software Lab, KAIST 12/14
• How to get coverage information
![Page 13: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/13.jpg)
Get Coverage Information (Step 1~2)
Yunho Kim, Provable Software Lab, KAIST 13/14
• 1) Execute ls utility$ ./busybox_unstripped ls
• 2) Copy coreutils/ls.gcno and coreutils/ls.gcda into the busybox root directory(parent directory of coreutils directory) $ cp coreutils/ls.gcda coreutils ls.gcno .
![Page 14: How To Build Busybox with G cov](https://reader035.vdocument.in/reader035/viewer/2022062218/5681622f550346895dd25db3/html5/thumbnails/14.jpg)
Get Coverage Information (Step 3~4)
Yunho Kim, Provable Software Lab, KAIST 14/14
• 3) Execute gcov to get coverage information$ gcov -b ls.c
• 4) You can find coverage information from ls.c.g-cov– You can obtain coverage information of other source files
in a similar way.