public inbox for archer-commits@sourceware.org help / color / mirror / Atom feed
From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-jankratochvil-misc: Fix `return' for long on no debuginfo; new testcase. Date: Wed, 11 Feb 2009 14:45:00 -0000 [thread overview] Message-ID: <20090211144557.19664.qmail@sourceware.org> (raw) 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 <jan.kratochvil@redhat.com> 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 <http://www.gnu.org/licenses/>. */ + +#include <stdio.h> + +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 <http://www.gnu.org/licenses/>. + +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.
reply other threads:[~2009-02-11 14:45 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090211144557.19664.qmail@sourceware.org \ --to=jkratoch@sourceware.org \ --cc=archer-commits@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).