Thread: How do you debug your code

  1. #1
    Registered User
    Join Date
    Feb 2022
    Posts
    73

    How do you debug your code

    I use window operating system. I am looking debugger to debug c program. Which debugger will you recommend for debugging

    Is visual Studio a best choice?

  2. #2
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,111
    Quote Originally Posted by Dadu@ View Post
    I use window operating system. I am looking debugger to debug c program. Which debugger will you recommend for debugging

    Is visual Studio a best choice?
    If you are using gcc through MinGW64 or Cygwin, then gdb is your best choice. Not a big fan of any IDE especially Visual Studio. You didn't say which compiler you are using.

  3. #3
    Registered User
    Join Date
    Feb 2022
    Posts
    73
    I am using gcc through MinGW64 on windows

    can i set break point using gdb
    can i step through in code?

  4. #4
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,111
    Quote Originally Posted by Dadu@ View Post
    I am using gcc through MinGW64 on windows

    can i set break point using gdb
    can i step through in code?
    Yes, and Yes.

    There are many online tutorials for using gdb. The Official gdb manual is also online here.

    The answers to these two questions, and many others you will have, are found in these documents.

  5. #5
    Registered User
    Join Date
    Feb 2022
    Posts
    73
    I don't want to debug in terminal. Is it possible to debug in IDE

  6. #6
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,111
    You should learn to use the compiler and the debugger on the command line. IDE's are not some magic software that answers all your problems.

    Having said that, there are GUI front ends for GDB. KDbg is one that I have used in the past, although it is no longer available for Debian.

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > I don't want to debug in terminal. Is it possible to debug in IDE
    Yeah, CodeBlocks does a pretty reasonable job of driving the basics of gdb using the GUI.

    But what you can do in the GUI is only the tip of the iceberg compared to what you can do from the command line.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    Registered User
    Join Date
    Feb 2022
    Posts
    73
    @salem

    Personally which complier and Ide do you use to debug C program?

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    On Linux, I use code::blocks and GCC
    On Windows I use VS
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  10. #10
    Registered User
    Join Date
    Feb 2022
    Posts
    73
    @salem
    Which Linux distribution do you use?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help me debug this code
    By arwin622 in forum C Programming
    Replies: 4
    Last Post: 02-11-2021, 07:36 PM
  2. please debug the following code....
    By progmateur in forum C++ Programming
    Replies: 3
    Last Post: 12-04-2013, 11:57 AM
  3. Replies: 1
    Last Post: 03-10-2010, 11:28 AM
  4. Help me debug this code
    By Blgihted in forum C Programming
    Replies: 4
    Last Post: 10-28-2005, 07:39 AM
  5. DEBUG code
    By myer_784 in forum C Programming
    Replies: 12
    Last Post: 03-15-2005, 11:45 PM

Tags for this Thread