Strange behavior in gdb 5.3 on suse linux

From: Sunil Matta (smatta_at_acm.org)
Date: 09/30/04

  • Next message: Moe Trin: "Re: RedHat 3.0.3"
    Date: 29 Sep 2004 16:58:24 -0700
    
    

    Running gdb version 5.3 on Suse Linux.
    I am using g++ version 3.2.2
    I am specifing compiler swithces -g and have also tried -ggdb for more
    debugging information.

    Lots of weird behavior when running gdb to check data. Here is a small
    example of the problem that I am having.
    I am unable to print the value of variable i in the code below.

    When stepping into a block of code like this:
    (gdb) list
    40 int matsize = strike_.size() * tau_.size();
    41 for( int i = 0; i < (strike_.size() * tau_.size()); i++ )
    42 {
    43 cout << i << endl;
    44 position_.push_back(100);
    45 }
    (gdb) where 1
    #0 PAAParams (this=0xbffff110) at PAAParams.cpp:44
    (More stack frames follow...)
    (gdb) print i
    No symbol "i" in current context.
    (gdb) print strike_.size() * tau_.size()
    $1 = 84

    Note that I am on line 41 and still cannot print variable i inside the
    for loop !!! I am expecting the value of i to be 0<= i <= 84.
    The variable does get printed to cout with values upto 84 !

    At the end of the loop, vector's size i.e. position_.size() == 84 !
    which is correct. Therefore I do know that the code is being executed.

    I also am not able to step into some parts of my code, also compiled
    with the same debug switches.

    Are there any more compile swithes that I should be setting ? I have
    always used -g for generating debug and symbol tables.

    What could be causing this problem ?

    Sunil


  • Next message: Moe Trin: "Re: RedHat 3.0.3"

    Relevant Pages

    • Re: Not able to debug Core, SunOS 5.10, Gdb also crash.
      ... core using gdb, GDB itself crashes and gives core. ... got so many warnings but currenty I need to Ignore compilers warning-- ... 64-bit sparcv9 applications ... to debug 10,000 lines of code bad enough to crash the compiler; ...
      (comp.unix.solaris)
    • Re: Not able to debug Core, SunOS 5.10, Gdb also crash.
      ... core using gdb, GDB itself crashes and gives core. ... got so many warnings but currenty I need to Ignore compilers warning-- ... 64-bit sparcv9 applications ... to debug 10,000 lines of code bad enough to crash the compiler; ...
      (comp.unix.solaris)
    • Re: I dont understand why the compiler does this.
      ... If your compiler actually accepts the line above, it is broken, or you ... try to modify characters using the pointer that you pass it. ... > When I run this under the gnu debugger, ... > GNU gdb 4.18 ...
      (comp.programming)
    • Re: C99 IDE for windows
      ... the filetype to invoke the C compiler. ... I've used Jacob's lcc before and profited from it. ... Binary utilities for AVR target. ... GDB is a command-line debugger. ...
      (comp.lang.c)
    • gdb on 64 bit programs: no crash analysis
      ... I currently encounter problems using "gdb" with 64 bit programs ... I downloaded it as a RPM package from the IBM site ... so I get a core file. ... In the 64 bit version, the compiler is used with the "-q64" option, ...
      (comp.unix.aix)