diff options
author | Joel Brobecker <brobecker@gnat.com> | 2010-01-29 05:19:23 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2010-01-29 05:19:23 +0000 |
commit | ba581dc13b5e3ca555a49df501d5ac74287f504d (patch) | |
tree | 8264995f3071246435079ed1ef4e6118335caeff /gdb/testsuite | |
parent | a1504221ad15cfb08f22fd5548835d33f3d041de (diff) | |
download | gdb-ba581dc13b5e3ca555a49df501d5ac74287f504d.zip gdb-ba581dc13b5e3ca555a49df501d5ac74287f504d.tar.gz gdb-ba581dc13b5e3ca555a49df501d5ac74287f504d.tar.bz2 |
amd64: Integer parameters in function calls on Windows.
gdb/ChangeLog:
* i386-tdep.h (enum amd64_reg_class): New, moved here from
amd64-tdep.c.
(struct gdbarch_tdep): Add fields call_dummy_num_integer_regs,
call_dummy_integer_regs, and classify.
* amd64-tdep.h (amd64_classify): Add declaration.
* amd64-tdep.c (amd64_dummy_call_integer_regs): New static constant.
(amd64_reg_class): Delete, moved to i386-tdep.h.
(amd64_classify): Make non-static. Move declaration to amd64-tdep.h.
Replace call to amd64_classify by call to tdep->classify.
(amd64_push_arguments): Get the list of registers to use for
passing integer parameters from the gdbarch tdep structure,
rather than using a hardcoded one. Replace calls to amd64_classify
by calls to tdep->classify.
(amd64_push_dummy_call): Get the register number used for
the "hidden" argument from tdep->call_dummy_integer_regs.
(amd64_init_abi): Initialize tdep->call_dummy_num_integer_regs
and tdep->call_dummy_integer_regs. Set tdep->classify.
* amd64-windows-tdep.c: Add include of gdbtypes.h.
(amd64_windows_dummy_call_integer_regs): New static global.
(amd64_windows_classify): New function.
(amd64_windows_init_abi): Initialize tdep->call_dummy_num_integer_regs
tdep->call_dummy_integer_regs and tdep->classify.
gdb/testsuite/ChangeLog:
* gdb.ada/call_pn: New testcase.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/call_pn.exp | 53 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/call_pn/foo.adb | 23 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/call_pn/pck.adb | 25 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/call_pn/pck.ads | 23 |
5 files changed, 128 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 68ef916..99c2134 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-01-29 Joel Brobecker <brobecker@adacore.com> + + * gdb.ada/call_pn: New testcase. + 2010-01-28 Daniel Jacobowitz <dan@codesourcery.com> * gdb.mi/mi-nonstop.exp (mi_nonstop_resume): New function. diff --git a/gdb/testsuite/gdb.ada/call_pn.exp b/gdb/testsuite/gdb.ada/call_pn.exp new file mode 100644 index 0000000..5ade3fa --- /dev/null +++ b/gdb/testsuite/gdb.ada/call_pn.exp @@ -0,0 +1,53 @@ +# Copyright 2010 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/>. + +if $tracelevel then { + strace $tracelevel +} + +load_lib "ada.exp" + +set testdir "call_pn" +set testfile "${testdir}/foo" +set srcfile ${srcdir}/${subdir}/${testfile}.adb +set binfile ${objdir}/${subdir}/${testfile} + +file mkdir ${objdir}/${subdir}/${testdir} +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb] +if ![runto "foo.adb:$bp_location" ] then { + perror "Couldn't run ${testfile}" + return +} + +# Make sure that last_node_id is set to zero... +gdb_test "print last_node_id" "= 0" "print last_node_id before calling pn" + +# Now, call procedure Pn, which should set Last_Node_Id to the value +# of the parameter used in the function call. Verify that we can print +# the returned value correctly, while we're at it. +gdb_test "print pn (4321)" "= 4321" "print pn (4321)" + +# Make sure that last_node_id now has the correct value... +gdb_test "print last_node_id" "= 4321" "print last_node_id after calling pn" + diff --git a/gdb/testsuite/gdb.ada/call_pn/foo.adb b/gdb/testsuite/gdb.ada/call_pn/foo.adb new file mode 100644 index 0000000..a71969b --- /dev/null +++ b/gdb/testsuite/gdb.ada/call_pn/foo.adb @@ -0,0 +1,23 @@ +-- Copyright 2010 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 + New_Node : Node_Id; +begin + New_Node := Pn (1234); -- STOP +end Foo; + diff --git a/gdb/testsuite/gdb.ada/call_pn/pck.adb b/gdb/testsuite/gdb.ada/call_pn/pck.adb new file mode 100644 index 0000000..cc2dfb6 --- /dev/null +++ b/gdb/testsuite/gdb.ada/call_pn/pck.adb @@ -0,0 +1,25 @@ +-- Copyright 2010 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 + Last_Node_Id : Node_Id := Node_Id'First; + + function Pn (N : Node_Id) return Node_Id is + begin + Last_Node_Id := N; + return N; + end Pn; +end Pck; + diff --git a/gdb/testsuite/gdb.ada/call_pn/pck.ads b/gdb/testsuite/gdb.ada/call_pn/pck.ads new file mode 100644 index 0000000..11e21c3 --- /dev/null +++ b/gdb/testsuite/gdb.ada/call_pn/pck.ads @@ -0,0 +1,23 @@ +-- Copyright 2010 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 Pck is + Node_Low_Bound : constant := 0; + Node_High_Bound : constant := 099_999_999; + type Node_Id is range Node_Low_Bound .. Node_High_Bound; + + function Pn (N : Node_Id) return Node_Id; +end Pck; + |