From 6e6a7110f950e3d90978637b21fcb913934be9b1 Mon Sep 17 00:00:00 2001 From: Michael Eager Date: Tue, 10 Dec 2013 11:50:27 -0800 Subject: [PATCH] Fix regression symbol name different from linkage name. gdb: * dwarf2read.c (die_needs_namespace): Do nothing for C language. testsuite: * gdb.base/break-linker-symname.c: New. * gdb.base/break-linker-symname.exp: New. --- gdb/dwarf2read.c | 3 ++ gdb/testsuite/gdb.base/break-linker-symname.c | 28 +++++++++++++++++++++++ gdb/testsuite/gdb.base/break-linker-symname.exp | 25 ++++++++++++++++++++ 3 files changed, 56 insertions(+), 0 deletions(-) create mode 100644 gdb/testsuite/gdb.base/break-linker-symname.c create mode 100644 gdb/testsuite/gdb.base/break-linker-symname.exp diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 3974d0b..d2a236c 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -8044,6 +8044,9 @@ die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu) { struct attribute *attr; + if (cu->language == language_c) + return 0; + switch (die->tag) { case DW_TAG_namespace: diff --git a/gdb/testsuite/gdb.base/break-linker-symname.c b/gdb/testsuite/gdb.base/break-linker-symname.c new file mode 100644 index 0000000..8728ea1 --- /dev/null +++ b/gdb/testsuite/gdb.base/break-linker-symname.c @@ -0,0 +1,28 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2013 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 . */ + +void goo (int b) asm("_goo"); + +void goo (int b) +{ +} + +int main (void) +{ + goo (4); + return 0; +} diff --git a/gdb/testsuite/gdb.base/break-linker-symname.exp b/gdb/testsuite/gdb.base/break-linker-symname.exp new file mode 100644 index 0000000..2a86f37 --- /dev/null +++ b/gdb/testsuite/gdb.base/break-linker-symname.exp @@ -0,0 +1,25 @@ +# Copyright 2013 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 . + +# Test that 'set breakpoint always-inserted 1' is not a brick +# Also verifies that breakpoint enabling/disabling works properly +# with duplicated breakpoints. + +if { [prepare_for_testing break-linker-symname.exp break-linker-symname break-linker-symname.c] } { + return -1 +} + +gdb_test "break _goo" "Breakpoint 1.*" "set breakpoint on linker symbol" +gdb_test "break goo" "Breakpoint 2.*" "set breakpoint on source symbol" -- 1.7.1