This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/3] Fix inferior memory reading in GDBServer for arm/aarch32.
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Antoine Tremblay <antoine dot tremblay at ericsson dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 9 Dec 2016 12:23:39 +0000
- Subject: Re: [PATCH 1/3] Fix inferior memory reading in GDBServer for arm/aarch32.
- Authentication-results: sourceware.org; auth=none
- References: <20161128122758.7762-1-antoine.tremblay@ericsson.com> <20161201144401.GA19289@E107787-LIN> <wwoky3zzwtwx.fsf@ericsson.com>
On 16-12-01 10:28:14, Antoine Tremblay wrote:
> >> @@ -769,15 +770,15 @@ arm_sigreturn_next_pc (struct regcache *regcache, int svc_number,
> >> gdb_assert (svc_number == __NR_sigreturn || svc_number == __NR_rt_sigreturn);
> >>
> >> collect_register_by_name (regcache, "sp", &sp);
> >> - (*the_target->read_memory) (sp, (unsigned char *) &sp_data, 4);
> >> + target_read_memory (sp, (unsigned char *) &sp_data, 4);
> >>
> >> pc_offset = arm_linux_sigreturn_next_pc_offset
> >> (sp, sp_data, svc_number, __NR_sigreturn == svc_number ? 1 : 0);
> >>
> >> - (*the_target->read_memory) (sp + pc_offset, (unsigned char *) &next_pc, 4);
> >> + target_read_memory (sp + pc_offset, (unsigned char *) &next_pc, 4);
> >>
> >> /* Set IS_THUMB according the CPSR saved on the stack. */
> >> - (*the_target->read_memory) (sp + pc_offset + 4, (unsigned char *) &cpsr, 4);
> >> + target_read_memory (sp + pc_offset + 4, (unsigned char *) &cpsr, 4);
> >> *is_thumb = ((cpsr & CPSR_T) != 0);
> >
> > We are reading from stack, so we don't need to check weather there is
> > a breakpoint or not.
>
> Ho right, is it worth it to make the distinction however ?
>
> I mean, would it be better general practice to use target_read_memory
> unless we absolutely need to use the_target->read_memory like with
> breakpoint_at funcs.. ? The counterpart looks more error prone for the
> developer...
This distinction between target_read_memory and the_target->read_memory
is clear to me. If we know we are accessing some places where
breakpoints are impossible installed, like stack, use
the_target->read_memory. Otherwise, use target_read_memory.
Change in arm_get_syscall_trapinfo is not necessary to me. I can't
figure out a case that program calls syscall instruction, and the
previous instruction is a breakpoint.
--
Yao (齐尧)