1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-16 04:35:45 +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:
Jens Elmenthaler 2012-08-31 21:14:13 +02:00 committed by Marc-Andre Laperle
parent 642d4c3975
commit a7321b3293

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Wind River Systems - Modified for new DSF Reference 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; package org.eclipse.cdt.dsf.mi.service.command.output;
@ -108,13 +109,18 @@ public class MIFrame {
func = ""; //$NON-NLS-1$ func = ""; //$NON-NLS-1$
else else
{ {
// In some situations gdb returns the function names that include parameter types. func = str;
// To make the presentation consistent truncate the parameters. PR 46592 // In some situations gdb returns the function names that include parameter types.
int end = str.indexOf( '(' ); // To make the presentation consistent truncate the parameters. PR 46592
if ( end != -1 ) // However PR180059: only cut it if it is last brackets represent parameters,
func = str.substring( 0, end ); // because gdb can return: func="(anonymous namespace)::func2((anonymous namespace)::Test*)"
else int closing = str.lastIndexOf(')');
func = str; 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$ } 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;
}
} }