From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by sourceware.org (Postfix) with ESMTPS id 8A7DC3857BA4 for ; Tue, 14 Nov 2023 13:36:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A7DC3857BA4 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 8A7DC3857BA4 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699968966; cv=none; b=pbkiQvl/FQF0Xe/1YsQeze4+foLbSmAp3GFvYsLrZbwjbu2MRqVI5Yl33vUuVFJllmhfPINoqhtgu78aY5jS4/dI9g5mql0k80tJW7GqHNQrVBLbmBulKqbkvabhSFz3UfLR0GJSR7xLZ4gO4a9jj13s2tqmeWN3ABtF9/V984s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699968966; c=relaxed/simple; bh=sFNFJLFOo7sHpJC9lweAQCH4XHAy+3s/EwlrZ+7a94E=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=DpDHmcU2M1bdemWLMrHo9zmQZgUK4yelJ0ThDKoAA6oJl9iZOVm3M/UfLRLzDFvSTv5aWESf4qN6Z+aPYf5g5hXuPBsyZYmH3wlA8pRWrwq8OL4oeO12Dxe1hDfn6MOfPMOvGCPjpuzXqX05Zw8EsAFwqb2tJPMjgQz0XEZ/Dj0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-32da7ac5c4fso3574501f8f.1 for ; Tue, 14 Nov 2023 05:36:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699968963; x=1700573763; 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=Kdw7ETI09XT7RKvMy73/h+i68X4qrKF3SNFv/y2FXxU=; b=WI1NayMa1UVLMEvDvFqigX7tkM0i6Qx54VkJ00Hnn6FwtTj4wAzWEgSjDc8A147HVU SdisWcM4Whm1bq1enpTYr3wfC6I1ldprQfsrJA/DDNLKIxMF4ZhMFf8p60K3lq75aMb+ R26lDgfrvO477dYUp5NTjiyP7k1ZJj7yqChTVdiaFTC5E2PoJXnKpH3JWX0gOKIHUbK3 CJIlQnL8PnY8cBg6ZdilF3z4dpaYyYlNcw0z/pL/exuaYEsC7Qeoi9TOwZNZFz4Qesa6 BWrv9T1li+xQSOn6EEwEZjmBTGcgsZ4eWZy3e4bWskQ4vR/HlyI7rhmdTFhQxYZkSJ9G kHvA== X-Gm-Message-State: AOJu0Ywtp5wRb2dwIZEuLqovclEEPUOO3U3rsxCcP+E3ihr1E9GZRmRx /WEAOKmsxB1opBp7ojYwwgonpT0eysVvxQ== X-Google-Smtp-Source: AGHT+IEAg1XSv9VCGggXaHGcUweOXrmb3x8jDti/5WfyrEkHnabhHq4p33XPxkQ4l0RNq3NI8jb6gg== X-Received: by 2002:a5d:47ac:0:b0:32d:a4c9:8ab4 with SMTP id 12-20020a5d47ac000000b0032da4c98ab4mr6708078wrb.65.1699968963343; Tue, 14 Nov 2023 05:36:03 -0800 (PST) Received: from ?IPV6:2001:8a0:f91e:1a00:b524:7bcc:766c:ef6f? ([2001:8a0:f91e:1a00:b524:7bcc:766c:ef6f]) by smtp.gmail.com with ESMTPSA id g9-20020adff409000000b0032f7d7ec4adsm7716444wro.92.2023.11.14.05.36.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Nov 2023 05:36:02 -0800 (PST) Message-ID: <614c7fe2-795d-4fed-8638-c9412fbcf50e@palves.net> Date: Tue, 14 Nov 2023 13:36:01 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/3] gdb: handle default argument in make-target-delegates.py Content-Language: en-US To: "Aktemur, Tankut Baris" , "gdb-patches@sourceware.org" References: <476f2068afadd0d56827493eb014a90b41eea887.1699953637.git.tankut.baris.aktemur@intel.com> <761454b8-0df3-4291-bc83-3fca7852c4ce@palves.net> From: Pedro Alves In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 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,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-11-14 12:48, Aktemur, Tankut Baris wrote: > On Tuesday, November 14, 2023 12:31 PM, Pedro Alves wrote: >> On 2023-11-14 09:41, Tankut Baris Aktemur wrote: >> >>> Currently, target.h does not contain any arguments with default >>> values. The goal of this patch is to address potential future and >>> downstream cases; we (Intel) have cases with default argument values. >> >> Hmm, but default arguments in virtual methods is generally considered a bad idea, >> because default arguments are a static property which doesn't propagate when >> you override a method. Like: > > This is an important point that I missed. Thanks. > > This would make Patch 3/3 obsolete. I'd still like to keep > Patch 2/3 for review (I'd update its commit message, though). > I think Patch 2/3 makes the regexp easier to read and has a value. I will take a look. > At the gdbserver side, we have macros instead. E.g.: > > #define target_create_inferior(program, program_args) \ > the_target->create_inferior (program, program_args) > > These macros look like they remained from the C time and not > every target op consistently has a wrapper macro. A macro > is not used consistently even when it exists. > > Is there a general direction about them, like > > 1. They shall stay and be used; we shall fix the lack of consistency. > > 2. They shall be converted into global wrapper functions; we shall > use the wrappers consistently. > > 3. They shall be removed and replaced by the actual method call. > E.g.: > the_target->foo (...); > instead of > target_foo (...); > > (FWIW, option #3 makes the most sense to me.) I'd go with #2, for a few reasons: - so you have a place to put the default arguments. - so that we have some consistency with the GDB side. It's even the case that some target_foo wrapper methods are shared between GDB and GDBserver -- see gdb/target/target.h. - it'd help if we decided to add a target stack concept to GDBserver too.