From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5959 invoked by alias); 28 Mar 2011 13:16:00 -0000 Received: (qmail 5743 invoked by uid 22791); 28 Mar 2011 13:15:59 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate6.uk.ibm.com (HELO mtagate6.uk.ibm.com) (194.196.100.166) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Mar 2011 13:15:54 +0000 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate6.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p2SDFhcq011109 for ; Mon, 28 Mar 2011 13:15:43 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2SDGGlm1155280 for ; Mon, 28 Mar 2011 14:16:16 +0100 Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2SDFhOu004565 for ; Mon, 28 Mar 2011 07:15:43 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p2SDFg3F004550; Mon, 28 Mar 2011 07:15:42 -0600 Message-Id: <201103281315.p2SDFg3F004550@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 28 Mar 2011 15:15:42 +0200 Subject: Re: [rfc, arm] Always use correct execution state for single-step breakpoints To: yao@codesourcery.com (Yao Qi) Date: Mon, 28 Mar 2011 14:37:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <4D8FE64E.3030409@codesourcery.com> from "Yao Qi" at Mar 28, 2011 09:37:18 AM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 2011-03/txt/msg01127.txt.bz2 Yao Qi wrote: > On 03/25/2011 02:31 AM, Ulrich Weigand wrote: > > +void > > +arm_insert_single_step_breakpoint (struct gdbarch *gdbarch, > > + struct address_space *aspace, > > + CORE_ADDR pc) > > +{ > > + struct cleanup *old_chain > > + = make_cleanup_restore_integer (&arm_override_mode); > > + > > + arm_override_mode = IS_THUMB_ADDR (pc); > > + pc = gdbarch_addr_bits_remove (gdbarch, pc); > > + > > + insert_single_step_breakpoint (gdbarch, aspace, pc); > > + > > + do_cleanups (old_chain); > > +} > > + > > I don't understand why we put make_cleanup_restore_integer/do_cleanups > in the same function. Can't we use a temp variable to save/restore the > value of arm_override_mode? To ensure that the variable is always reset, even if insert_single_step_breakpoint throws an exception. > > + > > +gdb_exit > > +gdb_start > > +gdb_reinitialize_dir $srcdir/$subdir > > +gdb_load ${binfile} > > + > > `clean_restart' can do these four above. Yes, I guess so ... I was copying an old test case. > > +if ![runto_main] then { > > + gdb_suppress_tests > > +} > > I am OK with part, but a question on general handling `failed to > runto_main'. I noticed there are some different policies to handle > that, such as `fail and return', `perror and return', and > 'gdb_suppress_tests'. Which on is recommended? I don't really have a strong opinion on that, except that perror is probably wrong (this is supposed to be uses to signal problems in the test *framework* itself). I'd say that if there is a reasonable expectation that starting up the test may fail on some platforms, a failure of runto_main ought to trigger something like UNTESTED or UNSUPPORTED. Otherwise it should trigger a FAIL. Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com