From aae64587896fc361f18a6a38e988c5610276bf17 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 5 Mar 2009 22:37:11 +0000 Subject: [PATCH] gdb/ 2009-03-05 Pedro Alves * breakpoint.c (check_duplicates_for): Skip permanent breakpoints duplicates of permanent breakpoints. gdb/testsuite/ 2009-03-05 Pedro Alves * gdb.arch/i386-permbkpt.S, gdb.arch/i386-permbkpt.exp: New. --- gdb/ChangeLog | 5 +++ gdb/breakpoint.c | 7 ++-- gdb/testsuite/ChangeLog | 4 ++ gdb/testsuite/gdb.arch/i386-permbkpt.S | 30 ++++++++++++++ gdb/testsuite/gdb.arch/i386-permbkpt.exp | 52 ++++++++++++++++++++++++ 5 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 gdb/testsuite/gdb.arch/i386-permbkpt.S create mode 100644 gdb/testsuite/gdb.arch/i386-permbkpt.exp diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7e856db5c9b..ecb0acb9129 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2009-03-05 Pedro Alves + + * breakpoint.c (check_duplicates_for): Skip permanent breakpoints + duplicates of permanent breakpoints. + 2009-03-04 Pedro Alves * inferior.h (notice_new_inferior): Declare. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index b23b294bbf6..66252ba6136 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3948,8 +3948,8 @@ check_duplicates_for (CORE_ADDR address, struct obj_section *section) } /* If we found a permanent breakpoint at this address, go over the - list again and declare all the other breakpoints there to be the - duplicates. */ + list again and declare all the other breakpoints there (except + other permanent breakpoints) to be the duplicates. */ if (perm_bp) { perm_bp->duplicate = 0; @@ -3963,7 +3963,8 @@ check_duplicates_for (CORE_ADDR address, struct obj_section *section) ALL_BP_LOCATIONS (b) if (b != perm_bp) { - if (b->owner->enable_state != bp_disabled + if (b->owner->enable_state != bp_permanent + && b->owner->enable_state != bp_disabled && b->owner->enable_state != bp_call_disabled && b->enabled && !b->shlib_disabled && b->address == address /* address / overlay match */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e3aaeab4f8b..e8868693345 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-03-05 Pedro Alves + + * gdb.arch/i386-permbkpt.S, gdb.arch/i386-permbkpt.exp: New. + 2009-02-18 Jan Kratochvil * gdb.base/macscp.exp (objfile): Move it to ${objdir}/${subdir}/. diff --git a/gdb/testsuite/gdb.arch/i386-permbkpt.S b/gdb/testsuite/gdb.arch/i386-permbkpt.S new file mode 100644 index 00000000000..02a31d6e8bc --- /dev/null +++ b/gdb/testsuite/gdb.arch/i386-permbkpt.S @@ -0,0 +1,30 @@ +/* Copyright 2009 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + This file is part of the gdb testsuite. */ + +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +#ifdef SYMBOL_PREFIX +# define SYMBOL(str) CONCAT1(SYMBOL_PREFIX, str) +#else +# define SYMBOL(str) str +#endif + + .global SYMBOL(main) +SYMBOL(main): + int3 + ret diff --git a/gdb/testsuite/gdb.arch/i386-permbkpt.exp b/gdb/testsuite/gdb.arch/i386-permbkpt.exp new file mode 100644 index 00000000000..f1930e50cc6 --- /dev/null +++ b/gdb/testsuite/gdb.arch/i386-permbkpt.exp @@ -0,0 +1,52 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + +# Test inserting breakpoints over permanent breakpoints on i386 and amd64. + +if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then { + verbose "Skipping i386 test for multi break at permanent breakpoint location." + return +} + +set testfile "i386-permbkpt" +set srcfile ${testfile}.S +set binfile ${objdir}/${subdir}/${testfile} + +# Some targets have leading underscores on assembly symbols. +# TODO: detect this automatically +set additional_flags "" +if { [istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"] } then { + set additional_flags "additional_flags=-DSYMBOL_PREFIX=_" +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { + untested i386-permbkpt.exp + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_test "break main" "" "First permanent break" +gdb_test "break main" "" "Second permanent break" -- 2.30.2