24小时全年无休客服
本公司旗下写手皆为公司直聘 网络写手勿扰
案例中心
CSSE7231 C programming
C programming
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
CSSE2310/CSSE7231
Assignment 2 (Version 1.0)
Marks: 50
Weighting: 10%
Introduction 1
The goal of this assignment is to ensure you have gained familiarity and skills with both the C programming 2
language and using a debugger (such as gdb(1)) to examine various characteristics of running programs. These 3
will be essential skills in other assignments for this course. For this assignment you will be given an executable 4
program (the “bomb”) which you have to “defuse” by entering the correct defusing phrases into the program 5
for each of the 10 bomb phases. 6
Student Conduct 7
This is an individual assignment. You should work on defusing your own bomb by yourself. You should feel 8
free to discuss aspects of C programming and the use of debuggers with your fellow students, but you shouldn’t 9
actively help (or seek help from) anyone with the defusing of particular phases. Do not share your approaches 10
to solving the bomb phases – even after the assignment deadline (as extensions may be given to other students). 11
You should note that each student will receive a different bomb and the strings that defuse your bomb will 12
be different to the strings that defuse another student’s bomb. 13
In short – don’t risk it! If you’re having trouble, seek help early from a member of the teaching staff. 14
Don’t be tempted to cheat. You should read and understand the statements on student misconduct in the 15
course profile and on the school website: 16
https://eecs.uq.edu.au/current-students/guidelines-and-policies-students/student-conduct 17
Obtaining the “Bomb” 18
While logged in to moss.labs.eait.uq.edu.au, you should type the following command: 19
getbomb 20
This will create a subdirectory within your current directory named csse2310a2 and place the bomb files into 21
that directory. The files will include an executable called bomb and a number of source files (.h and .c files). 22
Your bomb (executable and source) will be different to the bombs for all other students. You will not receive 23
all of the source files – just some of them – so you will not be able to build the bomb yourself. There is enough 24
information contained within the bomb executable and the supplied source files in order for you to successfully 25
defuse all phases (although some of them are more difficult than others). You should note that some of the 26
bomb’s modules have been compiled with debugging support (-g flag to gcc) and some haven’t. 27
Running the “Bomb” 28
The bomb program will only run on moss.labs.eait.uq.edu.au and you are the only user who can run your 29
bomb program. The bomb can only be run directly from the shell (bash) or from a special version of gdb called 30
2310gdb1. Any attempt to run the program on another host or to run another user’s bomb or to run the bomb 31
from another parent process (e.g. gdb) will cause the bomb to exit. 32
While in your csse2310a2 directory, you can execute the bomb by typing 33
./bomb 34
12310gdb is a modified version of gdb that behaves the same in all regards except that it does not show the values of most of
the machine registers.
1
You may not want to do this until you are ready to try defusing the bomb. When you start the bomb program, 35
it will print out details of any phases you have already defused and it will print your current mark (out of 50) 36
and the maximum mark you can obtain based on your attempts to date. 37
The bomb will then prompt you to enter the number of the phase to defuse next, followed by the string that 38
you believe defuses that phase (or a test string). You will be prompted for confirmation before that string is 39
tested. If you confirm your attempt and the string is incorrect then the bomb will “explode” and exit. If the 40
string is correct, then that phase is defused and you will not be able to solve it again. You will lose marks for 41
every time the bomb “explodes”. 42
The goal of this assignment is to enter the correct defusing strings for each phase, not to “hack” the bomb so 43
that it thinks the phases have been defused. The bomb checks for attempts to tamper with the bomb and will 44
“explode” if tampering is detected (e.g. if internal variables or data structures are modified in a way that causes 45
the required defusing string to change). We also log all defusing attempts and will adjust marks afterwards (i.e. 46
reduce your marks) if the bomb has not been properly defused. 47
Note that you can not undo an attempt or start the process over. You can always obtain a new copy of the 48
same bomb by running getbomb again but your previous attempts will be remembered by the system. The only 49
likely reason that you need to obtain a new copy of your bomb is if you inadvertently modify the source code 50
to the bomb. (This won’t impact the running of the bomb itself – since you can’t rebuild the executable – but 51
it will impact the code listings that you see in 2310gdb which may cause confusion.) 52
Hints 53
There are two demo phases that do not count for marks. You may attempt these as many times as you like by 54
entering either “demo1” or “demo2” when prompted for a phase to defuse. There is no mark penalty if either 55
of these demo phases “explodes.” 56
You should carefully read the supplied source code and be familiar with the use of gdb before attempting 57
to run the bomb. It is suggested you run the bomb from within the provided debugger (2310gdb) rather than 58
standalone but note that attempts to defuse the bomb through the debugger are counted just the same as those 59
without using a debugger – i.e. if the bomb explodes when run through the debugger then this attempt still 60
counts. Note that you may get a warning message about “Missing separate debuginfos...” when you run 61
the bomb within 2310gdb – you can safely ignore this message. 62
All phases have associated code and some debugging information and you will need to use a debugger to 63
set breakpoints, examine various variables etc. in order to determine the defusing strings. You may need to 64
learn about and use a number of features of gdb including (but possibly not limited to) watchpoints, automatic 65
display, conditional breakpoints, and/or breakpoint command lists to solve the phases more efficiently. 66
You should note that the code that determines each defusing string is not executed until AFTER the defusing 67
text is read from the user so you will need to enter some arbitrary text, debug the code to determine the defusing 68
string, quit the program and then run it again to enter the defusing string for that phase. 69
The bomb is deterministic – the same sequence of inputs from program startup will result in the same 70
operation each time, so the defusing string for each phase will not vary between runs of the bomb. However, 71
many of the functions within the bomb are not deterministic – they may return something different each time 72
they are called, and they may change internal data structures. This means that a defusing string may change 73
over time within a single run of the bomb program if you call functions from within 2310gdb. Your goal is to 74
determine the defusing string that would have to be entered from a fresh run of the bomb – not the defusing 75
string that might apply after you have perhaps modified the internal state of the bomb by using 2310gdb 76
commands. 77
Submission 78
Every time you run the bomb, a record is kept of your interactions with it and your success/failure at defusing 79
each phase so no formal assignment submission is necessary – you can stop when you’ve solved all the phases 80
or when you are satisfied with your mark. 81
Your submission time for the assignment will be considered to be the time of your last attempt to 82
defuse any phase of the bomb. You must make at least one attempt in order to be considered to have made 83
a submission. An attempt means either that the bomb explodes or a phase is defused. 84
Late penalties will apply as described in the CSSE2310/CSSE7231 course profile. Any attempt to defuse the 85
bomb after the deadline (or your extended deadline) will result in a late penalty being applied to your whole 86
assignment mark. You may run the bomb program after the deadline in order to check your mark but if you 87
2
attempt to defuse the bomb (i.e. the bomb explodes or you successfully defuse a phase) then a penalty will 88
apply. 89
Marks 90
There are 10 phases, each worth 5 marks. The mark you achieve for each phase is determined by the number 91
of attempts taken before you successfully defuse that phase. If you do not defuse a phase you will receive zero 92
marks for that phase. If you defuse a phase on the first attempt, you will receive 5 marks for that phase. If it 93
takes you more than one attempt (say N attempts), your mark for that phase will be 94
4× 0.75(N−2) 95
i.e. if it takes you 2 attempts, your mark for that phase will be 4 out of 5; 3 attempts gives you 3 out of 5; 4 96
attempts gives you 2.25 out of 5; etc. There is no limit on the number of attempts you can make at any phase 97
before succeeding. You should note that although each phase is worth the same number of marks, they are not 98
of equal difficulty. All marks are subject to an audit of our logs to ensure that you have correctly entered the 99
defusing strings and haven’t tampered with the bomb to defuse it in some other way. If you have not defused 100
a phase with the expected defusing string then you will receive zero marks for that phase. 101