Index: mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java,v retrieving revision 1.8 diff -u -r1.8 MIFrame.java --- mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java 23 Jun 2006 17:25:39 -0000 1.8 +++ mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java 30 Mar 2007 16:22:37 -0000 @@ -102,15 +102,19 @@ str = str.trim(); if ( str.equals( "??" ) ) //$NON-NLS-1$ func = ""; //$NON-NLS-1$ - else - { + else { + func = str; // In some situations gdb returns the function names that include parameter types. // To make the presentation consistent truncate the parameters. PR 46592 - int end = str.indexOf( '(' ); - if ( end != -1 ) - func = str.substring( 0, end ); - else - func = str; + // However PR180059: only cut it if it is last brackets represent parameters, + // because gdb can return: func="(anonymous namespace)::func2((anonymous namespace)::Test*)" + int closing = str.lastIndexOf(')'); + if (closing == str.length() - 1) { + int end = getMatchingBracketIndex(str, closing - 1); + if (end >= 0) { + func = str.substring(0, end); + } + } } } } else if (var.equals("file")) { //$NON-NLS-1$ @@ -131,4 +135,17 @@ } } } + + private int getMatchingBracketIndex(String str, int end) { + int depth = 1; + for (;end>=0;end--) { + int c = str.charAt(end); + if (c=='(') { + depth--; + if (depth==0) break; + } else if (c==')') + depth++; + } + return end; + } }