Command line processing in LLVM

Updated in 2023-05.

There are two libraries for processing command line options in LLVM.

llvm/Support/ComandLine.h

See https://llvm.org/docs/CommandLine.html for documentation.

Global variables (mostly llvm::cl::opt<type>, some llvm::cl::list<type>) are most common to represent command-line options. The llvm::cl::opt constructor registers this command line option in a global registry. The program calls llvm::cl::ParseCommandLineOptions(argc, argv, ...) in main to parse the command line options. opt supports various integer types, bool, std::string, etc. Defining some specialization can support support custom class/enum types.

Read More

gcov与LLVM中的实现

打算以后不定期写一点LLVM的学习(开发)笔记。写作上不想过多花时间(加语文水平所限...),所以字句不作过多斟酌。

gcov

https://gcc.gnu.org/onlinedocs/gcc/Gcov.html

_Optimally Profiling and Tracing Programs_描述了一个edge-frequency/edge-placement problem。 选择control-flow graph的一些边,加上监控代码,推导所有边的执行次数。 gcov是一种实现。

在gcov的模型中,一个源文件包含若干函数,一个函数包含若干基本块,一个基本块占据若干行,这些信息保存在.gcno文件中。 Instrument程序,在基本块间转移时记录边的执行次数,程序退出时为每个translation unit输出一个.gcda文件。 .gcda文件可以累计多次程序执行的计数。

Read More

Real World CTF 2018 rwext5命题报告

史上最强国际顶尖战队集结5大洲、15个国家地区、20支战队。近5年共计获得150次CTF全球冠军。100名最强CTF选手,48小时不间断赛制。12月1-2日,中国郑州、长亭科技,首届Real World国际CTF网络安全大赛,线下总决赛,大幕开启!

我也好想去郑州啊😭

In November, I created a forensics/reversing challenge "rwext5" for Real World CTF 2018 Finals.

Read More