From patchwork Mon Nov 23 14:29:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tristan Gingold X-Patchwork-Id: 9793 Received: (qmail 8140 invoked by alias); 23 Nov 2015 14:29:09 -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 8093 invoked by uid 89); 23 Nov 2015 14:29:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 23 Nov 2015 14:29:08 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 954753525456 for ; Mon, 23 Nov 2015 15:29:05 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PVb_pDihGTB5 for ; Mon, 23 Nov 2015 15:29:05 +0100 (CET) Received: from dhcp-guest-231.act-europe.fr (dhcp-guest-231.act-europe.fr [10.10.127.231]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 82957352541E for ; Mon, 23 Nov 2015 15:29:05 +0100 (CET) From: Tristan Gingold Subject: [PATCH/darwin]: do not cache single step flag Message-Id: <89F3C280-F128-4F58-8F86-995BA9965088@adacore.com> Date: Mon, 23 Nov 2015 15:29:05 +0100 To: GDB Patches Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) X-IsSubscribed: yes Hi, as an attempt to reduce context switches, the single step flag was cached and applied only to the target in case of change. But this wasn’t reliable in case of inferior call, as the context was saved and restored. This patch simply remove this shortcut. Also remove a couple of unneeded casts. Pushed on master. Tristan. darwin-nat: disable sstep cache. Was not reliable after inferior call. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6a8592e..605eb39 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2015-11-23 Tristan Gingold + * darwin-nat.c (darwin_ptrace): Avoid a cast. + (darwin_resume_thread): Ditto. And always set or reset + single step. + +2015-11-23 Tristan Gingold + * darwin-nat.c (darwin_read_dyld_info): Write address in big-endian order. * solib-darwin.c (darwin_validate_exec_header): New function, diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index cb2b08e..457ba89 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -245,12 +245,12 @@ unparse_exception_type (unsigned int i) static int darwin_ptrace (const char *name, - int request, int pid, PTRACE_TYPE_ARG3 arg3, int arg4) + int request, int pid, caddr_t arg3, int arg4) { int ret; errno = 0; - ret = ptrace (request, pid, (caddr_t) arg3, arg4); + ret = ptrace (request, pid, arg3, arg4); if (ret == -1 && errno == 0) ret = 0; @@ -728,7 +728,7 @@ darwin_resume_thread (struct inferior *inf, darwin_thread_t *thread, { /* Either deliver a new signal or cancel the signal received. */ res = PTRACE (PT_THUPDATE, inf->pid, - (void *)(uintptr_t)thread->gdb_port, nsignal); + (caddr_t)thread->gdb_port, nsignal); if (res < 0) inferior_debug (1, _("ptrace THUP: res=%d\n"), res); } @@ -743,13 +743,10 @@ darwin_resume_thread (struct inferior *inf, darwin_thread_t *thread, } /* Set or reset single step. */ - if (step != thread->single_step) - { - inferior_debug (4, _("darwin_set_sstep (thread=0x%x, enable=%d)\n"), - thread->gdb_port, step); - darwin_set_sstep (thread->gdb_port, step); - thread->single_step = step; - } + inferior_debug (4, _("darwin_set_sstep (thread=0x%x, enable=%d)\n"), + thread->gdb_port, step); + darwin_set_sstep (thread->gdb_port, step); + thread->single_step = step; darwin_send_reply (inf, thread); thread->msg_state = DARWIN_RUNNING;