openSUSE Forums > Programming/Scripting » C++ debugging in openSUSE 11.1

Go Back   openSUSE Forums > Programming/Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 30-Sep-2009, 06:19
Puzzled Penguin
 
Join Date: Sep 2009
Posts: 1
edruon hasn't been rated much yet
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
Reply With Quote
  #2 (permalink)  
Old 30-Sep-2009, 10:08
roberto60's Avatar
Explorer Penguin
 
Join Date: Jul 2008
Posts: 116
roberto60 hasn't been rated much yet
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
Reply With Quote
Reply

Bookmarks

Tags
argument by value, c++, gdb


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2