Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2007-04-02 11:53:58 -0400
committerAlain Magloire2007-04-02 11:53:58 -0400
commitbf5bb5a6fdc9bc7500ec29984e67d5b43f9947af (patch)
tree5ba2fe79f029485e8a3816838a196f20fa991b9e
parent9afac2da1b458e9c66803f1550e98fd2f7ff8421 (diff)
downloadorg.eclipse.cdt-bf5bb5a6fdc9bc7500ec29984e67d5b43f9947af.tar.gz
org.eclipse.cdt-bf5bb5a6fdc9bc7500ec29984e67d5b43f9947af.tar.xz
org.eclipse.cdt-bf5bb5a6fdc9bc7500ec29984e67d5b43f9947af.zip
Fix from Elena for PR #189959
Fixing the backtrace parsing for C++
-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