View | Details | Raw Unified | Return to bug 180059
Collapse All | Expand All

(-)mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java (-7 / +24 lines)
Lines 102-116 Link Here
102
					str = str.trim();
102
					str = str.trim();
103
					if ( str.equals( "??" ) ) //$NON-NLS-1$
103
					if ( str.equals( "??" ) ) //$NON-NLS-1$
104
						func = ""; //$NON-NLS-1$
104
						func = ""; //$NON-NLS-1$
105
					else
105
					else {
106
					{
106
						func = str;
107
						// In some situations gdb returns the function names that include parameter types.
107
						// In some situations gdb returns the function names that include parameter types.
108
						// To make the presentation consistent truncate the parameters. PR 46592
108
						// To make the presentation consistent truncate the parameters. PR 46592
109
						int end = str.indexOf( '(' );
109
						// However PR180059: only cut it if it is last brackets represent parameters,
110
						if ( end != -1 )
110
						// because gdb can return: func="(anonymous namespace)::func2((anonymous namespace)::Test*)"
111
							func = str.substring( 0, end );
111
						int closing = str.lastIndexOf(')');
112
						else
112
						if (closing == str.length() - 1) {
113
							func = str;
113
							int end = getMatchingBracketIndex(str, closing - 1);
114
							if (end >= 0) {
115
								func = str.substring(0, end);
116
							}
117
						}
114
					}
118
					}
115
				}
119
				}
116
			} else if (var.equals("file")) { //$NON-NLS-1$
120
			} else if (var.equals("file")) { //$NON-NLS-1$
Lines 131-134 Link Here
131
			}
135
			}
132
		}
136
		}
133
	}
137
	}
138
139
	private int getMatchingBracketIndex(String str, int end) {
140
	    int depth = 1;
141
	    for (;end>=0;end--) {
142
	    	int c = str.charAt(end);
143
	    	if (c=='(') {
144
	    		depth--;
145
	    		if (depth==0) break;
146
	    	} else if (c==')') 
147
	    		depth++;
148
	    }
149
	    return end;
150
    }
134
}
151
}

Return to bug 180059