Solve both parts ,---- | /// INITIAL /// | void phase02(){ | int a = atoi(next_input()); | > int b = atoi(next_input()); | int c = atoi(next_input()); | .... | | char *next_input(){ | input_idx++; | int ret = fscanf(input_fh, "%s", inputs[input_idx]); | ... | `---- When the `next' command is executed by GDB, then the debugger executes some code and leaves the state of the running program in one of the following positions: ,---- | /// OPTION A /// | void phase02(){ | int a = atoi(next_input()); | int b = atoi(next_input()); | > int c = atoi(next_input()); | .... | | char *next_input(){ | input_idx++; | int ret = fscanf(input_fh, "%s", inputs[input_idx]); | ... | | /// OPTION B /// | void phase02(){ | int a = atoi(next_input()); | > int b = atoi(next_input()); | int c = atoi(next_input()); | .... | | char *next_input(){ | input_idx++; | int ret = fscanf(input_fh, "%s", inputs[input_idx]); | ... | | /// OPTION C /// | void phase02(){ | int a = atoi(next_input()); | int b = atoi(next_input()); | int c = atoi(next_input()); | .... | | char *next_input(){ | > input_idx++; | int ret = fscanf(input_fh, "%s", inputs[input_idx]); | ... `---- (A) After executing `next', which option correctly indicates where GDB will get control back? (B) Instead of using the `next' command in the above example, what if the `step' command was used instead from the `INITIAL' position? Which `OPTION' represents the code position GDB would be at after `step'
Solve both parts
,----
| /// INITIAL ///
| void phase02(){
| int a = atoi(next_input());
| > int b = atoi(next_input());
| int c = atoi(next_input());
| ....
|
| char *next_input(){
| input_idx++;
| int ret = fscanf(input_fh, "%s", inputs[input_idx]);
| ...
|
`----
When the `next' command is executed by GDB, then the debugger executes
some code and leaves the state of the running program in one of the
following positions:
,----
| /// OPTION A ///
| void phase02(){
| int a = atoi(next_input());
| int b = atoi(next_input());
| > int c = atoi(next_input());
| ....
|
| char *next_input(){
| input_idx++;
| int ret = fscanf(input_fh, "%s", inputs[input_idx]);
| ...
|
| /// OPTION B ///
| void phase02(){
| int a = atoi(next_input());
| > int b = atoi(next_input());
| int c = atoi(next_input());
| ....
|
| char *next_input(){
| input_idx++;
| int ret = fscanf(input_fh, "%s", inputs[input_idx]);
| ...
|
| /// OPTION C ///
| void phase02(){
| int a = atoi(next_input());
| int b = atoi(next_input());
| int c = atoi(next_input());
| ....
|
| char *next_input(){
| > input_idx++;
| int ret = fscanf(input_fh, "%s", inputs[input_idx]);
| ...
`----
(A) After executing `next', which option correctly indicates where GDB
will get control back?
(B) Instead of using the `next' command in the above example, what if the
`step' command was used instead from the `INITIAL' position? Which
`OPTION' represents the code position GDB would be at after `step'?
Step by step
Solved in 3 steps