* [patch] Display Fortran strings in backtraces
@ 2014-07-29 3:54 Jan Kratochvil
2014-07-29 16:23 ` Tom Tromey
2014-07-29 20:20 ` Joel Brobecker
0 siblings, 2 replies; 5+ messages in thread
From: Jan Kratochvil @ 2014-07-29 3:54 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 666 bytes --]
Hi,
for Fortran it fixes displaying normal strings also in frames/backtraces:
(gdb) frame
#0 f (s=..., _s=3) at ./gdb.fortran/fortran-frame-string.f90:24
->
#0 f (s='foo', _s=3) at ./gdb.fortran/fortran-frame-string.f90:24
The patch is simple and I do not see why it should not be this way.
For C/C++ TYPE_CODE_STRING is not used. I am not aware of Pascal but that
language is currently not really much supported in GDB anyway.
This was a part of my archer/jankratochvil/vla branch but it is not a part of
the Intel VLA patchset as it in fact is completely unrelated to "VLA".
No regressions on {x86_64,x86_64-m32,i686}-fedora22pre-linux-gnu.
Thanks,
Jan
[-- Attachment #2: fortran-frame-string.patch --]
[-- Type: text/plain, Size: 3390 bytes --]
gdb/
2014-07-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* valprint.c (val_print_scalar_type_p): For TYPE_CODE_STRING return 0.
gdb/testsuite/
2014-07-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.fortran/fortran-frame-string.exp: New file.
* gdb.fortran/fortran-frame-string.f90: New file.
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 8600b34..c3d10f9 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -290,7 +290,6 @@ val_print_scalar_type_p (struct type *type)
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
case TYPE_CODE_SET:
- case TYPE_CODE_STRING:
return 0;
default:
return 1;
diff --git a/gdb/testsuite/gdb.fortran/fortran-frame-string.exp b/gdb/testsuite/gdb.fortran/fortran-frame-string.exp
new file mode 100644
index 0000000..e9d7bc0
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/fortran-frame-string.exp
@@ -0,0 +1,32 @@
+# Copyright 2014 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.
+
+standard_testfile .f90
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
+ return -1
+}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+gdb_breakpoint [gdb_get_line_number "s = s"]
+gdb_continue_to_breakpoint "s = s"
+
+gdb_test "ptype s" {type = character\*3}
+gdb_test "p s" " = 'foo'"
+gdb_test "frame" { \(s='foo', .*}
diff --git a/gdb/testsuite/gdb.fortran/fortran-frame-string.f90 b/gdb/testsuite/gdb.fortran/fortran-frame-string.f90
new file mode 100644
index 0000000..3d1576f
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/fortran-frame-string.f90
@@ -0,0 +1,28 @@
+! Copyright 2014 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.
+!
+! Ihis file is the Fortran source file for dynamic.exp.
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+ subroutine f(s)
+ character*3 s
+ s = s
+ end
+
+ program main
+ call f ('foo')
+ end
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [patch] Display Fortran strings in backtraces
2014-07-29 3:54 [patch] Display Fortran strings in backtraces Jan Kratochvil
@ 2014-07-29 16:23 ` Tom Tromey
2014-07-29 20:20 ` Joel Brobecker
1 sibling, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2014-07-29 16:23 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> 2014-07-28 Jan Kratochvil <jan.kratochvil@redhat.com>
Jan> * valprint.c (val_print_scalar_type_p): For TYPE_CODE_STRING return 0.
It looks fine to me, but I think it can affect Ada, so Joel ought to
weigh in.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] Display Fortran strings in backtraces
2014-07-29 3:54 [patch] Display Fortran strings in backtraces Jan Kratochvil
2014-07-29 16:23 ` Tom Tromey
@ 2014-07-29 20:20 ` Joel Brobecker
2014-07-29 20:27 ` Jan Kratochvil
1 sibling, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2014-07-29 20:20 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
> gdb/
> 2014-07-28 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * valprint.c (val_print_scalar_type_p): For TYPE_CODE_STRING return 0.
>
> gdb/testsuite/
> 2014-07-28 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * gdb.fortran/fortran-frame-string.exp: New file.
> * gdb.fortran/fortran-frame-string.f90: New file.
Sorry, Jan. That seems to be counter-intuitive; strings are not
scalars... The intent of the setting is to avoid having super-long
parameter values drowning the list parameters. Strings can be pretty
long, so I think the current behavior matches my current expectation.
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] Display Fortran strings in backtraces
2014-07-29 20:20 ` Joel Brobecker
@ 2014-07-29 20:27 ` Jan Kratochvil
2014-07-29 21:08 ` Joel Brobecker
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2014-07-29 20:27 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On Tue, 29 Jul 2014 22:05:13 +0200, Joel Brobecker wrote:
> Sorry, Jan. That seems to be counter-intuitive; strings are not
> scalars... The intent of the setting is to avoid having super-long
> parameter values drowning the list parameters. Strings can be pretty
> long, so I think the current behavior matches my current expectation.
In such case normal C 'char *' parameters also should not be printed.
Length of fortran strings is limited exactly the same way like C 'char *'
strings are:
Breakpoint 2, f (s='foo01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010'..., _s=203) at ./gdb.fortran/fortran-frame-string.f90:24^M
(gdb) show print elements
Limit on string chars or array elements to print is 200.
What is the difference between Fortran strings and C 'char *' strings?
Thanks,
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-07-29 20:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-29 3:54 [patch] Display Fortran strings in backtraces Jan Kratochvil
2014-07-29 16:23 ` Tom Tromey
2014-07-29 20:20 ` Joel Brobecker
2014-07-29 20:27 ` Jan Kratochvil
2014-07-29 21:08 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox