Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Antoine Tremblay <antoine.tremblay@ericsson.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] Fix inferior memory reading in GDBServer for arm/aarch32.
Date: Fri, 09 Dec 2016 12:23:00 -0000	[thread overview]
Message-ID: <20161209122339.GG13661@E107787-LIN> (raw)
In-Reply-To: <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 (齐尧)


  parent reply	other threads:[~2016-12-09 12:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-28 12:28 Antoine Tremblay
2016-11-28 12:28 ` [PATCH 3/3] Fix inferior memory reading in GDBServer for sparc Antoine Tremblay
2016-12-09 12:51   ` Antoine Tremblay
2016-11-28 12:28 ` [PATCH 2/3] Fix inferior memory reading in GDBServer for ppc Antoine Tremblay
2016-11-30 20:46 ` [PATCH 1/3] Fix inferior memory reading in GDBServer for arm/aarch32 Luis Machado
2016-12-01 14:44 ` Yao Qi
2016-12-01 15:28   ` Antoine Tremblay
2016-12-01 15:55     ` Antoine Tremblay
2016-12-01 16:18       ` Antoine Tremblay
2016-12-01 18:10         ` Antoine Tremblay
2016-12-09 12:06           ` Yao Qi
2016-12-09 12:22             ` [PATCH v2] " Antoine Tremblay
2016-12-09 12:23     ` Yao Qi [this message]
2016-12-09 12:46       ` [PATCH v3] " Antoine Tremblay
2017-01-09 11:55         ` Antoine Tremblay
2017-01-09 17:31         ` Yao Qi
2017-01-09 17:41           ` Antoine Tremblay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161209122339.GG13661@E107787-LIN \
    --to=qiyaoltc@gmail.com \
    --cc=antoine.tremblay@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox