retdec
debug.h
Go to the documentation of this file.
1 
7 #ifndef INCLUDE_RETDEC_BIN2LLVMIR_UTILS_DEBUG_H_
8 #define INCLUDE_RETDEC_BIN2LLVMIR_UTILS_DEBUG_H_
9 
10 #include <iomanip>
11 #include <iostream>
12 #include <sstream>
13 #include <string>
14 
15 #include <llvm/IR/Module.h>
16 #include <llvm/Support/raw_ostream.h>
17 
19 
20 namespace retdec {
21 namespace bin2llvmir {
22 
26 #define LOG \
27  if (!debug_enabled) {} \
28  else std::cout << std::showbase
29 
36 template<typename T>
37 std::string llvmObjToString(const T* t)
38 {
39  std::string str;
40  llvm::raw_string_ostream ss(str);
41  if (t)
42  t->print(ss);
43  else
44  ss << "nullptr";
45  return ss.str();
46 }
47 std::string llvmObjToString(const llvm::Module* t);
48 
49 void dumpModuleToFile(
50  const llvm::Module* m,
51  fs::path dirName,
52  const std::string& fileName = "");
54  llvm::Module* m,
55  fs::path dirName,
56  const std::string& fileName = "control-flow.json");
57 
58 } // namespace bin2llvmir
59 } // namespace retdec
60 
61 #endif
Wrapper for conditional include of C++17 filesystem feature.
The frontend-end part of the decompiler.
void dumpModuleToFile(const llvm::Module *m, fs::path dirName, const std::string &fileName="")
Definition: debug.cpp:55
std::string llvmObjToString(const T *t)
Definition: debug.h:37
void dumpControFlowToJson(llvm::Module *m, fs::path dirName, const std::string &fileName="control-flow.json")
Definition: debug.cpp:328
Definition: archive_wrapper.h:19