Home > OS >  Inside the GDB debugging why I don't input the list shows the file content
Inside the GDB debugging why I don't input the list shows the file content

Time:09-19

CodePudding user response:

Is there a set breakpoints? Didn't set up, run just perform it, again the list program has withdrawn from the
You take step, step by step to walk, try to list

CodePudding user response:

 with the step tips must run, source code is also included,

CodePudding user response:

reference 1st floor qybao response:
set breakpoints? Didn't set up, run just perform it, again the list program has withdrawn from the
You use step, step by step to walk before you try a list
using the step like or not, the specific source code in the down stairs

CodePudding user response:

The light on your program code is wrong, the string is null pointer
You change program, take the static char * string; To the static char * string=buff;//let the string points to a valid memory address
Then use the command execution GDB (execute commands at the back of the comments, not comment only on command)
GDB bug//start GDB
Break main//set breakpoints (the main set in the main method of entry), can also break n (n is a row)
The run//to run the program, stop at a breakpoint
List//display code, can be a list of n (n said since the first n rows display code, using interval can also)
Step//said step
The run//because there is no a breakpoint, so will always perform to the end of the program

CodePudding user response:

reference 4 floor qybao response:
light on your program code is wrong, the string is null pointer
You change program, take the static char * string; To the static char * string=buff;//let the string points to a valid memory address
Then use the command execution GDB (execute commands at the back of the comments, not comment only on command)
GDB bug//start GDB
Break main//set breakpoints (the main set in the main method of entry), can also break n (n is a row)
The run//to run the program, stop at a breakpoint
List//display code, can be a list of n (n said since the first n rows display code, using interval can also)
Step//said step
The run//because there is no a breakpoint, so will always perform to the end of the program

Code itself is wrong this I know, it is through the error code of practice breakpoint debugging, I look at our teacher's code is to run out after a period of errors, then through the where and the list can see the code to run to which step to stop, then set a breakpoint,

CodePudding user response:

Well, look at the above you to debug the error, should be run up, also prompts you to enter, just gets error function, the program stay iogets. C, didn't stay in your bug. C, so you can't see the bug list. C information, see only iogets. C function tips (estimate system without the debug information can't debug file compile time)
Than you can perform
Info source//look at the current stop in which source files, isn't a bug. C

Then use the
List the main//can see shows the main function of the code?

CodePudding user response:

refer to 6th floor qybao response:
well, look at the above you to debug the error, should be run up, also prompts you to enter, just gets error function, the program stay iogets. C, didn't stay in your bug. C, so you can't see the bug list. C information, see only iogets. C function tips (estimate system without the debug information can't debug file compile time)
Than you can perform
Info source//look at the current stop in which source files, isn't a bug. C

Then use the
List the main//can see shows the main function of the code?
that's true, I input the info source display file stop in ingest. C, then list the main can also show that the main function, but why would jump to the iogets. C file, my source files and operation and the teacher, he used the list can be, I will not,
  • Related