From: liangzhen <liangzhen@linux.spacemit.com>
To: gdb-patches@sourceware.org
Cc: zhuangqiubin@linux.spacemit.com
Subject: Re: [PATCH v2 2/2] gdbserver: riscv: Add support for hardware breakpoints/watchpoints
Date: Thu, 9 Apr 2026 12:49:19 +0800 [thread overview]
Message-ID: <5233250DC48EA18D+a7ca8f5b-68d9-46d2-ac17-f7c8cc2487de@linux.spacemit.com> (raw)
In-Reply-To: <20260409024546.350958-3-liangzhen@linux.spacemit.com>
Note: something forgot to change.
On 4/9/2026 10:45 AM, Zane Leung wrote:
> +/* Implementation of linux target ops method "low_insert_point".
> +
> + It actually only records the info of the to-be-inserted bp/wp;
> + the actual insertion will happen when threads are resumed. */
> +
> +int
> +riscv_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
> + int len, raw_breakpoint *bp)
> +{
> + int ret;
> + enum target_hw_bp_type targ_type;
> + struct riscv_debug_reg_state *state
> + = riscv_get_debug_reg_state (current_thread->id.pid ());
> +
> + if (show_debug_regs)
> + fprintf (stderr, "insert_point on entry (addr=0x%08lx, len=%d)\n",
> + (unsigned long) addr, len);
> +
> + /* Determine the type from the raw breakpoint type. */
> + targ_type = raw_bkpt_type_to_target_hw_bp_type (type);
> +
> + ret = riscv_handle_point (targ_type, addr, len,
> + 1 /* is_insert */,
> + current_lwp_ptid (), state);
> +
Here should be
ret = riscv_handle_point (targ_type, addr, len,
1 /* is_insert */,
current_lwp_ptid (), state) ? 0 : -1;
> + if (show_debug_regs)
> + riscv_show_debug_reg_state (state, "insert_point", addr, len,
> + targ_type);
> +
> + return ret;
> +}
> +
> +/* Implementation of linux target ops method "low_remove_point".
> +
> + It actually only records the info of the to-be-removed bp/wp,
> + the actual removal will be done when threads are resumed. */
> +
> +int
> +riscv_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
> + int len, raw_breakpoint *bp)
> +{
> + int ret;
> + enum target_hw_bp_type targ_type;
> + struct riscv_debug_reg_state *state
> + = riscv_get_debug_reg_state (current_thread->id.pid ());
> +
> + if (show_debug_regs)
> + fprintf (stderr, "remove_point on entry (addr=0x%08lx, len=%d)\n",
> + (unsigned long) addr, len);
> +
> + /* Determine the type from the raw breakpoint type. */
> + targ_type = raw_bkpt_type_to_target_hw_bp_type (type);
> +
> + ret = riscv_handle_point (targ_type, addr, len,
> + 0 /* is_insert */,
> + current_lwp_ptid (), state);
> +
Same above.
> + if (show_debug_regs)
> + riscv_show_debug_reg_state (state, "remove_point", addr, len,
> + targ_type);
> +
> + return ret;
> +}
> +
prev parent reply other threads:[~2026-04-09 4:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-09 2:45 [PATCH v2 0/2] RISC-V hardware breakpoint/watchpoint support Zane Leung
2026-04-09 2:45 ` [PATCH v2 1/2] gdb: riscv: Add support for hardware breakpoints/watchpoints Zane Leung
2026-04-09 2:45 ` [PATCH v2 2/2] gdbserver: " Zane Leung
2026-04-09 4:49 ` liangzhen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5233250DC48EA18D+a7ca8f5b-68d9-46d2-ac17-f7c8cc2487de@linux.spacemit.com \
--to=liangzhen@linux.spacemit.com \
--cc=gdb-patches@sourceware.org \
--cc=zhuangqiubin@linux.spacemit.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox