This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] This patch fixes GDBServer's run control for single stepping
- From: Antoine Tremblay <antoine dot tremblay at ericsson dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: Antoine Tremblay <antoine dot tremblay at ericsson dot com>, Pedro Alves <palves at redhat dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Sun, 19 Feb 2017 14:39:49 -0500
- Subject: Re: [PATCH 1/2] This patch fixes GDBServer's run control for single stepping
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=antoine dot tremblay at ericsson dot com;
- References: <20161129120702.9490-1-antoine.tremblay@ericsson.com> <20170127150139.GB24676@E107787-LIN> <wwokwpdg5vxa.fsf@ericsson.com> <CAH=s-PP-i3v_Fr=QeWt9BQeJzjCHtW79nGYpJ9hF-Bb=OBo89Q@mail.gmail.com> <wwokr33o5pkb.fsf@ericsson.com> <CAH=s-PO98nCE4UB9ag+V=M2mBnZT0FOeHV3d7mFMLYe1+v=mFg@mail.gmail.com> <wwok8tps8yo2.fsf@ericsson.com> <2255ed6f-a146-026c-f871-00e9a33dfcf0@redhat.com> <wwokwpcp7fvn.fsf@ericsson.com> <b5fb81d1-66fc-68c2-9785-ffa487de59e0@redhat.com> <wwoktw7t7bzy.fsf@ericsson.com> <CAH=s-PPx+SjoE0DkTKKNqg4Dr4zHFNt6QeC-XXT_LoXVh004iw@mail.gmail.com> <wwokh93s1he3.fsf@ericsson.com> <CAH=s-PPrB=s6d9Q07W=-b8Sz9umh6_Lj24PyO4x99Z3QrtfmzQ@mail.gmail.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Yao Qi writes:
> On 17-02-17 19:17:56, Antoine Tremblay wrote:
>> > In ARM ARM, we have the pseudo code,
>> >
>> > boolean InITBlock()
>> > return (ITSTATE.IT<3:0> != ‘0000’);
>> >
>> > ITSTATE can be got from CPSR.
>>
>> Yes that's good if you're inserting a breakpoint at current PC but
>> otherwise you will need something else...
>
> In software single step, we calculate the next pcs, and select
> breakpoint kinds of them, according to current pc. If current
> pc is not within IT block (!InITBlock ()) or the last instruction
> in IT block (LastInITBlock ()), we can safely use 16-bit thumb
> breakpoint for any thumb instruction. That is, in
> gdbserver/linux-aarch32-low.c:arm_breakpoint_kind_from_current_state,
> we can return ARM_BP_KIND_THUMB if (!InITBlock () || LastInITBlock ()).
>
> Then, in some level, when installing software single step breakpoints,
> if one breakpoint type is ARM_BP_KIND_THUMB2 and installed
> address is 2-byte aligned, stop all threads.
Yes that would make sense but I think we can be calling get_next_pc
to insert a software single step breakpoint at an address different then
the current PCs next address.
See: https://sourceware.org/ml/gdb-patches/2016-06/msg00268.html
"> If we only remove before reporting an event to gdb, then I don't
> understand this. We already insert single-step breakpoints when
> we process the resume request from gdb, no?
We insert single-step breakpoints when we process the resume requests
and threads are about to be resumed. If threads still have pending
status, single-step breakpoints are not installed, so we need to install
them in proceed_all_lwps."
This is still true AFAIK so GDBServer may be at any PC stopped on a
pending event and need to insert a single step breakpoint at an address
unrelated to that event so in that case CPSR can't be used...
Thanks,
Antoine