From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4565 invoked by alias); 7 Jan 2011 15:23:55 -0000 Received: (qmail 4553 invoked by uid 22791); 7 Jan 2011 15:23:54 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 Jan 2011 15:23:49 +0000 Received: (qmail 21012 invoked from network); 7 Jan 2011 15:23:46 -0000 Received: from unknown (HELO ?192.168.0.101?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 7 Jan 2011 15:23:46 -0000 Message-ID: <4D272FF6.3070402@codesourcery.com> Date: Fri, 07 Jan 2011 15:23:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: "gdb-patches@sourceware.org" Subject: duplicated code in gdb and gdbserver Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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 X-SW-Source: 2011-01/txt/msg00153.txt.bz2 I noticed that sharing code of GDB and GDBServer is discussed in 2010 GCC Summit. http://sourceware.org/gdb/wiki/2010_GCC_Summit_BoF Looks like one conclusion is that "it is likely to be quite complex". I don't understand this point fully, so I had a try by myself to create a new file linux-common.h in gdb/common/, move some duplicated macro definitions from gdb/linux-nat.c and gdb/gdbserver/linux-low.c to common/linux-common.h, and adjust *.h files include order. Then, both GDB and GDBServer can be build on x86. Totally, it costs me nearly half an hour to complete this experiment. Could anyone tell me which part of this work is "quite complex"? Am I missing something? Regardless of this potential complexity I haven't met, it is worthwhile moving obviously common/duplicated code into single file, isn't? Comments are welcome. -- Yao (齐尧)