Re: [PATCH v1 1/5] cpukit/libdebugger: Avoid missed swbreak removal

2022-02-17 Thread Kinsey Moore

On 2/17/2022 13:17, Chris Johns wrote:

On 16/2/22 7:38 am, Kinsey Moore wrote:

It is possible to remove software breaks without actually restoring the
original instruction to memory. When this happens, the original
instruction is lost.

Should this


This ensures that when a software break is removed,
its original instruction is restored.

be...

This ensures a software break is removed and the original instruction is 
restored.

?


I'll update the wording to clarify in v2.


Thanks,

Kinsey

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v1 1/5] cpukit/libdebugger: Avoid missed swbreak removal

2022-02-17 Thread Chris Johns
On 16/2/22 7:38 am, Kinsey Moore wrote:
> It is possible to remove software breaks without actually restoring the
> original instruction to memory. When this happens, the original
> instruction is lost. 

Should this

> This ensures that when a software break is removed,
> its original instruction is restored.

be...

This ensures a software break is removed and the original instruction is 
restored.

?

> ---
>  cpukit/libdebugger/rtems-debugger-target.c | 16 
>  1 file changed, 16 insertions(+)
> 
> diff --git a/cpukit/libdebugger/rtems-debugger-target.c 
> b/cpukit/libdebugger/rtems-debugger-target.c
> index 04b274909b..c298a62357 100644
> --- a/cpukit/libdebugger/rtems-debugger-target.c
> +++ b/cpukit/libdebugger/rtems-debugger-target.c
> @@ -191,6 +191,22 @@ rtems_debugger_target_swbreak_control(bool insert, 
> uintptr_t addr, DB_UINT kind)
>  if (loc == swbreaks[i].address) {
>size_t remaining;
>if (!insert) {
> +if (target->breakpoint_size > 4)
> +  memcpy(loc, swbreaks[i].contents, target->breakpoint_size);
> +else {
> +  switch (target->breakpoint_size) {
> +  case 4:
> +loc[3] = swbreaks[i].contents[3];
> +  case 3:
> +loc[2] = swbreaks[i].contents[2];
> +  case 2:
> +loc[1] = swbreaks[i].contents[1];
> +  case 1:
> +loc[0] = swbreaks[i].contents[0];
> +break;
> +  }
> +}
> +rtems_debugger_target_cache_sync(&swbreaks[i]);
>  --target->swbreaks.level;
>  remaining = (target->swbreaks.level - i) * swbreak_size;
>  memmove(&swbreaks[i], &swbreaks[i + 1], remaining);
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel