我想扫描clang的AST.我开始使用一个教程中提供的一些示例代码.
我目前的代码是
#include <iostream>
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/Casting.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Frontend/TextDiagnosticPrinter.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/FileSystemOptions.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Basic/FileManager.h"
#include "clang/Frontend/Utils.h"
#include "clang/Basic/TargetOptions.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/Version.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Frontend/FrontendOptions.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/Builtins.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Sema/Sema.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/Type.h"
#include "clang/AST/Decl.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Ownership.h"
#include "clang/AST/DeclGroup.h"
#include "clang/Parse/Parser.h"
#include "clang/Parse/ParseAST.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Rewrite/Core/Rewriter.h"
#include "clang/Rewrite/Frontend/Rewriters.h"
using namespace clang;
using namespace std;
// By implementing RecursiveASTVisitor, …Run Code Online (Sandbox Code Playgroud) 我正在编写一个内核模块,它将分配一些连贯的内存并返回相应的虚拟和物理地址.
我正在注册模块cdev,分配空间,dma_alloc_coherent()我想使用mmap dma_common_mmap().
dma_common_mmap()需要一个指针struct device:我怎么能得到它?
出于调试目的,我想找到一种方法来自动跟踪我的设计中涉及的变量的变化。
我想获得的结果就像每次分配变量时新值的printf,但没有手动插入所有printf。
做这个的最好方式是什么?谢谢