summaryrefslogtreecommitdiff
path: root/debian/patches/gdb-fortran-main.patch
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2019-12-09 11:34:23 +0300
committerIgor Pashev <pashev.igor@gmail.com>2019-12-09 11:34:23 +0300
commitee8536fb62c8a81ea727b475a6793417d00b40b0 (patch)
treead9cdd7d46c7f4c47202ea7fcb463257e4228728 /debian/patches/gdb-fortran-main.patch
downloadgdb-ee8536fb62c8a81ea727b475a6793417d00b40b0.tar.gz
Import gdb 8.3.1-1debian/8.3.1-1debian
Diffstat (limited to 'debian/patches/gdb-fortran-main.patch')
-rw-r--r--debian/patches/gdb-fortran-main.patch91
1 files changed, 91 insertions, 0 deletions
diff --git a/debian/patches/gdb-fortran-main.patch b/debian/patches/gdb-fortran-main.patch
new file mode 100644
index 0000000..38380de
--- /dev/null
+++ b/debian/patches/gdb-fortran-main.patch
@@ -0,0 +1,91 @@
+From: =?utf-8?b?SMOpY3RvciBPcsOzbiBNYXJ0w61uZXo=?= <zumbi@debian.org>
+Date: Wed, 20 Feb 2019 13:25:36 +0100
+Subject: gdb-fortran-main
+
+Daniel,
+
+Although the proper way of adding case insensitivity to symbol lookup is
+still under discussion, I think it might be desirable to set the main
+function of Fortran programs to "MAIN__" first. Because it can at least
+let GDB recognize that the language is Fortran after loading a Fortran
+executable only. What is your idea on this? Please comments. TIA!
+
+Here is the patch to set the main function in Fortran programs to
+"MAIN__". And followed is a patch to verify this. Tested with g77 and
+gfortran on x86, and g77 on ppc64. With the first patch, it reported
+PASS; without, report FAIL. No regression is found in gdb.fortran
+testcases.
+
+P.S: if there is a symbol named "MAIN__" in sources of other languages, it
+might disturb the debugging. But I am not sure how much it is.
+---
+ gdb/symtab.c | 9 +++++++--
+ gdb/testsuite/gdb.fortran/lang.exp | 40 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 47 insertions(+), 2 deletions(-)
+ create mode 100644 gdb/testsuite/gdb.fortran/lang.exp
+
+Index: gdb/gdb/symtab.c
+===================================================================
+--- gdb.orig/gdb/symtab.c 2019-02-22 11:21:51.583408077 +0100
++++ gdb/gdb/symtab.c 2019-02-22 11:21:51.579408029 +0100
+@@ -5795,8 +5795,13 @@
+ }
+
+ /* The languages above didn't identify the name of the main procedure.
+- Fallback to "main". */
+- set_main_name ("main", language_unknown);
++ Fallback to "MAIN__" (g77 and gfortran) if we can find it in the
++ minimal symtab, to "main" otherwise. */
++ struct bound_minimal_symbol msym = lookup_minimal_symbol ("MAIN__", NULL, NULL);
++ if (msym.minsym)
++ set_main_name ("MAIN__", language_fortran);
++ else
++ set_main_name ("main", language_unknown);
+ }
+
+ char *
+Index: gdb/gdb/testsuite/gdb.fortran/lang.exp
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb/gdb/testsuite/gdb.fortran/lang.exp 2019-02-22 11:21:51.579408029 +0100
+@@ -0,0 +1,40 @@
++# Copyright 2005 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 2 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, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++# This file was written by Wu Zhou. (woodzltc@cn.ibm.com)
++
++# This file is part of the gdb testsuite. It is intended to test that gdb
++# could recognize the Fortran language after loading the binary
++
++if $tracelevel then {
++ strace $tracelevel
++}
++
++set testfile "array-element"
++set srcfile ${srcdir}/${subdir}/${testfile}.f
++set binfile ${objdir}/${subdir}/${testfile}
++
++if { [gdb_compile "${srcfile}" "${binfile}" executable {debug f77}] != "" } {
++ untested "Couldn't compile ${srcfile}"
++ return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++gdb_test "show language" ".*currently fortran.*" "show language(fortran)"