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

$ccls/navigate和index.multiVersion

忙碌的Labor Day長週末。Growth hacking(希望Hudson River Trading用上無進展,和前clangd、Eclipse CDT開發者交談、cdt-lsp計劃,給LanguageClient-neovim vim-lsp加wiki頁面成功),增加了少量stargazers。學習clangd並悄悄改typo、摸索musl的開發模式,希望r2走上正途(C11/C99),LeetCode第一次用上std::adjacent_find……

Read More