* [patch, avr, sim] PR19401 - Update PC when simulate break instruction
@ 2016-07-01 10:59 Pitchumani Sivanupandi
2016-07-08 5:29 ` Pitchumani Sivanupandi
0 siblings, 1 reply; 3+ messages in thread
From: Pitchumani Sivanupandi @ 2016-07-01 10:59 UTC (permalink / raw)
To: gdb-patches; +Cc: Pedro Alves, Mike Frysinger, Denis Chertykov
When there is a software breakpoint for avr target, gdb asks remote to
write break instruction (0x9598) in the breakpoint location. When target
hits breakpoint location the it asks remote to restore the content.
Remote will resume from the PC when GDB asks.
After executing break instruction AVR MCU's PC will point to next
location. It is the remote (gdb-server/ sim) who sets PC to next
instruction to be executed (after hitting software breakpoint).
So, AVR simulator's PC is expected to point breakpoint location when it
hits break insn. Simulator was doing that earlier. It is changed after
the commit 9943d3185, which introduces sim_engine_halt to handle break.
Since this function jumps to sim_resume using longjmp to sim_resume,
code that sets PC (cpu->pc = ipc) is not executed.
Following patch will restore the behavior of setting PC on break.
diff --git a/sim/avr/interp.c b/sim/avrinterp.c
index 31a9940..fcce9b2 100644
--- a/sim/avr/interp.c
+++ b/sim/avr/interp.c
@@ -911,8 +911,7 @@ step_once (SIM_CPU *cpu)
case OP_break:
/* Stop on this address. */
- sim_engine_halt (CPU_STATE (cpu), cpu, NULL, cpu->pc, sim_stopped,
SIM_SIGTRAP);
- cpu->pc = ipc;
+ sim_engine_halt (CPU_STATE (cpu), cpu, NULL, ipc, sim_stopped,
SIM_SIGTRAP);
break;
case OP_bld:
If OK, could someone commit please? I don't have commit access.
Regards,
Pitchumani
sim/ChangeLog
2016-07-01 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
PR target/ 19401
* avr/interp.c (step_once): Pass break instruction address to
sim_engine_halt function which writes that to PC. Remove code that
follows that function call as it is unreachable.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch, avr, sim] PR19401 - Update PC when simulate break instruction
2016-07-01 10:59 [patch, avr, sim] PR19401 - Update PC when simulate break instruction Pitchumani Sivanupandi
@ 2016-07-08 5:29 ` Pitchumani Sivanupandi
2016-07-19 6:49 ` Denis Chertykov
0 siblings, 1 reply; 3+ messages in thread
From: Pitchumani Sivanupandi @ 2016-07-08 5:29 UTC (permalink / raw)
To: gdb-patches; +Cc: Pedro Alves, Mike Frysinger, Denis Chertykov
Ping!
On Friday 01 July 2016 09:58 PM, Pitchumani Sivanupandi wrote:
> When there is a software breakpoint for avr target, gdb asks remote to
> write break instruction (0x9598) in the breakpoint location. When target
> hits breakpoint location the it asks remote to restore the content.
> Remote will resume from the PC when GDB asks.
>
> After executing break instruction AVR MCU's PC will point to next
> location. It is the remote (gdb-server/ sim) who sets PC to next
> instruction to be executed (after hitting software breakpoint).
>
> So, AVR simulator's PC is expected to point breakpoint location when it
> hits break insn. Simulator was doing that earlier. It is changed after
> the commit 9943d3185, which introduces sim_engine_halt to handle break.
> Since this function jumps to sim_resume using longjmp to sim_resume,
> code that sets PC (cpu->pc = ipc) is not executed.
>
> Following patch will restore the behavior of setting PC on break.
>
> diff --git a/sim/avr/interp.c b/sim/avrinterp.c
> index 31a9940..fcce9b2 100644
> --- a/sim/avr/interp.c
> +++ b/sim/avr/interp.c
> @@ -911,8 +911,7 @@ step_once (SIM_CPU *cpu)
>
> case OP_break:
> /* Stop on this address. */
> - sim_engine_halt (CPU_STATE (cpu), cpu, NULL, cpu->pc, sim_stopped,
> SIM_SIGTRAP);
> - cpu->pc = ipc;
> + sim_engine_halt (CPU_STATE (cpu), cpu, NULL, ipc, sim_stopped,
> SIM_SIGTRAP);
> break;
>
> case OP_bld:
>
> If OK, could someone commit please? I don't have commit access.
>
> Regards,
> Pitchumani
>
> sim/ChangeLog
>
> 2016-07-01 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
>
> PR target/ 19401
> * avr/interp.c (step_once): Pass break instruction address to
> sim_engine_halt function which writes that to PC. Remove code that
> follows that function call as it is unreachable.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch, avr, sim] PR19401 - Update PC when simulate break instruction
2016-07-08 5:29 ` Pitchumani Sivanupandi
@ 2016-07-19 6:49 ` Denis Chertykov
0 siblings, 0 replies; 3+ messages in thread
From: Denis Chertykov @ 2016-07-19 6:49 UTC (permalink / raw)
To: Pitchumani Sivanupandi; +Cc: gdb-patches, Pedro Alves, Mike Frysinger
Committed.
2016-07-08 8:30 GMT+03:00 Pitchumani Sivanupandi
<pitchumani.sivanupandi@atmel.com>:
> Ping!
>
>
> On Friday 01 July 2016 09:58 PM, Pitchumani Sivanupandi wrote:
>>
>> When there is a software breakpoint for avr target, gdb asks remote to
>> write break instruction (0x9598) in the breakpoint location. When target
>> hits breakpoint location the it asks remote to restore the content.
>> Remote will resume from the PC when GDB asks.
>>
>> After executing break instruction AVR MCU's PC will point to next
>> location. It is the remote (gdb-server/ sim) who sets PC to next
>> instruction to be executed (after hitting software breakpoint).
>>
>> So, AVR simulator's PC is expected to point breakpoint location when it
>> hits break insn. Simulator was doing that earlier. It is changed after
>> the commit 9943d3185, which introduces sim_engine_halt to handle break.
>> Since this function jumps to sim_resume using longjmp to sim_resume,
>> code that sets PC (cpu->pc = ipc) is not executed.
>>
>> Following patch will restore the behavior of setting PC on break.
>>
>> diff --git a/sim/avr/interp.c b/sim/avrinterp.c
>> index 31a9940..fcce9b2 100644
>> --- a/sim/avr/interp.c
>> +++ b/sim/avr/interp.c
>> @@ -911,8 +911,7 @@ step_once (SIM_CPU *cpu)
>>
>> case OP_break:
>> /* Stop on this address. */
>> - sim_engine_halt (CPU_STATE (cpu), cpu, NULL, cpu->pc, sim_stopped,
>> SIM_SIGTRAP);
>> - cpu->pc = ipc;
>> + sim_engine_halt (CPU_STATE (cpu), cpu, NULL, ipc, sim_stopped,
>> SIM_SIGTRAP);
>> break;
>>
>> case OP_bld:
>>
>> If OK, could someone commit please? I don't have commit access.
>>
>> Regards,
>> Pitchumani
>>
>> sim/ChangeLog
>>
>> 2016-07-01 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
>>
>> PR target/ 19401
>> * avr/interp.c (step_once): Pass break instruction address to
>> sim_engine_halt function which writes that to PC. Remove code that
>> follows that function call as it is unreachable.
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-19 6:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-01 10:59 [patch, avr, sim] PR19401 - Update PC when simulate break instruction Pitchumani Sivanupandi
2016-07-08 5:29 ` Pitchumani Sivanupandi
2016-07-19 6:49 ` Denis Chertykov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).