Results 1 to 2 of 2

Thread: C++ debugging in openSUSE 11.1

  1. #1
    edruon NNTP User

    Exclamation C++ debugging in openSUSE 11.1

    I'm having a problem with gdb (standard version 6.8.50.20081120-cvs) while trying to debug a C++ program compiled with the standard C++ compiler (gcc version 4.3.2 [gcc-4_3-branch revision 141291]).
    When debugging a function where arguments are provided by value, the local object within the function is not rightly referenced in the debugger.
    As an example, here is a simple piece of code to illustrate the problem :

    Code:
    #include <iostream>
    
    using namespace std;
    
    class Obj {
    private:
    	int i;
    public:
    	Obj();
    	Obj(const Obj&);
    	void show();
    };
    
    Obj::Obj(const Obj& other) {
    	i = other.i;
    }
    
    Obj::Obj() {
    	i = 1;
    }
    
    void Obj::show() {
    	cout << "hello\n";
    }
    
    void f(Obj S) {
    	S.show();
    	cout << &S << endl;
    }
    
    int main() {
    	Obj A;
    	f(A);
    	return 0;
    }
    If you try to debug this program the S object in function f cannot be debugged with gdb. There seems to be some mismatch with the object address if you compare it within the function, in the copy constructor (which is just there to prove this fact) and the this pointer in the show member function call.

    If I go back to version 4.1 of the compiler, things are all right...

    So it seems to be a debug info mismatch between the gdb and gcc.

    Does anybody have a solution ?

    Manny

  2. #2

    Default Re: C++ debugging in openSUSE 11.1

    Try to see if this bug can apply to your case:

    https://bugzilla.novell.com/show_bug.cgi?id=509527#c1

    The solution is to upgrade the gcc
    Saluti
    R

Tags for this Thread

Posting Permissions

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