Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontends: llvm: log current working directory #1382

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ struct FuzzIntrospector : public ModulePass {
void logPrintf(int LogLevel, const char *Fmt, ...);
bool runOnModule(Module &M) override;


void getCurrentWorkingDirectory();
// Fuzz Introspector analysis for non-fuzzer binaries
void runIntrospectorOnNonFuzzerBinary(Module &M);

Expand Down Expand Up @@ -665,15 +667,31 @@ void FuzzIntrospector::runIntrospectorOnNonFuzzerBinary(Module &M) {
std::to_string(Idx++), RandomStr);
} while (llvm::sys::fs::exists(TargetLogName));
extractAllFunctionDetailsToYaml(TargetLogName, M);

/* Extract debugging information */
std::string nextDebugFile = TargetLogName + ".debug_info";
dumpDebugInformation(M, nextDebugFile);
}
}

void FuzzIntrospector::getCurrentWorkingDirectory() {
SmallString<128> Dir;
if (std::error_code EC = llvm::sys::fs::current_path(Dir)) {
logPrintf(L1, "Could not get the current path\n");
}

logPrintf(L1, "Curret WD: %s\n", Dir.str().str().c_str());
}

// Function entrypoint.
bool FuzzIntrospector::runOnModule(Module &M) {
// Require that FUZZ_INTROSPECTOR environment variable is set
if (!getenv("FUZZ_INTROSPECTOR")) {
return false;
}

getCurrentWorkingDirectory();

logPrintf(L1, "Fuzz introspector is running\n");
if (!getenv("FUZZ_INTROSPECTOR_CONFIG_NO_DEFAULT")) {
makeDefaultConfig();
Expand Down
Loading