From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by sourceware.org (Postfix) with ESMTPS id 0A5FD3857C58 for ; Wed, 13 Dec 2023 16:35:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A5FD3857C58 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0A5FD3857C58 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702485356; cv=none; b=Y/+6SV+9fv7Ko9jQLgeqpDLaMx+Y/dD2FRlSegtdzLskXF5Ntnf0BaIM45yqvHCc+6lThb2RDRQEMNwk+us5kvgQKMi0EZoGPM9KJj7ldtkbIig9ADNuUUhZg25/STTyBEC6IP5GlxvY6WFc8H7qPzaJrYOmrIcu+Mbdz978DoU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702485356; c=relaxed/simple; bh=4AL6xslHIOQFgJRDmm0+/+0MwJbuCebo7eXhjvLTUns=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=lf5T37fMgodJrMPhCoQnZ1TSK9uJAdc/stFZw/IV1B10hrnYJW7w/jYyv8FiOAbPqg5o5jZLvpIYEcDmvRcG3emRd1EQiqj65wJDEKkRh4lRYv6P/s4aqkd29i5E2aIpINOziKLZ2kF461rKWGru54mDfHalYSp86egQKN30s5s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-50c0478f970so7552971e87.3 for ; Wed, 13 Dec 2023 08:35:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1702485352; x=1703090152; darn=sourceware.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/ycAWMoEgVHdQVTN7W02AqOobVkxcsB62T2Fhd861Pk=; b=YGTJkhA90iGLdaBqOJbGAUpQfNMoHBJUko6BwTOEW+auE/hKfxw/OlyNIPos597UO6 YYGjPfiWW/KpGLTN+j/75Sx9zZ2Q5+1f2qGweH8MHyGwOXdM0gCpwUKCC2xxhA25W7ry Mbzza6+BqL9rcSMifg7moFtTeX2Z8EhyMf4EbzwPqVZoVZLHgkKnyRU4YxPfcJitgvsm TpN8nhxAJTxuEw3gFhteCNFUiW+88uezU6/nOZGlWUC3QsNKLaFoOG+a90ad/8X8YzuJ 20jxCoPnX0lvw2PvdakK7bjDsP5T2ga6cj0fZKb4PkViHIKy8D8LUj5zrbqNZ4+3Ys7O BrLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702485352; x=1703090152; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=/ycAWMoEgVHdQVTN7W02AqOobVkxcsB62T2Fhd861Pk=; b=m4yFNVUPxkLYBxjrHKS4w4/c8aC9UPDicIxHD3C3JuJacz4wr5p34RlKrraBeSpqKF 0veAXGjxIDa9QZBCiNOs8l6zQJSss88VqYQAHyvfXsSZRQqm5LDwkC714Knzrm2Az3UY vqrJ7DWu23K3QNau6iFRgkvtRsgIJ9IufaezCsRlYlJ6mjgHnqVeV0Q6KALV2yGRCULW BK8sBbfVzKKR0VLJYcRGEUmyTAmbd0IXVtS6uCXtwgV0lFvzL1T+78zmWtkkuzzfyiEg 1PBEOJjn5K5lGGN/KkWEkYK+56xwnkSuP8sbf1sufa4O67pw/Mx6ANRTxeKWYwvamqs1 L+zw== X-Gm-Message-State: AOJu0Yw+ntbdRulVSMuOHU5pf0bChZOfM8G5C9isX9HheEeMpLb/ix09 R3dI64mIKbMCBpFT0yTxcrTwDb+qaiajYxBvBUeFVg== X-Google-Smtp-Source: AGHT+IGjVkqxaC/31wqmy/lhIGzRsEf+uTgg6eCaLCvt74WAsEyJV8TeH3WIAkHpyI+QibDZcMbRag== X-Received: by 2002:ac2:4a7a:0:b0:50c:d7f:5618 with SMTP id q26-20020ac24a7a000000b0050c0d7f5618mr3351320lfp.117.1702485351866; Wed, 13 Dec 2023 08:35:51 -0800 (PST) Received: from legouguec-Precision-7550 ([2.57.72.67]) by smtp.gmail.com with ESMTPSA id sk26-20020a170906631a00b00a1f7852c877sm7308253ejc.142.2023.12.13.08.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 08:35:51 -0800 (PST) From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 2/4] Add DAP log level parameter In-Reply-To: <20231212-dap-no-test-exceptions-v1-2-af0e33f10093@adacore.com> (Tom Tromey's message of "Tue, 12 Dec 2023 10:44:43 -0700") References: <20231212-dap-no-test-exceptions-v1-0-af0e33f10093@adacore.com> <20231212-dap-no-test-exceptions-v1-2-af0e33f10093@adacore.com> Date: Wed, 13 Dec 2023 17:35:50 +0100 Message-ID: <87plza3vrt.fsf@adacore.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,WEIRD_QUOTING autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tom Tromey writes: > +# Logging levels. > +LOG_DEFAULT =3D 1 > +LOG_FULL =3D 2 > + > + > +class LogLevel(gdb.Parameter): > + """DAP logging level.""" > + > + set_doc =3D "Set the DAP logging level." > + show_doc =3D "Show the DAP logging level." > + > + def __init__(self): > + super().__init__( > + "debug dap-log-level", gdb.COMMAND_MAINTENANCE, gdb.PARAM_ZU= INTEGER > + ) > + self.value =3D LOG_DEFAULT > + > + > +_log_level =3D LogLevel() I might suggest an enum here: from enum import IntEnum, auto class LogLevel(IntEnum): DEFAULT =3D auto() FULL =3D auto() class LogLevelParam(gdb.Parameter): """...""" def __init__(self): ... self.value =3D LogLevel.DEFAULT But the benefits of Python enums are somewhat marginal (even more so in this instance; FWIW I _think_ IntEnum & auto are all available since 3.4), so no strong feelings about this. Reviewed-By: K=C3=A9vin Le Gouguec