From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15878 invoked by alias); 24 Dec 2007 08:02:16 -0000 Received: (qmail 15868 invoked by uid 22791); 24 Dec 2007 08:02:14 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 24 Dec 2007 08:02:07 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E17162A9634 for ; Mon, 24 Dec 2007 03:02:05 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id G8iKYPH4Ws+2 for ; Mon, 24 Dec 2007 03:02:05 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 159092A9637 for ; Mon, 24 Dec 2007 03:02:04 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id A5507E7ACA; Mon, 24 Dec 2007 12:01:56 +0400 (RET) Date: Mon, 24 Dec 2007 16:55:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: Re: [commit/testcase/Ada] character parameter handling in inferior funcall Message-ID: <20071224080156.GY6154@adacore.com> References: <20071224080040.GX6154@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="hk6Zb6cduJ+I0Tmj" Content-Disposition: inline In-Reply-To: <20071224080040.GX6154@adacore.com> User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-12/txt/msg00408.txt.bz2 --hk6Zb6cduJ+I0Tmj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 262 > 2007-12-24 Joel Brobecker > > * gdb.ada/char_param/pck.ads, gdb.ada/char_param/pck.adb, > gdb.ada/char_param/foo.adb: New files. > * gdb.ada/char_param.exp: New testcase. ENOPATCH... Now attached. -- Joel --hk6Zb6cduJ+I0Tmj Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pck.ads" Content-length: 1039 -- Copyright 2007 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 . with System; package Pck is Procedure_Result : Character := ' '; procedure Same (C : Character); -- Set Procedure_Result to C. procedure Next (C : in out Character); -- Increment C (if C is the last character, then set C to the first -- character). Set Procedure_Result to the new value of C. end Pck; --hk6Zb6cduJ+I0Tmj Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pck.adb" Content-length: 1048 -- Copyright 2007 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 . package body Pck is procedure Same (C : Character) is begin Procedure_Result := C; end Same; procedure Next (C : in out Character) is begin if C = Character'Last then C := Character'First; else C := Character'Succ (C); end if; Procedure_Result := C; end Next; end Pck; --hk6Zb6cduJ+I0Tmj Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="foo.adb" Content-length: 865 -- Copyright 2007 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 . with Pck; use Pck; procedure Foo is First : Character := 'a'; begin Procedure_Result := ' '; Same (First); -- STOP Next (First); end Foo; --hk6Zb6cduJ+I0Tmj Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="char_param.exp" Content-length: 1928 # Copyright 2007 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 . if $tracelevel then { strace $tracelevel } load_lib "ada.exp" set testdir "char_param" 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 additional_flags=-gnata ]] != "" } { 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] runto "foo.adb:$bp_location" # Call same and next which are procedures that take a Character # as a parameter. To verify that the call was performed correctly, # we check the value of "Procedure_Result" which is set during # the function call. gdb_test "print procedure_result" \ "32 ' '" \ "print procedure_result before calling same" gdb_test "call same (first)" \ "" \ "call same" gdb_test "print procedure_result" \ "97 'a'" \ "print procedure_result after calling same" gdb_test "call next (first)" \ "98 'b'" \ "call next" gdb_test "print procedure_result" \ "98 'b'" \ "print procedure_result after calling next" --hk6Zb6cduJ+I0Tmj--