mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
parent
0c941b8724
commit
d0015ae8c3
1 changed files with 24 additions and 7 deletions
|
@ -102,15 +102,19 @@ public class MIFrame {
|
|||
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 @@ public class MIFrame {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue