From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41975 invoked by alias); 12 May 2016 13:25:47 -0000 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 Received: (qmail 41964 invoked by uid 89); 12 May 2016 13:25:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=H*r:0400, cancelled X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 12 May 2016 13:25:44 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usplmg21.ericsson.net (Symantec Mail Security) with SMTP id 64.6A.03614.42484375; Thu, 12 May 2016 15:24:53 +0200 (CEST) Received: from elxa4wqvvz1 (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.84) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 12 May 2016 09:25:40 -0400 References: <1462530736-25117-1-git-send-email-yao.qi@linaro.org> <1462530736-25117-3-git-send-email-yao.qi@linaro.org> <8660ukev20.fsf@gmail.com> User-agent: mu4e 0.9.17; emacs 24.4.1 From: Antoine Tremblay To: Yao Qi CC: Subject: Re: [RFC 2/3] use reinsert breakpoint for vCont;s In-Reply-To: <8660ukev20.fsf@gmail.com> Date: Thu, 12 May 2016 13:25:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg00196.txt.bz2 Yao Qi writes: > Yao Qi writes: > >> + >> + if (!step_over_finished && !can_hardware_single_step ()) >> + { >> + /* If the thread resumed by resume_step hits the reinsert >> + breakpoint, delete the reinsert breakpoint for it. */ >> + if (current_thread->last_resume_kind == resume_step) >> + delete_reinsert_breakpoints (current_thread); >> + else >> + { >> + /* If the thread resumed by other kind, like >> + resume_continue, hits the breakpoint (either >> + reinsert breakpoint or GDB breakpoint), delete >> + all reinsert breakpoints if it hits non-reinsert >> + breakpoints, otherwise, leave reinsert breakpoint there >> + and step over it. */ >> + if (non_reinsert_breakpoint_inserted_here (event_child->stop_pc)) >> + delete_reinsert_breakpoints (NULL); >> + } >> + } >> } >> else >> { >> /* We have some other signal, possibly a step-over dance was in >> progress, and it should be cancelled too. */ >> step_over_finished = finish_step_over (event_child); >> + >> + if (!step_over_finished && !can_hardware_single_step ()) >> + delete_reinsert_breakpoints (NULL); >> } >> >> /* We have all the data we need. Either report the event to GDB, or >> @@ -3568,6 +3590,8 @@ linux_wait_1 (ptid_t ptid, >> >> /* Alright, we're going to report a stop. */ >> >> + delete_reinsert_breakpoints (NULL); >> + > > The SIGILL is caused by removing these reinsert breakpoints when threads > are still running. I adjust the code removing reinsert breakpoints when > threads stop, the SIGILL goes away. I think the insertion of the breakpoints may also be unsafe in non-stop mode, since correct me if am wrong but in linux_resume we can't assume that all threads are stopped and thus when we call single_step from: linux_resume->linux_resume_one_lwp->single_step another thread could hit the memory we're writing to. We should stop all threads before the breakpoint insertion like done in start_step_over. Actually I think we should have a function like start_software_vCont that does stops all threads, insert the breakpoints, resume all threads... I have not pinpointed the design of this however as I'd rather not call it from the linux_resume_one_lwp callback. It would be weird to mess with the thread running state there. I'm thinking, maybe again close to what step over is doing having a: if (software_single_step && !hardware_single_step) find_inferior (&all_threads, need_software_vCont..) if (need_software_vCont) start_software_vCont - stop all threads - call single_step to insert the breakpoints - resume all threads And I guess we can have a stop_software_vCont to match it. I have not gone through the stop scenarios enough yet to tell where however...