Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 317960

Summary: Incorrect handling of namespaces in debugger
Product: [Tools] CDT Reporter: Martin Jakl <martin.jakl>
Component: cdt-debug-dsf-gdbAssignee: Project Inbox <cdt-debug-dsf-gdb-inbox>
Status: RESOLVED DUPLICATE QA Contact: Marc Khouzam <marc.khouzam>
Severity: critical    
Priority: P3 CC: aegges, pawel.1.piech, stuart.i.campbell
Version: 7.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Martin Jakl CLA 2010-06-25 08:39:05 EDT
CDT asks gdb incorrectly for member variables in base classes when namespace is defined. When I click on such variable in Variables window I get error:

Failed to execute MI command:
-data-evaluate-expression "(((*(palo::Commitable*) ((server).px))).comm_name)"
Error message from debugger back end:
A syntax error in expression, near `) ((server).px))).comm_name)'.

That's because gdb requires quotation marks aroud type with namespace like: (((*('palo::Commitable'*) ((server).px))).comm_name) 

-- Configuration Details --
Product: Eclipse 1.3.0.20100617-0520 (org.eclipse.epp.package.linuxtools.product)
Installed Features:
 org.eclipse.platform 3.6.0.v20100602-9gF78GpqFt6trOGhL60z0oEx3fz-JKNwxPY
Comment 1 Marc Khouzam CLA 2010-06-25 15:55:59 EDT
Can you add a snippet of code to reproduce the problem?
Comment 2 Martin Jakl CLA 2010-06-26 10:51:16 EDT
Just create new C++ project and add this code:

#include <string>

namespace test {

class testbase {
public:
	testbase() : str("test") {}
private:
	std::string str;
};

class test : public testbase {
};

}

int main(void)
{
	test::test t;
	return 0;
}


Now debug it and make one step. Go to variables windows and expand t and test::testbase and click on str. You get error message "Failed to execute MI command:
-data-evaluate-expression "((((test::testbase) t)).str)"
Error message from debugger back end:
A syntax error in expression, near `t)).str)'."

When you right click str and select watch and then edit the expression to be: (((('test::testbase') t)).str), than you'll get the value.
Comment 3 Axel Mueller CLA 2010-07-19 10:48:14 EDT
Looks like a duplicate of bug #308678
Comment 4 Marc Khouzam CLA 2010-07-19 11:50:24 EDT
Thanks Axel, it does indeed look like a duplicate.

*** This bug has been marked as a duplicate of bug 308678 ***