diff options
| author | Frank Busse <bb0xfb@gmail.com> | 2023-03-24 21:14:02 +0000 |
|---|---|---|
| committer | MartinNowack <2443641+MartinNowack@users.noreply.github.com> | 2024-01-12 12:00:35 +0000 |
| commit | 19b6ae578b0658115d15848604a28434845bb3e3 (patch) | |
| tree | 31d52545929760ad725385bd1cdc1153b710fc75 /tools/klee-ptree/DFSVisitor.h | |
| parent | fc83f06b17221bf5ef20e30d9da1ccff927beb17 (diff) | |
| download | klee-19b6ae578b0658115d15848604a28434845bb3e3.tar.gz | |
new: persistent ptree (-write-ptree) and klee-ptree
Introduce three different kinds of process trees:
1. Noop: does nothing (e.g. no allocations for DFS)
2. InMemory: same behaviour as before (e.g. RandomPathSearcher)
3. Persistent: similar to InMemory but writes nodes to ptree.db
and tracks information such as branch type, termination
type or source location (asm) in nodes. Enabled with
-write-ptree
ptree.db files can be analysed/plotted with the new "klee-ptree"
tool.
Diffstat (limited to 'tools/klee-ptree/DFSVisitor.h')
| -rw-r--r-- | tools/klee-ptree/DFSVisitor.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/klee-ptree/DFSVisitor.h b/tools/klee-ptree/DFSVisitor.h new file mode 100644 index 00000000..60d7b3bd --- /dev/null +++ b/tools/klee-ptree/DFSVisitor.h @@ -0,0 +1,31 @@ +//===-- DFSVisitor.h --------------------------------------------*- C++ -*-===// +// +// The KLEE Symbolic Virtual Machine +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#pragma once + +#include "Tree.h" + +#include <functional> + +/// @brief Traverses a process tree and calls registered callbacks for +/// intermediate and leaf nodes (not the classical Visitor pattern). +class DFSVisitor { + // void _(node ID, node, depth) + using callbackT = std::function<void(std::uint32_t, Node, std::uint32_t)>; + + const Tree &tree; + callbackT cb_intermediate; + callbackT cb_leaf; + void run() const noexcept; + +public: + DFSVisitor(const Tree &tree, callbackT cb_intermediate, + callbackT cb_leaf) noexcept; + ~DFSVisitor() = default; +}; |
