* [Qemu-devel] [PATCH] target-arm: Fix arm_debug_excp_handler() for singlestep enabled
@ 2015-11-02 17:51 Sergey Fedorov
2015-11-02 18:28 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Sergey Fedorov @ 2015-11-02 17:51 UTC (permalink / raw)
To: qemu-devel; +Cc: Sergey Fedorov, Peter Maydell
CPU singlestep is done by generating a debug internal exception. Do not
raise a real CPU exception in case of singlestepping.
Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
---
target-arm/op_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
index 7929c71..67d9ffb 100644
--- a/target-arm/op_helper.c
+++ b/target-arm/op_helper.c
@@ -909,7 +909,7 @@ void arm_debug_excp_handler(CPUState *cs)
uint64_t pc = is_a64(env) ? env->pc : env->regs[15];
bool same_el = (arm_debug_target_el(env) == arm_current_el(env));
- if (cpu_breakpoint_test(cs, pc, BP_GDB)) {
+ if (cs->singlestep_enabled || cpu_breakpoint_test(cs, pc, BP_GDB)) {
return;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: Fix arm_debug_excp_handler() for singlestep enabled
2015-11-02 17:51 [Qemu-devel] [PATCH] target-arm: Fix arm_debug_excp_handler() for singlestep enabled Sergey Fedorov
@ 2015-11-02 18:28 ` Peter Maydell
2015-11-03 9:02 ` Sergey Fedorov
0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2015-11-02 18:28 UTC (permalink / raw)
To: Sergey Fedorov; +Cc: QEMU Developers
On 2 November 2015 at 17:51, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
> CPU singlestep is done by generating a debug internal exception. Do not
> raise a real CPU exception in case of singlestepping.
>
> Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
> ---
> target-arm/op_helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
> index 7929c71..67d9ffb 100644
> --- a/target-arm/op_helper.c
> +++ b/target-arm/op_helper.c
> @@ -909,7 +909,7 @@ void arm_debug_excp_handler(CPUState *cs)
> uint64_t pc = is_a64(env) ? env->pc : env->regs[15];
> bool same_el = (arm_debug_target_el(env) == arm_current_el(env));
>
> - if (cpu_breakpoint_test(cs, pc, BP_GDB)) {
> + if (cs->singlestep_enabled || cpu_breakpoint_test(cs, pc, BP_GDB)) {
> return;
> }
So I think this will mean that if we're gdbstub-single-stepping then
an architectural breakpoint on the insn we're stepping won't fire.
Does using a test
if (!cpu_breakpoint_test(cs, pc, BP_CPU)) {
return;
}
fix the singlestep bug too? If so I think it would probably be
preferable.
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: Fix arm_debug_excp_handler() for singlestep enabled
2015-11-02 18:28 ` Peter Maydell
@ 2015-11-03 9:02 ` Sergey Fedorov
2015-11-03 9:23 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Sergey Fedorov @ 2015-11-03 9:02 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers
On 02.11.2015 21:28, Peter Maydell wrote:
> On 2 November 2015 at 17:51, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>> CPU singlestep is done by generating a debug internal exception. Do not
>> raise a real CPU exception in case of singlestepping.
>>
>> Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
>> ---
>> target-arm/op_helper.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
>> index 7929c71..67d9ffb 100644
>> --- a/target-arm/op_helper.c
>> +++ b/target-arm/op_helper.c
>> @@ -909,7 +909,7 @@ void arm_debug_excp_handler(CPUState *cs)
>> uint64_t pc = is_a64(env) ? env->pc : env->regs[15];
>> bool same_el = (arm_debug_target_el(env) == arm_current_el(env));
>>
>> - if (cpu_breakpoint_test(cs, pc, BP_GDB)) {
>> + if (cs->singlestep_enabled || cpu_breakpoint_test(cs, pc, BP_GDB)) {
>> return;
>> }
> So I think this will mean that if we're gdbstub-single-stepping then
> an architectural breakpoint on the insn we're stepping won't fire.
>
> Does using a test
>
> if (!cpu_breakpoint_test(cs, pc, BP_CPU)) {
> return;
> }
>
> fix the singlestep bug too? If so I think it would probably be
> preferable.
Actually, it is supposed that gdbstub breakpoints should be handled
before CPU breakpoints. So I think we should rather do this way:
if (cpu_breakpoint_test(cs, pc, BP_GDB) || !cpu_breakpoint_test(cs, pc, BP_CPU)) {
return;
}
Thanks,
Sergey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: Fix arm_debug_excp_handler() for singlestep enabled
2015-11-03 9:02 ` Sergey Fedorov
@ 2015-11-03 9:23 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2015-11-03 9:23 UTC (permalink / raw)
To: Sergey Fedorov; +Cc: QEMU Developers
On 3 November 2015 at 09:02, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
> On 02.11.2015 21:28, Peter Maydell wrote:
>> On 2 November 2015 at 17:51, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>>> CPU singlestep is done by generating a debug internal exception. Do not
>>> raise a real CPU exception in case of singlestepping.
>>>
>>> Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
>>> ---
>>> target-arm/op_helper.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
>>> index 7929c71..67d9ffb 100644
>>> --- a/target-arm/op_helper.c
>>> +++ b/target-arm/op_helper.c
>>> @@ -909,7 +909,7 @@ void arm_debug_excp_handler(CPUState *cs)
>>> uint64_t pc = is_a64(env) ? env->pc : env->regs[15];
>>> bool same_el = (arm_debug_target_el(env) == arm_current_el(env));
>>>
>>> - if (cpu_breakpoint_test(cs, pc, BP_GDB)) {
>>> + if (cs->singlestep_enabled || cpu_breakpoint_test(cs, pc, BP_GDB)) {
>>> return;
>>> }
>> So I think this will mean that if we're gdbstub-single-stepping then
>> an architectural breakpoint on the insn we're stepping won't fire.
>>
>> Does using a test
>>
>> if (!cpu_breakpoint_test(cs, pc, BP_CPU)) {
>> return;
>> }
>>
>> fix the singlestep bug too? If so I think it would probably be
>> preferable.
>
> Actually, it is supposed that gdbstub breakpoints should be handled
> before CPU breakpoints. So I think we should rather do this way:
>
> if (cpu_breakpoint_test(cs, pc, BP_GDB) || !cpu_breakpoint_test(cs, pc, BP_CPU)) {
> return;
> }
Yes, that sounds like the right logic. I think a comment will be
helpful to explain what's going on for future readers :-)
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-03 9:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-02 17:51 [Qemu-devel] [PATCH] target-arm: Fix arm_debug_excp_handler() for singlestep enabled Sergey Fedorov
2015-11-02 18:28 ` Peter Maydell
2015-11-03 9:02 ` Sergey Fedorov
2015-11-03 9:23 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.