Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2007-04-02 15:41:58 +0000
committerAlain Magloire2007-04-02 15:41:58 +0000
commitd0015ae8c37be746b8be1807e0679deb3e31736e (patch)
tree4be5e456b57b5beb2375b5799a9cdd571bbf665d /debug/org.eclipse.cdt.debug.mi.core
parent0c941b872404f079e849a44e22db3e85e185cb9a (diff)
downloadorg.eclipse.cdt-d0015ae8c37be746b8be1807e0679deb3e31736e.tar.gz
org.eclipse.cdt-d0015ae8c37be746b8be1807e0679deb3e31736e.tar.xz
org.eclipse.cdt-d0015ae8c37be746b8be1807e0679deb3e31736e.zip
Fix from Elena for PR #189959
Fixing the backtrace parsing for C++
Diffstat (limited to 'debug/org.eclipse.cdt.debug.mi.core')
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java31
1 files changed, 24 insertions, 7 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java
index 8c50848e15f..fdda491fd65 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java
@@ -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;
+ }
}

Back to the top