From patchwork Mon Apr 21 15:49:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 631 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx20.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id A3300360072 for ; Mon, 21 Apr 2014 08:49:40 -0700 (PDT) Received: by homiemail-mx20.g.dreamhost.com (Postfix, from userid 14314964) id 64C3A411A0694; Mon, 21 Apr 2014 08:49:40 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx20.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx20.g.dreamhost.com (Postfix) with ESMTPS id 4165E411DCE8D for ; Mon, 21 Apr 2014 08:49:40 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; q=dns; s=default; b=hp9 /xAoIKkAkGICQRM7Bofzj1/d6lIIpKn1agNL6185sQSCvTcqFTFY5y4OfhKbytDT kxajZwWZj1/Zf1QZn9wDB6Sg77bmmkfkvMJUdPav26LkduWeT+UqqlYPzmI3gJ1c e4btSv/AWX615LZi5pNvQmOWg8HOs7OxZuJk6Eyc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; s=default; bh=JHC/qfb3a Np5GPR6ZTpMqqyMQX4=; b=y5mnymvuTCSjx4s1EV6vuOGfPDJO8dFeHGz+knIHe BcKjgUsj0CRerYqwtdcRzsmAS7bZRecC3XLVzOK2aUHpLvUwz5vw8NDGawukLSpS xCwGDk1OjheJR7+8ivX3TTpMzSC07KH0i9sM9vXxdgFgvJa+7sPTjgxU9nCGQGmq iU= Received: (qmail 24876 invoked by alias); 21 Apr 2014 15:49:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 24865 invoked by uid 89); 21 Apr 2014 15:49:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_50, SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 21 Apr 2014 15:49:36 +0000 Received: from EUSAAHC006.ericsson.se (Unknown_Domain [147.117.188.90]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id EF.51.06192.23DE4535; Mon, 21 Apr 2014 12:04:34 +0200 (CEST) Received: from [142.133.110.254] (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.90) with Microsoft SMTP Server (TLS) id 14.3.174.1; Mon, 21 Apr 2014 11:49:33 -0400 Message-ID: <53553E27.6060009@ericsson.com> Date: Mon, 21 Apr 2014 11:49:59 -0400 From: Simon Marchi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: GDB Patches Subject: [PATCH] Remove unused variable X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in should_resume is set to 1 at the beginning and never changed. The legal paperwork for people at Ericsson Montreal has been completed last week, so I would be ready to open an account to be able to submit patches. gdb/ChangeLog: 2014-04-21 Simon Marchi * infrun.c (resume): Remove should_resume (unused). diff --git a/gdb/infrun.c b/gdb/infrun.c index 31bb132..49fd58c 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1771,13 +1771,13 @@ user_visible_resume_ptid (int step) void resume (int step, enum gdb_signal sig) { - int should_resume = 1; struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0); struct regcache *regcache = get_current_regcache (); struct gdbarch *gdbarch = get_regcache_arch (regcache); struct thread_info *tp = inferior_thread (); CORE_ADDR pc = regcache_read_pc (regcache); struct address_space *aspace = get_regcache_aspace (regcache); + ptid_t resume_ptid; QUIT; @@ -1921,87 +1921,82 @@ a command like `return' or `jump' to continue execution.")); insert_breakpoints (); } - if (should_resume) + /* If STEP is set, it's a request to use hardware stepping + facilities. But in that case, we should never + use singlestep breakpoint. */ + gdb_assert (!(singlestep_breakpoints_inserted_p && step)); + + /* Decide the set of threads to ask the target to resume. Start + by assuming everything will be resumed, than narrow the set + by applying increasingly restricting conditions. */ + resume_ptid = user_visible_resume_ptid (step); + + /* Maybe resume a single thread after all. */ + if ((step || singlestep_breakpoints_inserted_p) + && tp->control.trap_expected) + { + /* We're allowing a thread to run past a breakpoint it has + hit, by single-stepping the thread with the breakpoint + removed. In which case, we need to single-step only this + thread, and keep others stopped, as they can miss this + breakpoint if allowed to run. */ + resume_ptid = inferior_ptid; + } + + if (gdbarch_cannot_step_breakpoint (gdbarch)) { - ptid_t resume_ptid; + /* Most targets can step a breakpoint instruction, thus + executing it normally. But if this one cannot, just + continue and we will hit it anyway. */ + if (step && breakpoint_inserted_here_p (aspace, pc)) + step = 0; + } - /* If STEP is set, it's a request to use hardware stepping - facilities. But in that case, we should never - use singlestep breakpoint. */ - gdb_assert (!(singlestep_breakpoints_inserted_p && step)); + if (debug_displaced + && use_displaced_stepping (gdbarch) + && tp->control.trap_expected) + { + struct regcache *resume_regcache = get_thread_regcache (resume_ptid); + struct gdbarch *resume_gdbarch = get_regcache_arch (resume_regcache); + CORE_ADDR actual_pc = regcache_read_pc (resume_regcache); + gdb_byte buf[4]; - /* Decide the set of threads to ask the target to resume. Start - by assuming everything will be resumed, than narrow the set - by applying increasingly restricting conditions. */ - resume_ptid = user_visible_resume_ptid (step); + fprintf_unfiltered (gdb_stdlog, "displaced: run %s: ", + paddress (resume_gdbarch, actual_pc)); + read_memory (actual_pc, buf, sizeof (buf)); + displaced_step_dump_bytes (gdb_stdlog, buf, sizeof (buf)); + } - /* Maybe resume a single thread after all. */ - if ((step || singlestep_breakpoints_inserted_p) - && tp->control.trap_expected) - { - /* We're allowing a thread to run past a breakpoint it has - hit, by single-stepping the thread with the breakpoint - removed. In which case, we need to single-step only this - thread, and keep others stopped, as they can miss this - breakpoint if allowed to run. */ - resume_ptid = inferior_ptid; - } + if (tp->control.may_range_step) + { + /* If we're resuming a thread with the PC out of the step + range, then we're doing some nested/finer run control + operation, like stepping the thread out of the dynamic + linker or the displaced stepping scratch pad. We + shouldn't have allowed a range step then. */ + gdb_assert (pc_in_thread_step_range (pc, tp)); + } - if (gdbarch_cannot_step_breakpoint (gdbarch)) - { - /* Most targets can step a breakpoint instruction, thus - executing it normally. But if this one cannot, just - continue and we will hit it anyway. */ - if (step && breakpoint_inserted_here_p (aspace, pc)) - step = 0; - } + /* Install inferior's terminal modes. */ + target_terminal_inferior (); - if (debug_displaced - && use_displaced_stepping (gdbarch) - && tp->control.trap_expected) - { - struct regcache *resume_regcache = get_thread_regcache (resume_ptid); - struct gdbarch *resume_gdbarch = get_regcache_arch (resume_regcache); - CORE_ADDR actual_pc = regcache_read_pc (resume_regcache); - gdb_byte buf[4]; - - fprintf_unfiltered (gdb_stdlog, "displaced: run %s: ", - paddress (resume_gdbarch, actual_pc)); - read_memory (actual_pc, buf, sizeof (buf)); - displaced_step_dump_bytes (gdb_stdlog, buf, sizeof (buf)); - } - - if (tp->control.may_range_step) - { - /* If we're resuming a thread with the PC out of the step - range, then we're doing some nested/finer run control - operation, like stepping the thread out of the dynamic - linker or the displaced stepping scratch pad. We - shouldn't have allowed a range step then. */ - gdb_assert (pc_in_thread_step_range (pc, tp)); - } + /* Avoid confusing the next resume, if the next stop/resume + happens to apply to another thread. */ + tp->suspend.stop_signal = GDB_SIGNAL_0; - /* Install inferior's terminal modes. */ - target_terminal_inferior (); - - /* Avoid confusing the next resume, if the next stop/resume - happens to apply to another thread. */ - tp->suspend.stop_signal = GDB_SIGNAL_0; - - /* Advise target which signals may be handled silently. If we have - removed breakpoints because we are stepping over one (which can - happen only if we are not using displaced stepping), we need to - receive all signals to avoid accidentally skipping a breakpoint - during execution of a signal handler. */ - if ((step || singlestep_breakpoints_inserted_p) - && tp->control.trap_expected - && !use_displaced_stepping (gdbarch)) - target_pass_signals (0, NULL); - else - target_pass_signals ((int) GDB_SIGNAL_LAST, signal_pass); + /* Advise target which signals may be handled silently. If we have + removed breakpoints because we are stepping over one (which can + happen only if we are not using displaced stepping), we need to + receive all signals to avoid accidentally skipping a breakpoint + during execution of a signal handler. */ + if ((step || singlestep_breakpoints_inserted_p) + && tp->control.trap_expected + && !use_displaced_stepping (gdbarch)) + target_pass_signals (0, NULL); + else + target_pass_signals ((int) GDB_SIGNAL_LAST, signal_pass); - target_resume (resume_ptid, step, sig); - } + target_resume (resume_ptid, step, sig); discard_cleanups (old_cleanups); }