Skip to content

Commit 1e95e27

Browse files
committed
fix: lab8 no angr
1 parent b8a00a1 commit 1e95e27

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

.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 & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,11 @@ struct LLVMPass : public PassInfoMixin<LLVMPass> {
1111
PreservedAnalyses LLVMPass::run(Module &M, ModuleAnalysisManager &MAM) {
1212
LLVMContext &Ctx = M.getContext();
1313
IntegerType *Int32Ty = IntegerType::getInt32Ty(Ctx);
14-
IntegerType *Int64Ty = IntegerType::getInt64Ty(Ctx);
1514
FunctionCallee debug_func = M.getOrInsertFunction("debug", Int32Ty);
1615
ConstantInt *debug_arg = ConstantInt::get(Int32Ty, 48763);
1716

1817
for (auto &F : M) {
19-
if (!F.getName().equals("main"))
20-
continue;
21-
22-
IRBuilder<> Builder(&*F.getEntryBlock().getFirstInsertionPt());
23-
Builder.CreateCall(debug_func, debug_arg);
24-
25-
Argument *Arg1 = F.getArg(1);
26-
Value *Idx1 = ConstantInt::get(Int64Ty, 1);
27-
Value *Arg1Ptr = Builder.CreateInBoundsGEP(Type::getInt8PtrTy(Ctx), Arg1, Idx1);
28-
29-
Value *Kirito = Builder.CreateGlobalStringPtr("hayaku... motohayaku!", "hayaku");
30-
Builder.CreateStore(Kirito, Arg1Ptr);
31-
32-
Argument *Arg0 = F.getArg(0);
33-
for (Instruction &I : instructions(F)) {
34-
if (auto *SI = dyn_cast<StoreInst>(&I)) {
35-
if (SI->getValueOperand() == Arg0) {
36-
IRBuilder<> B(SI->getNextNode());
37-
B.CreateStore(debug_arg, SI->getPointerOperand());
38-
break;
39-
}
40-
}
41-
}
18+
errs() << "func: " << F.getName() << "\n";
4219

4320
}
4421
return PreservedAnalyses::none();

0 commit comments

Comments
 (0)