mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
Bug 341336: fix empty names for functions in anonymous namespaces with
GDB 7.2 or newer. Change-Id: I9aace64c84d92987fa679f809e4c89d1d53499e4 Signed-off-by: Jens Elmenthaler <jens.elmenthaler@advantest.com> Reviewed-on: https://git.eclipse.org/r/7554 Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> IP-Clean: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
This commit is contained in:
parent
642d4c3975
commit
a7321b3293
1 changed files with 27 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2000, 2013 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Wind River Systems - Modified for new DSF Reference Implementation
|
||||
* Jens Elmenthaler (Advantest) - Fix empty names for functions in anonymous namespaces (bug 341336)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.mi.service.command.output;
|
||||
|
||||
|
@ -108,13 +109,18 @@ public class MIFrame {
|
|||
func = ""; //$NON-NLS-1$
|
||||
else
|
||||
{
|
||||
// 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;
|
||||
func = str;
|
||||
// In some situations gdb returns the function names that include parameter types.
|
||||
// To make the presentation consistent truncate the parameters. PR 46592
|
||||
// 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$
|
||||
|
@ -135,4 +141,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