Pb - debugging C++ in Eclipse Ganymede

Discussion in 'Mac Programming' started by jujuwie, Nov 5, 2008.

  1. jujuwie macrumors newbie

    Joined:
    Nov 5, 2008
    #1
    Hello,

    I am new to Mac (Mac OS X Version 10.5.5) and I want to debug a C++ application in Eclipse Ganymede (using darwin).

    When debugging the following simple sample application...
    #include <iostream>
    #include <vector>
    using namespace std;

    int main() {
    vector<int> myNumbers(5, 11);
    for (int i = 0; i < (int) myNumbers.size(); i++) {
    cout << myNumbers.at(i) << " ";
    }
    return 0;
    }


    , I cannot gain insight into the values of the single elements of the vector but I get the following message...

    Target request failed: Cannot look up value of a typedef.
    (remark: in project settings > C/C++ Build > Settings > GCC C++ Compiler > Debugging -> Debug Level is set to Maximum (-g3) which I think is default value)

    Would be great if anybody could help me to solve this problem because I don't feel like instrumenting all my code ;-)

    Thanks,
    Judith
     
  2. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #2
    What is the program doing that you did not want or expect?

    It should print out:
    11 11 11 11 11
    with no new line at the end.

    What kind of insight into your vector, exactly, are you trying to gain with the debugger? Are you trying to peek into it's internal structure? Don't expect to do that in gdb.
     
  3. jujuwie thread starter macrumors newbie

    Joined:
    Nov 5, 2008
    #3
    Actually, this is just a sample program and it does what I expected it to do but when I am debugging, I can't see the elements of the vector. (Imagine a complex pgm with a vector of a complex data type in which case I want to see the values of the objects of the vector) When I select the vector in my debugging view all "info" which I get is...

    Target request failed: Cannot look up value of a typedef.
     
  4. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #4
    Depending on the version of gdb under the hood, it may or may not be able to traverse library templates as transparently as you might like.

    What version of gdb is installed on your platform?

    Also, rather than using the eclipse front end, try DDD.
     
  5. jujuwie thread starter macrumors newbie

    Joined:
    Nov 5, 2008
    #5

    mtec-hg-docking-1-dhcp-232:gdb JuWie$ gdb -v
    GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "i386-apple-darwin".


    Actually, I have never used DDD and I would be glad if I could stick to the Eclipse interface since I am very familiar with that (or at least with the Java version)

    Somebody just told me that apparently when debugging C++ the debugger can never resolve std.containers (e.g. list) and hence, it is not possible to view the single elements. is that true?? if so, is there any other way to do so?

    thx!
     

Share This Page