diff mbox series

[v2,RESEND,7/7] Hexagon (linux-user/hexagon): handle breakpoints

Message ID 26f1f1cc2c23fe4669326cabe5615188be9afc06.1681993775.git.quic_mathbern@quicinc.com
State New
Headers show
Series Hexagon: add lldb support | expand

Commit Message

Matheus Tavares Bernardino April 20, 2023, 12:31 p.m. UTC
From: Taylor Simpson <tsimpson@quicinc.com>

This enables LLDB to work with hexagon linux-user mode through the GDB
remote protocol.

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
---
 linux-user/hexagon/cpu_loop.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Richard Henderson April 27, 2023, 1:31 p.m. UTC | #1
On 4/20/23 13:31, Matheus Tavares Bernardino wrote:
> From: Taylor Simpson <tsimpson@quicinc.com>
> 
> This enables LLDB to work with hexagon linux-user mode through the GDB
> remote protocol.
> 
> Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
> Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
> ---
>   linux-user/hexagon/cpu_loop.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c
> index b84e25bf71..00c12bbb55 100644
> --- a/linux-user/hexagon/cpu_loop.c
> +++ b/linux-user/hexagon/cpu_loop.c
> @@ -33,6 +33,7 @@ void cpu_loop(CPUHexagonState *env)
>       target_ulong ret;
>   
>       for (;;) {
> +        target_siginfo_t info;
>           cpu_exec_start(cs);
>           trapnr = cpu_exec(cs);
>           cpu_exec_end(cs);
> @@ -63,6 +64,15 @@ void cpu_loop(CPUHexagonState *env)
>           case EXCP_ATOMIC:
>               cpu_exec_step_atomic(cs);
>               break;
> +        case EXCP_DEBUG:
> +            info = (target_siginfo_t) {
> +                .si_signo = TARGET_SIGTRAP,
> +                .si_errno = 0,
> +                .si_code = TARGET_TRAP_BRKPT,
> +                ._sifields._sigfault._addr = 0
> +            };
> +            queue_signal(env, info.si_signo, QEMU_SI_KILL, &info);

Use force_sig_fault.


r~
diff mbox series

Patch

diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c
index b84e25bf71..00c12bbb55 100644
--- a/linux-user/hexagon/cpu_loop.c
+++ b/linux-user/hexagon/cpu_loop.c
@@ -33,6 +33,7 @@  void cpu_loop(CPUHexagonState *env)
     target_ulong ret;
 
     for (;;) {
+        target_siginfo_t info;
         cpu_exec_start(cs);
         trapnr = cpu_exec(cs);
         cpu_exec_end(cs);
@@ -63,6 +64,15 @@  void cpu_loop(CPUHexagonState *env)
         case EXCP_ATOMIC:
             cpu_exec_step_atomic(cs);
             break;
+        case EXCP_DEBUG:
+            info = (target_siginfo_t) {
+                .si_signo = TARGET_SIGTRAP,
+                .si_errno = 0,
+                .si_code = TARGET_TRAP_BRKPT,
+                ._sifields._sigfault._addr = 0
+            };
+            queue_signal(env, info.si_signo, QEMU_SI_KILL, &info);
+            break;
         default:
             EXCP_DUMP(env, "\nqemu: unhandled CPU exception %#x - aborting\n",
                      trapnr);