From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id izmMN2C4AmZGzBYAWB0awg (envelope-from ) for ; Tue, 26 Mar 2024 07:58:24 -0400 Received: by simark.ca (Postfix, from userid 112) id D46961E0C0; Tue, 26 Mar 2024 07:58:24 -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 B9EAD1E030 for ; Tue, 26 Mar 2024 07:58:22 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 62339385841B for ; Tue, 26 Mar 2024 11:58:22 +0000 (GMT) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by sourceware.org (Postfix) with ESMTPS id 45D513858D38 for ; Tue, 26 Mar 2024 11:58:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 45D513858D38 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 45D513858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711454284; cv=none; b=ZbjuhgGaug6t66OyOMxEYcUyD35SLpDFbwAqPmj6+tnzCSegWpfKwHJM0rD2W2K3snt0lX6DgdurRLMlYX7To/6MBkwOzidAKXVqrnaZlc5aUZP1n9AMXl67CK5L74FXQ7q5sUnxxs9sVlKAdFSNSQqwZAv2ijHp3AEpfZRxLGE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711454284; c=relaxed/simple; bh=ullN8G9EfU0Uzo9YkNd/RfiyKYJXjUrl9o900fspdpg=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=CBxr4e+eNu8wsYuBMXhPeb4zcU/uIgxlk/sKg+trJ5WVBRLzCmgUlwln7aCqaNbvRnoX0JUsl4KXVJmsryzC8kO3Y9QLoLqy3ApQgL8UsMjgOdE39d4vIm5Cs+c6D14h0MD6R6+2k42n+epItNGjxLSiiO9wnGc6WO4fjDNr5Bc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-41488e17e1cso11712475e9.0 for ; Tue, 26 Mar 2024 04:58:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711454280; x=1712059080; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=R2qXfVUjqvP/326vFw7CmUksYqB96TM9h6w5yd8SOng=; b=QLxXgNal+t1QLRYR45pzAAM9uy233nwneBm/yi11AqEi39vN9YzszC3myu8noZtRkB DJzJi4/X3trgcRE1JtucuWwcFdzxQbY9w8Le0E8EEdLLuYa/iXC+zAS8V/g2/hUzt0nd DnDrz3rI9xncbBR3Nj22k/upVZTyZtw8rFEaw61cgV+FVlsiJuyowOK+wTwJLcQfFoBL VH/39E8vgDRUzfAzBa39XfvilzYrTii90DE0Qpzm0nGOVI4EqPmz3uiaKTHSrrXfnMir uFfDaTqcKFK8UQ2Get6xWMBszTZf5iReYGF3GRstvZHn8P2tsUj0tuGTCOOFwTt6wr8G LnGA== X-Forwarded-Encrypted: i=1; AJvYcCVVrfgMlogHwfdBc+pL65XLtVSOd50icpiHdT0+nO30g5f/ElpBkDY1796nXfHzAHYxDLt6tcYuCqFupLuHthsTATlZkmzN8tk6Eg== X-Gm-Message-State: AOJu0YyAYwSZE9Bk6YuDQwzPdMpzpHjiiH8b7DBotl3620VEi0tTAhMs U1PHfstK93Va6jbqOx2BqZuYpnv/ZGPFLqosCBS1obHCC9GTdSfH X-Google-Smtp-Source: AGHT+IEMWR2kJu3abX6wDfjZFDJAIQy+/ljfcSBaPV+KonqPSB7zbIFCp1eOylYYwZp8dDWualxoZg== X-Received: by 2002:a05:600c:358f:b0:414:6865:b5bc with SMTP id p15-20020a05600c358f00b004146865b5bcmr1672523wmq.28.1711454279805; Tue, 26 Mar 2024 04:57: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 bd14-20020a05600c1f0e00b004148bc72f7csm4213611wmb.4.2024.03.26.04.57.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Mar 2024 04:57:59 -0700 (PDT) Message-ID: Date: Tue, 26 Mar 2024 11:57:56 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/4] gdb, gdbserver, gdbsupport: include early header files with `-include` To: Simon Marchi , gdb-patches@sourceware.org References: <20240323021648.154109-1-simon.marchi@efficios.com> <20240323021648.154109-4-simon.marchi@efficios.com> Content-Language: en-US From: Pedro Alves In-Reply-To: <20240323021648.154109-4-simon.marchi@efficios.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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-23 02:14, Simon Marchi wrote: > With this change, clangd picks up the -include option from the compile > command, and is able to analyze the header file correctly, as it sees > all that stuff included or defined but that -include option. That works but that -> by that > - There is one problem for gdbserver's Makefile: we do not want to > include server.h when building `gdbreplay.o`. So we can't simply put > the `-include` in `INTERNAL_CFLAGS`. I added the `-include` option > to the `COMPILE` and `IPAGENT_COMPILE` variables, and added a special > rule to compile `gdbreplay.o`. > ... > diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in > index 45073abca493..4d29491a8721 100644 > --- a/gdbserver/Makefile.in > +++ b/gdbserver/Makefile.in > @@ -69,9 +69,11 @@ COMPILE.pre = $(CXX) $(CXX_DIALECT) > COMPILE.post = -c -o $@ > POSTCOMPILE = @true > > +INCLUDE_SERVER_H = -include $(srcdir)/server.h > + ... > +# 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?