Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Antoine Tremblay <antoine.tremblay@ericsson.com>
To: Pedro Alves <palves@redhat.com>, Yao Qi <qiyaoltc@gmail.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] [gdbserver] Disable conditional breakpoints on no-hardware-single-step targets
Date: Fri, 08 May 2015 12:12:00 -0000	[thread overview]
Message-ID: <554CA83F.7080909@ericsson.com> (raw)
In-Reply-To: <554CA308.1030509@redhat.com>



On 05/08/2015 07:50 AM, Pedro Alves wrote:
> On 05/07/2015 12:45 PM, Antoine Tremblay wrote:
>
>> Just fyi, I'm working on doing this at the moment, my investigation is
>> still incomplete...
>>
>> So far I mainly plan to port the arm_get_next code to gdbserver, to
>> accomplish 1. , the code doesn't have so many deps so it should be ok
>> 2. by looking at $cpsr
>> 3. should be fine as 1 and 2 are done...
>>
>> I don't know however yet the best strategy to share the code but I'm
>> guessing I could make the parts that don't have any deps to gdbarch etc
>> in a shared function with gdb/gdbserver... Any pointers on this are
>> welcome...
>
> Yeah, sharing is good.
>
> Maybe adding an abstraction layer object, like:
>
> struct get_next_pc;
>
> struct get_next_pc_ops
> {
>     void (*read_memory) (struct get_next_pc *self, ...);
>     void (*read_register) (struct get_next_pc *self, ...);
>     ...
> };
>
> struct get_next_pcs
> {
>     struct get_next_pc_ops *vtable;
>
>     VEC(CORE_ADDR) *result;
>
>     enum bfd_endian byte_order;
>     enum bfd_endian byte_order_for_code;
>     whatever_type whatever_other_context;
>     ...
> };
>
> And then both GDB and GDBserver would instantiate
> a struct get_next_pc object, like:
>
> struct get_next_pc_ops gdb_get_next_pc_ops = {
>     gdb_get_next_pc_read_memory,
>     gdb_get_next_pc_read_register,
>     ...
> }
>
> struct gdb_get_next_pcs
> {
>    struct get_next_pc base;
>
>    // add whatever other context only gdb needs.
> };
>
> int
> arm_software_single_step (struct frame_info *frame)
> {
>    struct gdbarch *gdbarch = get_frame_arch (frame);
>    struct gdb_get_next_pc next_pc;
>    CORE_ADDR pc;
>
>    next_pc.vtable = gdb_get_next_pc_ops;
>    next_pc.byte_order = gdbarch_byte_order (gdbarch);
>    next_pc.byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
>
>    // arm_get_next_pcs is the existing gdb code adjusted to the
>    // new interface.
>    arm_get_next_pcs (&next_pc);
>
>    // walk result vec (a VEC of CORE_ADDRs) and insert breakpoints.
>    // alternatively add a insert_breakpoint callback to struct get_next_pc_ops
>    // and insert breakpoints from within arm_get_next_pcs, as currently.
>    for (i = 0;
>         VEC_iterate (CORE_ADDR, next_pcs.result, i, pc);
>         ++i)
>      {
>         arm_insert_single_step_breakpoint (gdbarch, aspace, pc);
>      }
>
>    return 1;
> }
>

This looks very nice thanks! , but I do have one question , why is the 
result a VEC ?

 From the context and current code won't we have only one next instruction ?

Also, if you may,file structure wise, where would be a good place for 
this abstration layer in your view ?

Thanks,
Antoine


  reply	other threads:[~2015-05-08 12:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1430411029-12097-1-git-send-email-qiyaoltc@gmail.com>
     [not found] ` <55426205.3070901@ericsson.com>
2015-05-01 14:18   ` Yao Qi
2015-05-08 12:18   ` Luis Machado
2015-05-08 13:14     ` Yao Qi
2015-05-06 15:43 ` Pedro Alves
2015-05-07 10:48   ` Yao Qi
2015-05-07 11:45     ` Antoine Tremblay
2015-05-08 11:50       ` Pedro Alves
2015-05-08 12:12         ` Antoine Tremblay [this message]
2015-05-08 12:29           ` Pedro Alves
2015-05-08 12:35             ` Antoine Tremblay
2015-05-08 11:02     ` Pedro Alves
2015-05-10  1:04   ` Maciej W. Rozycki
2015-05-11 11:31     ` Pedro Alves
2015-05-11 12:38       ` Maciej W. Rozycki
2015-05-11 14:08         ` Pedro Alves
2015-05-11 17:40           ` Maciej W. Rozycki

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=554CA83F.7080909@ericsson.com \
    --to=antoine.tremblay@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=qiyaoltc@gmail.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