From 48a8022c0d9bfb9a2369e8a3f4287fc0521bc850 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Feb 03 2010 01:07:22 +0000 Subject: - Fortran: Fix regression on setting breakpoint at toplevel symbols (BZ 559291). --- diff --git a/gdb-bz559291-fortran-module-toplevel.patch b/gdb-bz559291-fortran-module-toplevel.patch new file mode 100644 index 0000000..f7055ff --- /dev/null +++ b/gdb-bz559291-fortran-module-toplevel.patch @@ -0,0 +1,107 @@ +http://sourceware.org/ml/archer/2010-q1/msg00047.html +Subject: [fortran-module] [commit] Fix a regression on setting breakpoint at + +[ Backport for F-11. ] + +f5c7672a52316155bc3367cbc2f0e7db22523634 + +https://bugzilla.redhat.com/show_bug.cgi?id=559291 + +gdb/ +2010-02-03 Jan Kratochvil + David Moore + * f-lang.c (f_lookup_symbol_nonlocal): Always fallback on + basic_lookup_symbol_nonlocal. + +gdb/testsuite/ +2010-02-03 Jan Kratochvil + * gdb.fortran/module.exp (show language, setting breakpoint at module): + New. + * gdb.fortran/module.f90: New statement program module. + +--- ./gdb/f-lang.c 2010-02-03 01:39:24.000000000 +0100 ++++ ./gdb/f-lang.c 2010-02-03 01:38:44.000000000 +0100 +@@ -309,31 +309,32 @@ f_lookup_symbol_nonlocal (const char *na + const struct block *block, + const domain_enum domain) + { +- struct fortran_using *use; +- +- if (!block) +- return NULL; +- +- for (use = BLOCK_FORTRAN_USE (block); use; use = use->next) ++ if (block) + { +- struct symbol *sym; +- struct type *type; +- struct symbol *retval; +- +- sym = lookup_symbol_global (use->module_name, NULL, block, MODULE_DOMAIN); +- +- /* Module name lookup should not fail with correct debug info. */ +- if (sym == NULL) +- continue; +- +- type = SYMBOL_TYPE (sym); +- gdb_assert (TYPE_CODE (type) == TYPE_CODE_MODULE); +- gdb_assert (TYPE_MODULE_BLOCK (type) != NULL); +- +- retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, +- linkage_name, domain); +- if (retval) +- return retval; ++ struct fortran_using *use; ++ ++ for (use = BLOCK_FORTRAN_USE (block); use; use = use->next) ++ { ++ struct symbol *sym; ++ struct type *type; ++ struct symbol *retval; ++ ++ sym = lookup_symbol_global (use->module_name, NULL, block, ++ MODULE_DOMAIN); ++ ++ /* Module name lookup should not fail with correct debug info. */ ++ if (sym == NULL) ++ continue; ++ ++ type = SYMBOL_TYPE (sym); ++ gdb_assert (TYPE_CODE (type) == TYPE_CODE_MODULE); ++ gdb_assert (TYPE_MODULE_BLOCK (type) != NULL); ++ ++ retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, ++ linkage_name, domain); ++ if (retval) ++ return retval; ++ } + } + + return basic_lookup_symbol_nonlocal (name, linkage_name, block, domain); +--- ./gdb/testsuite/gdb.fortran/module.exp 2010-02-03 01:39:25.000000000 +0100 ++++ ./gdb/testsuite/gdb.fortran/module.exp 2010-02-03 01:34:47.000000000 +0100 +@@ -43,3 +43,13 @@ gdb_test "print var_b" " = 11" + gdb_test "print var_c" "No symbol \"var_c\" in current context\\." + gdb_test "print var_d" " = 12" + gdb_test "print var_i" " = 14" "print var_i value 14" ++ ++# Breakpoint would work in language "c". ++gdb_test "show language" {The current source language is "(auto; currently )?fortran".} ++ ++# gcc-4.4.2: The main program is always MAIN__ in .symtab so "runto" above ++# works. But DWARF DW_TAG_subprogram contains the name specified by ++# the "program" Fortran statement. ++if [gdb_breakpoint "module"] { ++ pass "setting breakpoint at module" ++} +--- ./gdb/testsuite/gdb.fortran/module.f90 2010-02-03 01:39:25.000000000 +0100 ++++ ./gdb/testsuite/gdb.fortran/module.f90 2010-02-03 01:34:47.000000000 +0100 +@@ -37,6 +37,8 @@ end module modmany + var_i = var_i ! i-is-2 + end + ++ program module ++ + use modmany, only: var_b, var_d => var_c, var_i + + call sub1 diff --git a/gdb.spec b/gdb.spec index 0acd788..4368e10 100644 --- a/gdb.spec +++ b/gdb.spec @@ -13,7 +13,7 @@ Version: 6.8.50.20090302 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 39%{?_with_upstream:.upstream}%{?dist} +Release: 40%{?_with_upstream:.upstream}%{?dist} License: GPLv3+ Group: Development/Debuggers @@ -400,6 +400,9 @@ Patch379: gdb-bz508406-vla-type-objfile.patch # Fix crash on some catch commands (BZ 533525). Patch386: gdb-bz533525-catch-crash.patch +# Fortran: Fix regression on setting breakpoint at toplevel symbols (BZ 559291). +Patch416: gdb-bz559291-fortran-module-toplevel.patch + BuildRequires: ncurses-devel texinfo gettext flex bison expat-devel Requires: readline BuildRequires: readline-devel @@ -603,6 +606,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch377 -p1 %patch379 -p1 %patch386 -p1 +%patch416 -p1 %patch124 -p1 find -name "*.orig" | xargs rm -f @@ -883,6 +887,9 @@ fi %endif %changelog +* Wed Feb 3 2010 Jan Kratochvil - 6.8.50.20090302-40 +- Fortran: Fix regression on setting breakpoint at toplevel symbols (BZ 559291). + * Tue Nov 10 2009 Jan Kratochvil - 6.8.50.20090302-39 - Fix crash on some catch commands (BZ 533525).