From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) by sourceware.org (Postfix) with ESMTPS id 8B5863858C33 for ; Sat, 22 Oct 2022 08:36:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8B5863858C33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=g.ncu.edu.tw Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=g.ncu.edu.tw Received: by mail-yb1-xb29.google.com with SMTP id l145so5893121ybl.0 for ; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=g.ncu.edu.tw; s=google; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=TjhyUYLZ8SZfvx9qpsCF9mwXCwL832K7T+Rwfn8u3tE=; b=kM3KvoB+++zWL9D6yxt/NUOgUiPjaupUOKAFvf1FT56uGR2IjTUKJjQu+i5e2DG+M6 NmKaR0GilbnzRit37xkSU++LYh2DBVSj7mpRBoimEyHNBVybFudWfj2+mByLlkpsx6Jq sp7BiJJoFDOxW4vHMdASceKb/iVw0OkibXCks= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=TjhyUYLZ8SZfvx9qpsCF9mwXCwL832K7T+Rwfn8u3tE=; b=pBcWchiuH9ph2liVF/rSCT8BFMt6E3OWLL/7X5HyJkUVDBf5BNikjE3QvZPn3Kssg/ FZdH0WFgdJC0Xg5+gNhDI8nqM14LHXEWurg0KbyVvJFAUrf0z4aslWXsRnVEvfM+z9eT qqpkSMyYyBwdrhkWawC+qth/FylmXvykfC6Ml+hrJ299h47mJmq/tOyteXdjEUMCEpNe Jaa/VEs2bpLQx0+B0Pdgpn4SAH4Dy8AN33NudZIHdTEaWdxDSjVArdlVr/F8fJkMMT1K GVsd2bi7P0fyXQ364YAO8PyaobJTL+NPFA3Hz1YIzERwjE2h06COnbIRlS3ngZl1WGmi 1/GA== X-Gm-Message-State: ACrzQf0K5vNwDo+Ft9VAIDkCMyZglRDIw5cIDkQN7tBNbPpJTay+7czS lPL468Pc+unNkWSqPXyTQ1ppCWVH/y/pnZRH05JJa087VZoy1YFH X-Google-Smtp-Source: AMsMyM5CcyOu/moZCdH5o7T+9/CAzIKKHPdUwS7EkBJO60zxdDXFiBEYJuLA6e4mVb8uUra8/fEStLIpoJgcx+pPvE0= X-Received: by 2002:a25:6b06:0:b0:6be:41cc:eb0d with SMTP id g6-20020a256b06000000b006be41cceb0dmr20382983ybc.496.1666427785652; Sat, 22 Oct 2022 01:36:25 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?B?5Yip5om/5piV?= Date: Sat, 22 Oct 2022 16:36:13 +0800 Message-ID: Subject: Unexpected behavior of `gdb.PARAM_INTEGER` and `gdb.PARAM_UINTEGER` parameter To: gdb@sourceware.org Content-Type: multipart/alternative; boundary="000000000000353fb305eb9b7456" X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,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 List-Id: --000000000000353fb305eb9b7456 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, I've noticed that if we use Python API to create a `gdb.PARAM_INTEGER` or `gdb.PARAM_UINTEGER` parameter this way: ``` $ cat test.py import gdb class ExampleParam(gdb.Parameter): def __init__ (self, name): super(ExampleParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_INTEGER) self.value =3D 0 self.saved_value =3D True def get_set_string (self): print(self.value) return "Set to %r" % self.value ExampleParam("example=E2=80=9D) ``` According to the docs here: https://sourceware.org/gdb/onlinedocs/gdb/Parameters-In-Python.html, `0` should be interpreted to mean "unlimited", so I expected that when a `gdb.PARAM_INTEGER` or `gdb.PARAM_UINTEGER` parameter=E2=80=99s value is "unlimited" in GDB, then the value in Python will be interpreted to 0. But somehow, GDB interprets `None` to mean "unlimited" for that parameter we created: ``` $ gdb -q -nx -ex 'source test.py=E2=80=99 (gdb) show example The current value of 'example' is "unlimited=E2=80=9D. (gdb) pi gdb.parameter("example") is None True (gdb) set example unlimited None Set to None (gdb) pi gdb.parameter("example") is None True (gdb) show example The current value of 'example' is "unlimited". (gdb) set example 0 None Set to None (gdb) pi gdb.parameter("example") is None True (gdb) show example The current value of 'example' is "unlimited". ``` You can notice that GDB set the value of the `example` to `None` instead of `0`. Is this the expected result? My GDB version is GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90, and I'm on Ubuntu 22.04.1 LTS. Best Regards, Alan Li --000000000000353fb305eb9b7456--