This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] Fix inferior memory reading in GDBServer for arm/aarch32.


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 (齐尧)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]