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 v3 15/17] PPC64: Fix gdb.arch/ppc64-atomic-inst.exp with displaced stepping


On 04/21/2015 12:20 PM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
> 
>> The ppc64 displaced step code can't handle atomic sequences.  Fallback
>> to stepping over the breakpoint in-line if we detect one.
> 
> Probably arm atom sequences instructions can't be executed out-of-line
> either, I'll write a test for this.

Thanks.

> 
>>
>> gdb/ChangeLog:
>> 2015-04-17  Pedro Alves  <palves@redhat.com>
>>
>> 	* infrun.c (displaced_step_prepare): Return -1 if
>> 	gdbarch_displaced_step_copy_insn returns NULL.
>> 	(resume): When displaced stepping doesn't work, try software
>> 	single-stepping.
> 
> This chunk isn't shown in the patch below, has been committed already?

Sorry about that.  Double snafu.  It was supposed to be "try stepping
over the breakpoint in-line", not software single-step.  And then, that
"resume" change ended up moved to the previous patch.

> 
>> diff --git a/gdb/infrun.c b/gdb/infrun.c
>> index be186a7..a89eefc 100644
>> --- a/gdb/infrun.c
>> +++ b/gdb/infrun.c
>> @@ -1797,9 +1797,14 @@ displaced_step_prepare_throw (ptid_t ptid)
>>  
>>    closure = gdbarch_displaced_step_copy_insn (gdbarch,
>>  					      original, copy, regcache);
>> -
>> -  /* We don't support the fully-simulated case at present.  */
>> -  gdb_assert (closure);
>> +  if (closure == NULL)
>> +    {
>> +      /* The architecture doesn't know how or want to displaced step
>> +	 this instruction or instruction sequence.  Fallback to
>> +	 stepping over the breakpoint in-line.  */
>> +      do_cleanups (old_cleanups);
>> +      return -1;
>> +    }
>>  
>>    /* Save the information we need to fix things up if the step
>>       succeeds.  */
> 
> We need to update the comments to displaced_step_prepare_throw about
> return value -1.
> 

I've added this to the patch:

diff --git i/gdb/infrun.c w/gdb/infrun.c
index f627094..aaa543b 100644
--- i/gdb/infrun.c
+++ w/gdb/infrun.c
@@ -1713,7 +1713,9 @@ displaced_step_dump_bytes (struct ui_file *file,
    explain how we handle this case instead.

    Returns 1 if preparing was successful -- this thread is going to be
-   stepped now; or 0 if displaced stepping this thread got queued.  */
+   stepped now; 0 if displaced stepping this thread got queued; or -1
+   if this instruction can't be displaced stepped.  */
+
 static int
 displaced_step_prepare_throw (ptid_t ptid)
 {

Thanks,
Pedro Alves


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