After starting up GDB with the `phase03' program, the `run' command will yield the following output ,---- | > gdb ./phase03 | ... | | (gdb) run | Starting program: ./phase03 | usage: ./phase03 | [Inferior 1 (process 1943881) exited with code 01] `---- which means that the `phase03' program wants a command line argument. How does one accomplish this in GDB? - ( ) Use the command `set args input.txt' once and then each `run' will use those arguments - ( ) Use the command `run input.txt' each time you run - ( ) Either of the above will work - ( ) Start GDB as `gdb ./phase03 input.txt' Which of the following commands will set a breakpoint in GDB at the line that reads `int hit = shot ^ targ;'? - ( ) `break int hit = shot ^ targ' - ( ) `break phase03' - ( ) `break phase03.c:31' - ( ) `break next hit' After hitting the specified breakpoint, which of the following GDB commands will advance to the next **breakpoint** that is set? - ( ) `next' - ( ) `continue' - ( ) `run' - ( ) `advance'
Solve all three parts:
After starting up GDB with the `phase03'
will yield the following output
,----
| > gdb ./phase03
| ...
|
| (gdb) run
| Starting program: ./phase03
| usage: ./phase03 <infile>
| [Inferior 1 (process 1943881) exited with code 01]
`----
which means that the `phase03' program wants a command line
argument. How does one accomplish this in GDB?
- ( ) Use the command `set args input.txt' once and then each `run'
will use those arguments
- ( ) Use the command `run input.txt' each time you run
- ( ) Either of the above will work
- ( ) Start GDB as `gdb ./phase03 input.txt'
Which of the following commands will set a breakpoint in GDB at the
line that reads `int hit = shot ^ targ;'?
- ( ) `break int hit = shot ^ targ'
- ( ) `break phase03'
- ( ) `break phase03.c:31'
- ( ) `break next hit'
After hitting the specified breakpoint, which of the following GDB
commands will advance to the next **breakpoint** that is set?
- ( ) `next'
- ( ) `continue'
- ( ) `run'
- ( ) `advance'
Step by step
Solved in 5 steps