Thread: C::B breakpoints problem

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    31

    Question C::B breakpoints problem

    Hey,

    I've googled this issue (breakpoints are ignored in my Code Blocks installation) and it was suggested to someone that they download some kind of nightly build. I don't know what that is and was wandering if there was a way to fix my problem through settings changes or something less fundamental.

    For any interested in helping (thx in advance) my setup is Ubuntu 9.10 with C::B 8.02. Is this some kind of debugger problem?

    Thanks

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I never had an issue with breakpoints being ignored for Code::Blocks 8.02. You are using gdb, right? Which version is it?

    (Oh, and I really wish that the Code::Blocks developers would just devote a month to get a arbitrarily chosen nightly tested more thoroughly for a new release.)
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    31
    Hi again,

    I'm using the GNU GCC compiler. Everything is as default because I'm very new to all this. Is GDB a compiler?
    Thanks

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    gdb is a command line debugger.

    There are several GUI frontends to gdb, eg see here:

    http://cboard.cprogramming.com/progr...linux-ddd.html

    However, altho it seems very awkward at first, I'd recommend finding a gdb tutorial and trying to use it on the command line for a while. Once you can remember a few simple commands (run, list, break, cont, print, backtrace) and understand the output, using gdb in terminal is pretty quick and easy, since you are compiling and testing in the terminal too:
    Code:
    [root~/C] gcc test.c
    [root~/C] ./a.out
    Segmentation fault
    // damn, what'd I do this time?
    [root~/C] gcc -g test.c   // use -g to compile with debugging symbols 
    [root~/C] gdb ./a.out  // start gdb with the executable loaded 
    (gdb) run
    Starting program: /media/sda6/root/C/a.out 
    
    Program received signal SIGSEGV, Segmentation fault.
    memcpy () at ../sysdeps/x86_64/memcpy.S:91
    91		movl	%ecx, (%rdi)
    Current language:  auto; currently asm
    (gdb) backtrace
    #0  memcpy () at ../sysdeps/x86_64/memcpy.S:91
    #1  0x00000000004004e7 in main () at test.c:8
    (gdb) quit
    The program is running.  Exit anyway? (y or n) y
    [root~/C]
    All the info handily remains in the terminal, and I have the line number that led to the seg fault.
    Last edited by MK27; 02-18-2010 at 10:19 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Kayl669
    I'm using the GNU GCC compiler. Everything is as default because I'm very new to all this. Is GDB a compiler?
    As MK27 has indicated, gdb is a debugger, i.e., the GNU debugger.

    Quote Originally Posted by MK27
    There are several GUI frontends to gdb, eg see here:

    GUI Debugger for linux -- DDD
    Of course, Code::Blocks itself is a GUI frontend for gdb, but integrated with a text editor, etc. Unless you really cannot get gdb to work with Code::Blocks, or prefer DDD, it does not make sense to use DDD in this case. Likewise...

    Quote Originally Posted by MK27
    since you are compiling and testing in the terminal too:
    ... you will probably not be compiling and testing in the terminal should you decide to continue using Code::Blocks. Of course, you should test in the terminal before releasing your command line program, hence you should at least know how to run your programs in the terminal anyway.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM