From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yBn6GZbqAmYq9RYAWB0awg (envelope-from ) for ; Tue, 26 Mar 2024 11:32:38 -0400 Received: by simark.ca (Postfix, from userid 112) id 65CF91E0C0; Tue, 26 Mar 2024 11:32:38 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5078F1E030 for ; Tue, 26 Mar 2024 11:32:36 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AE6893858288 for ; Tue, 26 Mar 2024 15:32:35 +0000 (GMT) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by sourceware.org (Postfix) with ESMTPS id 893703858C56 for ; Tue, 26 Mar 2024 15:32:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 893703858C56 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 893703858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711467133; cv=none; b=qD5sk12+JC9OcnugSJIjeS/i8CtwR1+ZeYpoURZ4JN58Ec++QUIoD/n8pWCYMG8LcOhBoVOgXMKxdZH2yvAlT9J+wA5CfCvjBwUnoifRkCvp04GSjifA5606j7iZ6qeJYndK5bdhR/xawGNG/BN9I+uw22P3/fQfPQ76RtnRNLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711467133; c=relaxed/simple; bh=YxE9MtGMyEut0Z69EKOpsOIs11Sctx9NRDhhG/5pKSQ=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=I+3pWBtOTfdTodWNbCXt95jdp7NXnOaUp501OqJsY7z5xBIjGTiv+ZuLgw+78Sm3wSqhYKh2XgY2qDzsRoZ8EoqMQTKiQVBXVzTDP8sDSF8ViEs808XxUTHrUkXVjUWH9DyvH80XBoU8KiQlWMU3OpxhykrgWhYndwjxOaD+NeI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2d6a1af9c07so79437201fa.3 for ; Tue, 26 Mar 2024 08:32:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711467120; x=1712071920; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wUEwSfk8ZmTbVgCvnUiyUN/dezBKtJQ06F7EFMCyr4Y=; b=qTzU7qP620m1IyJLJJmHaC8r5cn3EbaVZelSMAQ/uBgw1q/dxtUoh7MtifWqWIrd5K k8izKvQmDPdFJ2e0/7DIn4iYopgWzECDpRxjsoEZofb2d95zca1LJ/9SYk0EjFjckHOV iYEChngY0sXUM7ed8AQU9pcD+eWfuVnScDXdxR02Ru8GYc5gRtp5YvaFkuhJdrLocKal P7x/7ZTSqLBMqbfkpF3KfH6jCqjAWvePJ6wSI14zWdnhKgRYg28cxG7chmUUnYPUJzpa QvLolsPNWP3J6U7Mon081lFCOr0aWaiV5Is87IN3d+F725Isph5JLSUF3Qmtfc5UunvM oHHw== X-Forwarded-Encrypted: i=1; AJvYcCXaS4ojkV5qdEHE+GTjAgCG1rdp687HXyV25lJm921u//9e4ozYqOtJjP0+JKehzUlHpokrj4iuupWSlvXYiPMsFW2gIjxePyJNUw== X-Gm-Message-State: AOJu0Yxb+qMQ0XJDzJfPV82ZcDGJegMdl+1j53LB8vSN8jaTKBp4L42Q ZKk/+U/CyhtcJJ9EBIhT1tEDF+wQuZIT7KeOVMn02SPy+r21nEGTRsGZPuUnoIM= X-Google-Smtp-Source: AGHT+IFZkcEDfrVorj6cgpMzTU6oyJTt+zcsp0dYmr0CjAMOaD8BdG9r6rnzRusdU5xrZWi+NKUDdg== X-Received: by 2002:a05:6512:467:b0:513:ec32:aa7b with SMTP id x7-20020a056512046700b00513ec32aa7bmr1274776lfd.63.1711467119797; Tue, 26 Mar 2024 08:31:59 -0700 (PDT) Received: from ?IPV6:2001:8a0:f918:ab00:a3cb:34d8:f2e6:d08? ([2001:8a0:f918:ab00:a3cb:34d8:f2e6:d08]) by smtp.gmail.com with ESMTPSA id f20-20020a05600c155400b0041477f3f99fsm11846599wmg.30.2024.03.26.08.31.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Mar 2024 08:31:59 -0700 (PDT) Message-ID: <80ffa3c0-7049-4b11-8c28-1a6b6ac5c0d7@palves.net> Date: Tue, 26 Mar 2024 15:31:58 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/4] gdb, gdbserver, gdbsupport: include early header files with `-include` Content-Language: en-US To: Simon Marchi , Simon Marchi , gdb-patches@sourceware.org References: <20240323021648.154109-1-simon.marchi@efficios.com> <20240323021648.154109-4-simon.marchi@efficios.com> From: Pedro Alves In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org On 2024-03-26 14:39, Simon Marchi wrote: > On 3/26/24 7:57 AM, Pedro Alves wrote: >> On 2024-03-23 02:14, Simon Marchi wrote: >> >>> +# Rule for gdbreplay.o. This is the same as COMPILE, without INCLUDE_SERVER_H. >>> + >>> +gdbreplay.o: gdbreplay.cc >>> + $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $(CXXFLAGS) $(COMPILE.post) $< >> >> It would seem better to make gdbreplay include common-defs.h with -include, to me. Any >> reason not to do that? > > No, I just didn't give much attention to gdbreplay because... I never > used it. > > Really the simplest would be if gdbreplay could use the same -include as > the rest of gdbserver. The immediate problem I got when using `-include > server.h` for gdbreplay.cc is: > > CXX gdbreplay.o > /home/smarchi/src/binutils-gdb/gdbserver/gdbreplay.cc:80:1: error: ‘void remote_close()’ was declared ‘extern’ and later ‘static’ [-fpermissive] > 80 | remote_close (void) > | ^~~~~~~~~~~~ > In file included from /home/smarchi/src/binutils-gdb/gdbserver/server.h:94, > from : > /home/smarchi/src/binutils-gdb/gdbserver/remote-utils.h:36:6: note: previous declaration of ‘void remote_close()’ > 36 | void remote_close (void); > | ^~~~~~~~~~~~ > > That is, if gdbreplay includes server.h, it sees some declaration of > remote_close() which conflicts with its own declaration of > remote_close(). > > One quick solution to that could be renaming gdbreplay's remote_close > function. Or, put all of gdbreplay.cc (except main()) in an anonymous > namespace, which would be the appropriate C++ thing to do anyway. Now, > if gdbreplay.cc uses `-include server.h`, it will "see" more things than > it needs to, but if it builds, it should work? I guess? And anyway a > subsequent goal will be to strip server.h to the bare minimum. > Ultimately, it should only contain just a few things that should be > suitable to both gdbserver and gdbreplay (include of > gdbsupport/common-defs.h, include of gdbserver/config.h and a few other > basic things). Does that sound good to you? You said a lot of different things, so I'm not sure which part I'd be agreeing with. :-) gdbreplay is a separate program that happens share a few bits of code with gdbserver, but not that much. It currently includes common-defs.h at the top of its source file. So I think the really simplest is to make the rule for gdbreplay.o you were adding use "-include common-defs.h". Or add a new gdbreplay.h header that includes common-defs.h and -include that one. Anything else than that seems like a distraction at this point, and I wouldn't call those other options simpler. The look certainly more debatable to me.