This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 1/7] Add breakpoint_from_pc target_ops for software breakpoints in GDBServer.
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Antoine Tremblay <antoine dot tremblay at ericsson dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Thu, 15 Oct 2015 09:26:58 +0100
- Subject: Re: [PATCH v2 1/7] Add breakpoint_from_pc target_ops for software breakpoints in GDBServer.
- Authentication-results: sourceware.org; auth=none
- References: <1444063455-31558-1-git-send-email-antoine dot tremblay at ericsson dot com> <1444063455-31558-2-git-send-email-antoine dot tremblay at ericsson dot com>
Antoine Tremblay <antoine.tremblay@ericsson.com> writes:
> diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
> index 3a1a6ae..dc16fe0 100644
> --- a/gdb/gdbserver/linux-low.c
> +++ b/gdb/gdbserver/linux-low.c
> @@ -3012,7 +3012,11 @@ linux_wait_1 (ptid_t ptid,
> if (!ptid_equal (step_over_bkpt, null_ptid)
> && event_child->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT)
> {
> - unsigned int increment_pc = the_low_target.breakpoint_len;
> + int increment_pc = 0;
> + CORE_ADDR stop_pc = event_child->stop_pc;
> +
> + (*the_low_target.breakpoint_from_pc)
> + (&stop_pc, &increment_pc);
>
They can be in the same line.
> if (debug_threads)
> {
> @@ -6932,6 +6936,15 @@ current_lwp_ptid (void)
> return ptid_of (current_thread);
> }
>
> +const unsigned char *
> +linux_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
> +{
> + if (the_low_target.breakpoint_from_pc != NULL)
> + return (*the_low_target.breakpoint_from_pc) (pcptr, lenptr);
> + else
> + return NULL;
> +}
If the breakpoint_from_pc is NULL, this GDBserver port should be
broken. We can use gdb_assert to assert
the_low_target.breakpoint_from_pc isn't NULL.
Otherwise the patch looks good to me.
--
Yao (éå)