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

Bug 308678

Summary: Variable view fails to show details for variables in qualified base class
Product: [Tools] CDT Reporter: Elena Laskavaia <elaskavaia.cdt>
Component: cdt-debug-dsf-gdbAssignee: Marc Khouzam <marc.khouzam>
Status: RESOLVED FIXED QA Contact: Marc Khouzam <marc.khouzam>
Severity: normal    
Priority: P3 CC: aegges, martin.jakl, pawel.1.piech, rstanzel, stuart.i.campbell
Version: 7.0   
Target Milestone: 8.0.1   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Elena Laskavaia CLA 2010-04-09 13:49:21 EDT
Inspired by bug 304010. I fixed it in CDI but same problem in DSF
using gdb 6.8

#include <iostream>
using namespace std;

namespace n {
	class Base {
	private:
		int pri;
	public:
		int baseVar;
		Base() : baseVar (42), pri(42) {}
	};
}

class A : public n::Base{
private:
	int pri;
public:
	int aVar;
	A() : aVar(1), pri(1){}
};

void main(){
   A test; // if you try to view baseVar in details it fails
   //...
}



The problem is gdb itself returns incorrect result for path expr of base "Base" member

105,281 108-var-info-path-expression var1.n::Base.public.baseVar
105,282 108^done,path_expr="((((n::Base) test)).baseVar)"

So when it is requested it cannot show the expression because it required namespace stuff surrounded by ''

110,169 114-data-evaluate-expression "((((n::Base) test)).baseVar)"
110,169 115-var-set-format var1.n::Base.public.baseVar binary
110,170 &"A syntax error in expression, near `test)).baseVar)'.\n"
110,170 114^error,msg="A syntax error in expression, near `test)).baseVar)'."


It is unlikely that GDB will fix it so I think it should be fixed in CDT
because it is really annoying (no namespace stuff can be viewed!)

Maybe we can write some simple tockenizer that finds strings like a::b and quotes them before sending evaluate expression command
Comment 1 Marc Khouzam CLA 2010-07-19 11:50:24 EDT
*** Bug 317960 has been marked as a duplicate of this bug. ***
Comment 2 Axel Mueller CLA 2010-08-15 18:16:30 EDT
In bug #320277 I have proposed a patch that would fix this problem here.
Comment 3 Marc Khouzam CLA 2011-09-07 10:57:38 EDT
This bug has been fixed in GDB 7.2 (according to my tests).

Also, it has been fixed in DSF-GDB with the fix of bug 320277, which is valuable for GDB 6.8, 7.0 and 7.1

Thanks Axel for contributing the fix.