From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3876 invoked by alias); 28 Mar 2011 01:37:36 -0000 Received: (qmail 3740 invoked by uid 22791); 28 Mar 2011 01:37:34 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Mar 2011 01:37:28 +0000 Received: (qmail 1803 invoked from network); 28 Mar 2011 01:37:27 -0000 Received: from unknown (HELO ?192.168.0.102?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 28 Mar 2011 01:37:27 -0000 Message-ID: <4D8FE64E.3030409@codesourcery.com> Date: Mon, 28 Mar 2011 08:11:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [rfc, arm] Always use correct execution state for single-step breakpoints References: <201103241831.p2OIVfSm025531@d06av02.portsmouth.uk.ibm.com> In-Reply-To: <201103241831.p2OIVfSm025531@d06av02.portsmouth.uk.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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/msg01115.txt.bz2 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? > + > +gdb_exit > +gdb_start > +gdb_reinitialize_dir $srcdir/$subdir > +gdb_load ${binfile} > + `clean_restart' can do these four above. > +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? -- Yao (齐尧)