Add CFG of the copy_mem() function

This commit is contained in:
Michael Hohn
2025-03-17 19:13:24 -07:00
committed by =Michael Hohn
parent 75f0ec79bd
commit 92d605aa7a
6 changed files with 329 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
* Some low-level codeql
* CodeQL AST in dot and pdf
#+BEGIN_SRC sh
# Produce ast in dot format
codeql database analyze \
@@ -22,3 +22,31 @@
# 3280 880 73% 1 file
#+END_SRC
* CodeQL CFG in dot and pdf
XX: The whole control flow graph is very large, so the query narrows it to the
function of interest,
#+BEGIN_SRC c++
int copy_mem(unsigned int unused, dyn_input_t *input,
unsigned int input_types) {...}
#+END_SRC
from [[./tests-common/test_part1.c]]
#+BEGIN_SRC sh
# Produce CFG in dot format
codeql database analyze \
--format=dot --output=cfg.dot \
-j8 -v --ram=16000 \
--rerun \
-- \
cpp-dataflow-part1-database \
graphs/cfg.ql
# Convert dot to pdf
dot -Tpdf < cfg.dot/cpp/print-cfg.dot > cfg.dot/cpp/print-cfg.pdf
# View the graph
open cfg.dot/cpp/print-cfg.pdf
#+END_SRC