From 8f4483669835bba65dd9ce9f3c0ecc3728e42de9 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Fri, 18 Feb 2011 11:18:35 +0000 Subject: [PATCH] Bug 336888: Method breakpoints are not set as actual method breakpoints --- .../eclipse/cdt/dsf/mi/service/MIBreakpoints.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java index 4d3f5f43290..aa4d75c4c1e 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java @@ -574,11 +574,20 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I fileName = "\"" + fileName + "\""; //$NON-NLS-1$//$NON-NLS-2$ } + // GDB seems inconsistent about allowing parentheses so we must remove them. + // Bug 336888 + int paren = function.indexOf('('); + if (paren != -1) { + function = function.substring(0, paren); + } + if (!fileName.equals(NULL_STRING)) { - if (lineNumber != -1) { - location = fileName + ":" + lineNumber; //$NON-NLS-1$ + // If the function is set it means we want a function breakpoint + // We must check it first because the line number is still set in this case. + if (!function.equals(NULL_STRING)) { + location = fileName + ":" + function; //$NON-NLS-1$ } else { - location = fileName + ":" + function; //$NON-NLS-1$ + location = fileName + ":" + lineNumber; //$NON-NLS-1$ } } else if (!function.equals(NULL_STRING)) { // function location without source