From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19705 invoked by alias); 11 Feb 2009 14:45:58 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 19679 invoked by uid 9674); 11 Feb 2009 14:45:57 -0000 Date: Wed, 11 Feb 2009 14:45:00 -0000 Message-ID: <20090211144557.19664.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-jankratochvil-misc: Fix `return' for long on no debuginfo; new testcase. X-Git-Refname: refs/heads/archer-jankratochvil-misc X-Git-Reftype: branch X-Git-Oldrev: 0c3da4ac86966fb2ab0d9cca73de30e258447eae X-Git-Newrev: 568b52cacabcf34b800f5d78a96b42ede14ba2e0 X-SW-Source: 2009-q1/txt/msg00140.txt.bz2 List-Id: The branch, archer-jankratochvil-misc has been updated via 568b52cacabcf34b800f5d78a96b42ede14ba2e0 (commit) from 0c3da4ac86966fb2ab0d9cca73de30e258447eae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 568b52cacabcf34b800f5d78a96b42ede14ba2e0 Author: Jan Kratochvil Date: Wed Feb 11 15:43:08 2009 +0100 Fix `return' for long on no debuginfo; new testcase. `return' for long on no debuginfo addresses: https://bugzilla.redhat.com/show_bug.cgi?id=365111 Testcase from 997d730f46e591a2d45676013ebf857b0339ca04 has been replaced by a new one covering also RHBZ #365111: gdb.base/return-nodebug.exp ----------------------------------------------------------------------- Summary of changes: gdb/stack.c | 3 +- gdb/testsuite/gdb.base/nodebug.exp | 7 ---- gdb/testsuite/gdb.base/return-nodebug.c | 40 +++++++++++++++++++++++ gdb/testsuite/gdb.base/return-nodebug.exp | 49 +++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+), 8 deletions(-) create mode 100644 gdb/testsuite/gdb.base/return-nodebug.c create mode 100644 gdb/testsuite/gdb.base/return-nodebug.exp First 500 lines of diff: diff --git a/gdb/stack.c b/gdb/stack.c index f4c565c..e4afb4d 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1809,7 +1809,8 @@ return_command (char *retval_exp, int from_tty) if (thisfun != NULL) return_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun)); if (return_type == NULL) - return_type = builtin_type (get_frame_arch (thisframe))->builtin_int; + return_type + = builtin_type (get_frame_arch (thisframe))->builtin_long_long; CHECK_TYPEDEF (return_type); return_value = value_cast (return_type, return_value); diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp index 31fb88e..4c01be4 100644 --- a/gdb/testsuite/gdb.base/nodebug.exp +++ b/gdb/testsuite/gdb.base/nodebug.exp @@ -215,12 +215,5 @@ if [runto inner] then { if [runto middle] then { gdb_test "backtrace 10" "#0.*middle.*#1.*top.*#2.*main.*" \ "backtrace from middle in nodebug.exp" - - # Test return from a function with no debug info (symbol; still it may - # have a minimal-symbol). In gdb.base/return*.exp we would need to - # build a separate executable with no "debug" option. - gdb_test "return 0" "#0 .* top \\(.*" \ - "return from function with no debug info" \ - "Make selected stack frame return now\\? \\(y or n\\) " "y" } } diff --git a/gdb/testsuite/gdb.base/return-nodebug.c b/gdb/testsuite/gdb.base/return-nodebug.c new file mode 100644 index 0000000..f238a6c --- /dev/null +++ b/gdb/testsuite/gdb.base/return-nodebug.c @@ -0,0 +1,40 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2009 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 . */ + +#include + +static TYPE +func (void) +{ + return (TYPE) -1; +} + +static void +marker (void) +{ +} + +int +main (void) +{ + printf ("result=" FORMAT "\n", (TYPE) func ()); + + /* Cannot `next' with no debug info. */ + marker (); + + return 0; +} diff --git a/gdb/testsuite/gdb.base/return-nodebug.exp b/gdb/testsuite/gdb.base/return-nodebug.exp new file mode 100644 index 0000000..e980cad --- /dev/null +++ b/gdb/testsuite/gdb.base/return-nodebug.exp @@ -0,0 +1,49 @@ +# Copyright (C) 2009 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 . + +proc do_test {type} { + global pf_prefix + set old_prefix $pf_prefix + lappend pf_prefix "[string map {{ } -} $type]:" + + if {[runto "func"]} { + # Test return from a function with no debug info (symbol; still it may + # have a minimal-symbol) if it does not crash. + gdb_test "return -1" "#0 .* main \\(.*" \ + "return from function with no debug info" \ + "Make selected stack frame return now\\? \\(y or n\\) " "y" + + # And if it returned the full width of the result. + gdb_test "adv marker" "\r\nresult=-1\r\n.* in marker \\(.*" \ + "full width of the returned result" + } + + set pf_prefix $old_prefix +} + +foreach case {{{int} %d} \ + {{long} %ld} \ + {{long long} %lld}} { + set type [lindex $case 0] + set format [lindex $case 1] + + set typeesc [string map {{ } {\ }} $type] + + if {[prepare_for_testing return-nodebug.exp "return-nodebug-long" \ + "return-nodebug.c" \ + [list "additional_flags=-DFORMAT=\"$format\" -DTYPE=$typeesc"]] == 0} { + do_test $type + } +} hooks/post-receive -- Repository for Project Archer.