Skip to content

Commit 7c8aa2a

Browse files
committed
fix: lab8 no angr
1 parent aa48f94 commit 7c8aa2a

2 files changed

Lines changed: 4 additions & 27 deletions

File tree

.github/workflows/lab-autograding.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,7 @@ jobs:
5656
if [ ${{ steps.lab.outputs.result }} -eq 6 ]; then
5757
sudo apt install -y llvm-14
5858
fi
59+
if [ ${{ steps.lab.outputs.result }} -eq 8 ]; then
60+
python3 -m pip install angr
61+
fi
5962
./validate.sh

lab6/llvm-pass.so.cc

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,9 @@ PreservedAnalyses LLVMPass::run(Module &M, ModuleAnalysisManager &MAM) {
1313
IntegerType *Int32Ty = IntegerType::getInt32Ty(Ctx);
1414
FunctionCallee debug_func = M.getOrInsertFunction("debug", Int32Ty);
1515
ConstantInt *debug_arg = ConstantInt::get(Int32Ty, 48763);
16-
PointerType *CharPtrTy = Type::getInt8PtrTy(Ctx);
17-
18-
1916

2017
for (auto &F : M) {
21-
22-
23-
24-
// Find main function, call the debug function with argument 48763
25-
26-
if (F.getName() == "main"){
27-
IRBuilder<> Builder(&*F.getEntryBlock().getFirstInsertionPt());
28-
Builder.CreateCall(debug_func, {debug_arg});
29-
30-
// Overwrote argv1 with string "hayaku... motohayaku!"
31-
Argument *argvArg = F.getArg(1);
32-
Value *index1 = ConstantInt::get(Int32Ty, 1);
33-
Value *argv1_ptr = Builder.CreateInBoundsGEP(CharPtrTy, argvArg, index1);
34-
Value *hayakuStr = Builder.CreateGlobalStringPtr("hayaku... motohayaku!");
35-
Builder.CreateStore(hayakuStr, argv1_ptr);
36-
37-
// Overwrote argcArg with 48763
38-
Argument *argcArg = F.getArg(0);
39-
argcArg -> replaceAllUsesWith(debug_arg);
40-
41-
}
42-
43-
44-
18+
errs() << "func: " << F.getName() << "\n";
4519

4620
}
4721
return PreservedAnalyses::none();

0 commit comments

Comments
 (0)