From ef2c62d0bf4ebd02fb70cfa8268020bb3e49bf60 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Mon, 11 Jul 2005 20:45:45 +0000 Subject: [PATCH] 2005-07-10 Alain Magloire Fix for PR 100992: Setting breakpoints for methods * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java --- debug/org.eclipse.cdt.debug.mi.core/ChangeLog | 4 ++ .../debug/mi/core/cdi/BreakpointManager.java | 52 ++++++++++++------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog index c444d588e11..b701919c7f3 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog @@ -1,3 +1,7 @@ +2005-07-10 Alain Magloire + Fix for PR 100992: Setting breakpoints for methods + * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java + 2005-07-07 Alain Magloire Try to suspend the target before disconnecting. * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java index 8ae4464eed1..e9c6ff7c642 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java @@ -929,31 +929,43 @@ public class BreakpointManager extends Manager { } line.append(no); } else if (bkpt instanceof FunctionBreakpoint) { - if (file != null && file.length() > 0) { - line.append(file).append(':'); - } if (function != null && function.length() > 0) { - // GDB does not seem to accept function arguments when - // we use file name: - // (gdb) break file.c:Test(int) - // Will fail, altought it can accept this - // (gdb) break file.c:main - // so fall back to the line number or - // just the name of the function if lineno is invalid. - int paren = function.indexOf('('); - if (paren != -1) { - if (no <= 0) { - String func = function.substring(0, paren); - line.append(func); - } else { - line.append(no); - } - } else { + // if the function contains :: assume the user + // knows the exact funciton + int colon = function.indexOf("::"); //$NON-NLS-1$ + if (colon != -1) { line.append(function); + } else { + if (file != null && file.length() > 0) { + line.append(file).append(':'); + } + // GDB does not seem to accept function arguments when + // we use file name: + // (gdb) break file.c:Test(int) + // Will fail, altought it can accept this + // (gdb) break file.c:main + // so fall back to the line number or + // just the name of the function if lineno is invalid. + int paren = function.indexOf('('); + if (paren != -1) { + if (no <= 0) { + String func = function.substring(0, paren); + line.append(func); + } else { + line.append(no); + } + } else { + line.append(function); + } } } else { // ??? - line.append(no); + if (file != null && file.length() > 0) { + line.append(file).append(':'); + } + if (no > 0) { + line.append(no); + } } } else if (bkpt instanceof AddressBreakpoint) { line.append('*').append(locator.getAddress());