Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Antoine Tremblay <antoine.tremblay@ericsson.com>
To: Pedro Alves <palves@redhat.com>, Yao Qi <qiyaoltc@gmail.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] [gdbserver] Disable conditional breakpoints on no-hardware-single-step targets
Date: Fri, 08 May 2015 12:35:00 -0000	[thread overview]
Message-ID: <554CAD9C.7090801@ericsson.com> (raw)
In-Reply-To: <554CAC25.5090909@redhat.com>



On 05/08/2015 08:29 AM, Pedro Alves wrote:
> On 05/08/2015 01:12 PM, Antoine Tremblay wrote:
>
>> This looks very nice thanks! , but I do have one question , why is the
>> result a VEC ?
>>
>>   From the context and current code won't we have only one next instruction ?
>
> Nope.  Most frequent case is conditional branches where we don't know
> where the program will end up.  Might be the destination of the branch,
> if the instruction evals true, or after the branch, if the condition evals false.
> Even though the arm code manages to evaluate most conditions itself upfront,
> there are still some cases where it can't.  The way we handle it currently
> is that the get_next_pc functions call insert extra single-step breakpoints
> themselves, like e.g., in thumb_get_next_pc_raw:
>
> 	  else
> 	    {
> 	      int cond_negated;
>
> 	      /* There are conditional instructions after this one.
> 		 If this instruction modifies the flags, then we can
> 		 not predict what the next executed instruction will
> 		 be.  Fortunately, this instruction is architecturally
> 		 forbidden to branch; we know it will fall through.
> 		 Start by skipping past it.  */
> 	      pc += thumb_insn_size (inst1);
> 	      itstate = thumb_advance_itstate (itstate);
>
> 	      /* Set a breakpoint on the following instruction.  */
> 	      gdb_assert ((itstate & 0x0f) != 0);
> 	      arm_insert_single_step_breakpoint (gdbarch, aspace,
> 						 MAKE_THUMB_ADDR (pc));
> 	      cond_negated = (itstate >> 4) & 1;
>
>
> So you see how this is a misleading/surprising interface, naturally
> something that grew organically instead of being designed for
> multiple potential destinations.
>

Hooo , right I really though it could evaluate it upfront...seems like I 
had not read the function in enough detail yet :)

> Another case where the ARM code (and others like PPC) need more than
> one "next pc" is when dealing with atomic sequences.   See e.g.,
> arm_deal_with_atomic_sequence_raw. gdbserver needs all that
> atomic sequence code too.
>
Humm ok I will take a look into this too.

>>
>> Also, if you may,file structure wise, where would be a good place for
>> this abstration layer in your view ?
>
> Good question.  Maybe a new gdb/arch/ directory.  But I'd be fine
> with putting it in gdb/common/ for now.
>

Good, thanks a lot for your help, really saved me a quite a few hours!  :)

Regards,
Antoine


  reply	other threads:[~2015-05-08 12:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1430411029-12097-1-git-send-email-qiyaoltc@gmail.com>
     [not found] ` <55426205.3070901@ericsson.com>
2015-05-01 14:18   ` Yao Qi
2015-05-08 12:18   ` Luis Machado
2015-05-08 13:14     ` Yao Qi
2015-05-06 15:43 ` Pedro Alves
2015-05-07 10:48   ` Yao Qi
2015-05-07 11:45     ` Antoine Tremblay
2015-05-08 11:50       ` Pedro Alves
2015-05-08 12:12         ` Antoine Tremblay
2015-05-08 12:29           ` Pedro Alves
2015-05-08 12:35             ` Antoine Tremblay [this message]
2015-05-08 11:02     ` Pedro Alves
2015-05-10  1:04   ` Maciej W. Rozycki
2015-05-11 11:31     ` Pedro Alves
2015-05-11 12:38       ` Maciej W. Rozycki
2015-05-11 14:08         ` Pedro Alves
2015-05-11 17:40           ` Maciej W. Rozycki

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=554CAD9C.7090801@ericsson.com \
    --to=antoine.tremblay@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=qiyaoltc@gmail.com \
    /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