Find the answer to your Linux question:
Results 1 to 3 of 3
I'm a beginer on using gdb debug. Following is the debug process. when enter "c" ,the program is run and printf an prompt to tell me to enter some command ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2013
    Location
    China
    Posts
    5

    Question ask some gdb skills


    I'm a beginer on using gdb debug. Following is the debug process. when enter "c" ,the program is run and printf an prompt to tell me to enter some command ,but how to know where the program is go to? I want the program stop and watch where the program run to. thanks.


    (gdb) c
    Continuing.
    (/home/abing/Yunio/GIU800/kermit1/) C-Kermit>

  2. #2
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    636
    You need to "step" or set a "breakpoint" because "continue" (your c command) simply says to continue running and it will run to it hits a "breakpoint". If you are running a GUI, look at "ddd" which is QUI wrapper to gdb.

  3. #3
    Just Joined!
    Join Date
    Dec 2008
    Location
    Lund, Sweden
    Posts
    31
    If you stop the program with ctrl-c when it waiting for you input after the prompt (or indeed whenever you want to stop the program), control will be returned to gdb which will tell you where the program has stopped. You can then continue with the 'c' (continue) gdb command if you want to continue running the program, or run it step by step using the 'n' (next) and 's' (step) gdb commands.

    The difference between 'n' and 's' is that 'n' steps to the next line while running function calls at full speed, whereas 's' steps into functions that are called. Often you want to step into function that you have written yourself, but not library calls such as printf.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •