From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2640 invoked by alias); 12 Aug 2013 12:25:28 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 2625 invoked by uid 89); 12 Aug 2013 12:25:28 -0000 X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.2 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 12 Aug 2013 12:25:27 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1V8rBd-0003yl-Mt from Luis_Gustavo@mentor.com ; Mon, 12 Aug 2013 05:25:25 -0700 Received: from NA1-MAIL.mgc.mentorg.com ([147.34.98.181]) by svr-orw-fem-01.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 12 Aug 2013 05:25:25 -0700 Received: from [172.30.2.104] ([172.30.2.104]) by NA1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 12 Aug 2013 05:25:25 -0700 Message-ID: <5208D432.1010307@codesourcery.com> Date: Mon, 12 Aug 2013 12:25:00 -0000 From: Luis Machado Reply-To: lgustavo@codesourcery.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: Yue Lu CC: gdb@sourceware.org, Thomas Schwinge Subject: Re: How to share code between [gdb]/gnu-nat.c with [gdb]/gdbserver/gnu-hurd-low.c? References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-08/txt/msg00064.txt.bz2 On 08/12/2013 05:36 AM, Yue Lu wrote: > Hi all, > > When I working with porting gdbserver to GNU/Hurd I found I alway need > to duplicate code from [gdb]/gnu-nat.c to my new file > [gdb]/gdb/server/gnu-hurd.low.c. There are too many functions and > structures can be shared between the two file only need a little > change or even without any change. > > I don't have good ideal to share the code, can you give me any > suggestions? Thank you. Any common code you come up with can potentially be included inside gdb/common. Then you need to make sure both gdb's and gdbserver's Makefile's are adjusted to match that. The more you can share, the better. It helps keep things organized that way. There is an ongoing discussion related to proper naming of files and paths, but that should not stop you from sharing code anyway. Luis