From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 65045 invoked by alias); 8 May 2015 11:50:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 65028 invoked by uid 89); 8 May 2015 11:50:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 08 May 2015 11:50:35 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 452B98E3C3; Fri, 8 May 2015 11:50:34 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t48BoWnQ028226; Fri, 8 May 2015 07:50:33 -0400 Message-ID: <554CA308.1030509@redhat.com> Date: Fri, 08 May 2015 11:50:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Antoine Tremblay , Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [PATCH] [gdbserver] Disable conditional breakpoints on no-hardware-single-step targets References: <1430411029-12097-1-git-send-email-qiyaoltc@gmail.com> <554A368F.4060309@redhat.com> <86oalwvf38.fsf@gmail.com> <554B5052.2090904@ericsson.com> In-Reply-To: <554B5052.2090904@ericsson.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-05/txt/msg00185.txt.bz2 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; } Thanks, Pedro Alves