Skip to content

Commit c01fa11

Browse files
committed
fix: lab8 no angr
1 parent 81469af commit c01fa11

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
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 & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,7 @@ PreservedAnalyses LLVMPass::run(Module &M, ModuleAnalysisManager &MAM) {
1515
ConstantInt *debug_arg = ConstantInt::get(Int32Ty, 48763);
1616

1717
for (auto &F : M) {
18-
//errs() << "func: " << F.getName() << "\n";
19-
if(F.getName() == "main")
20-
{
21-
//1. get into debug mode with id = 48763
22-
IRBuilder<> Builder(&*F.getEntryBlock().getFirstInsertionPt());
23-
Builder.CreateCall(debug_func, {debug_arg});
24-
25-
//2. let argv[1] to custom string
26-
Argument *argvArg = F.getArg(1);
27-
Value *index = ConstantInt::get(Int32Ty, 1);
28-
Value *argv_ptr = Builder.CreateInBoundsGEP(Builder.getInt8PtrTy(), argvArg, index); //指標指向的型別 (i8*)
29-
Value *custom = Builder.CreateGlobalStringPtr("hayaku... motohayaku!");
30-
Builder.CreateStore(custom, argv_ptr); //將argv[1]位址指向custom並儲存
31-
32-
//3. change argc to 48763
33-
Argument *argcArg = F.getArg(0);
34-
argcArg->replaceAllUsesWith(debug_arg);
35-
}
18+
errs() << "func: " << F.getName() << "\n";
3619

3720
}
3821
return PreservedAnalyses::none();

0 commit comments

Comments
 (0)