diff options
Diffstat (limited to 'gdb/testsuite/gdb.ada')
-rw-r--r-- | gdb/testsuite/gdb.ada/pp-rec-component.exp | 40 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/pp-rec-component.py | 35 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/pp-rec-component/foo.adb | 22 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/pp-rec-component/pck.adb | 21 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/pp-rec-component/pck.ads | 23 |
5 files changed, 141 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/pp-rec-component.exp b/gdb/testsuite/gdb.ada/pp-rec-component.exp new file mode 100644 index 0000000..faa7a0f --- /dev/null +++ b/gdb/testsuite/gdb.ada/pp-rec-component.exp @@ -0,0 +1,40 @@ +# 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 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 <http://www.gnu.org/licenses/>. + +load_lib "ada.exp" + +standard_ada_testfile foo + +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } { + return -1 +} + +clean_restart ${testfile} + +# Skip all tests if Python scripting is not enabled. +if { [skip_python_tests] } { continue } + +set remote_python_file \ + [gdb_remote_download host ${srcdir}/${subdir}/${gdb_test_file_name}.py] +gdb_test_no_output "source ${remote_python_file}" + +set bp_location [gdb_get_line_number "BREAK" ${testdir}/foo.adb] +runto "foo.adb:$bp_location" + +gdb_test "print before" \ + " = Thu Nov 14 02:22:23 2013 \\(1384395743\\)" + +gdb_test "print /r before" \ + " = \\(secs => 1384395743\\)" diff --git a/gdb/testsuite/gdb.ada/pp-rec-component.py b/gdb/testsuite/gdb.ada/pp-rec-component.py new file mode 100644 index 0000000..98bfa82 --- /dev/null +++ b/gdb/testsuite/gdb.ada/pp-rec-component.py @@ -0,0 +1,35 @@ +# Copyright (C) 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 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 <http://www.gnu.org/licenses/>. + +from time import asctime, gmtime +import gdb # silence pyflakes + + +class TimeTPrinter: + def __init__(self, val): + self.val = val + + def to_string(self): + secs = int(self.val['secs']) + return "%s (%d)" % (asctime(gmtime(secs)), secs) + + +def time_sniffer(val): + if val.type.tag == "pck__time_t": + return TimeTPrinter(val) + return None + + +gdb.pretty_printers.append(time_sniffer) diff --git a/gdb/testsuite/gdb.ada/pp-rec-component/foo.adb b/gdb/testsuite/gdb.ada/pp-rec-component/foo.adb new file mode 100644 index 0000000..3f8e73b --- /dev/null +++ b/gdb/testsuite/gdb.ada/pp-rec-component/foo.adb @@ -0,0 +1,22 @@ +-- 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 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 <http://www.gnu.org/licenses/>. + +with Pck; use Pck; + +procedure Foo is + Before : Time_T := (Secs => 1384395743); +begin + Do_Nothing (Before'Address); -- BREAK +end Foo; diff --git a/gdb/testsuite/gdb.ada/pp-rec-component/pck.adb b/gdb/testsuite/gdb.ada/pp-rec-component/pck.adb new file mode 100644 index 0000000..2b31332 --- /dev/null +++ b/gdb/testsuite/gdb.ada/pp-rec-component/pck.adb @@ -0,0 +1,21 @@ +-- 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 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 <http://www.gnu.org/licenses/>. + +package body Pck is + procedure Do_Nothing (A : System.Address) is + begin + null; + end Do_Nothing; +end Pck; diff --git a/gdb/testsuite/gdb.ada/pp-rec-component/pck.ads b/gdb/testsuite/gdb.ada/pp-rec-component/pck.ads new file mode 100644 index 0000000..b1652aa --- /dev/null +++ b/gdb/testsuite/gdb.ada/pp-rec-component/pck.ads @@ -0,0 +1,23 @@ +-- 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 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 <http://www.gnu.org/licenses/>. + +with System; + +package Pck is + type Time_T is record + Secs : Integer; + end record; + procedure Do_Nothing (A : System.Address); +end Pck; |