From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by sourceware.org (Postfix) with ESMTPS id 3DA563858D37 for ; Fri, 7 Jul 2023 18:14:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3DA563858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-3fc02a92dcfso4270345e9.0 for ; Fri, 07 Jul 2023 11:14:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688753694; x=1691345694; 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=PBkGsPiSvmz8E7287ksHo+ncgJIeFVdCz5lmTbQPJGw=; b=AKRBrnl1pn4Mg6noeVi553rPWD6tty3PS2lPQ83MyweVZWe7cEsMHM8AOaFRlI9rwY 5vlOX5rNXgMPgC2j+8R1YmvwlEPevrAMGDQJjPc7sEfLg5RZx5XLqvkO8LJfdga+C0vv p2pO+Boylwl1neuVvYJNjosFrEVOdgM4mm/xPSpM8psIJoVy2YpUcDQS/iTCRP1W6JGx 8Ff856Axftd1qKpw14xMBoVz/TvrzsfX1b2JuopSPfF2PdaMU2dNZpP+2eAszS3G5Tu5 Di76jdQ6hAWjw8+MDyjj9mIPbfyxhoSdDZbjA2LDly65+3ZcHftetEpXpMzKXP/VXB2+ fsvg== X-Gm-Message-State: ABy/qLa8xOiS5uG2MFZNRd7qzbR06R22OrWuqOQFfbR0BrO4u///fQXq cswmB+f/nVpa56t4qmAClyU= X-Google-Smtp-Source: APBJJlHBw4Du0mVOwVoJGDGJHdcrU5l/Vl9u7+5yPdmi1AVU8JMbgpeflHw8/nO1o5TCUEQfzCeG2Q== X-Received: by 2002:a5d:538f:0:b0:313:f1c8:a968 with SMTP id d15-20020a5d538f000000b00313f1c8a968mr5102137wrv.2.1688753693994; Fri, 07 Jul 2023 11:14:53 -0700 (PDT) Received: from ?IPV6:2001:8a0:f91d:bc00:1b6e:208c:60cc:dcc? ([2001:8a0:f91d:bc00:1b6e:208c:60cc:dcc]) by smtp.gmail.com with ESMTPSA id e4-20020a5d5004000000b0030fb4b55c13sm4991530wrt.96.2023.07.07.11.14.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Jul 2023 11:14:53 -0700 (PDT) Message-ID: Date: Fri, 7 Jul 2023 19:14:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH 3/5] Rename Python variable in py-inferior.exp Content-Language: en-US To: Tom Tromey , gdb-patches@sourceware.org References: <20230707-py-inf-fixes-30615-v1-0-7792ab559530@adacore.com> <20230707-py-inf-fixes-30615-v1-3-7792ab559530@adacore.com> From: Pedro Alves In-Reply-To: <20230707-py-inf-fixes-30615-v1-3-7792ab559530@adacore.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: On 2023-07-07 16:07, Tom Tromey via Gdb-patches wrote: > py-inferior.exp creates a Python variable named 'str'. This clashes > with the built-in type of the same name and can be confusing when > trying to evaluate Python code when debugging the test case. This > patch renames it. > --- > gdb/testsuite/gdb.python/py-inferior.exp | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp > index a29624f4fd5..41e26878031 100644 > --- a/gdb/testsuite/gdb.python/py-inferior.exp > +++ b/gdb/testsuite/gdb.python/py-inferior.exp > @@ -88,13 +88,13 @@ gdb_continue_to_breakpoint "cont to Break here." ".*Break here\..*" > > gdb_py_test_silent_cmd "python addr = gdb.selected_frame ().read_var ('str')" \ > "read str address" 0 > -gdb_py_test_silent_cmd "python str = gdb.inferiors()\[0\].read_memory (addr, 5); print(str)" \ > +gdb_py_test_silent_cmd "python astr = gdb.inferiors()\[0\].read_memory (addr, 5); print(str)" \ Shouldn't the "print(str)" after the ; be adjusted as well? How can this pass as is? > "read str contents" 1 > gdb_py_test_silent_cmd "python a = bytes('a', 'ascii')" "" 0 > -gdb_py_test_silent_cmd "python str\[1\] = a" "change str" 0 > -gdb_py_test_silent_cmd "python gdb.inferiors()\[0\].write_memory (addr, str)" \ > +gdb_py_test_silent_cmd "python astr\[1\] = a" "change str" 0 > +gdb_py_test_silent_cmd "python gdb.inferiors()\[0\].write_memory (addr, astr)" \ > "write str" 1 > -gdb_test "print (str)" " = \"hallo, testsuite\"" \ > +gdb_test "print str" " = \"hallo, testsuite\"" \ > "ensure str was changed in the inferior" > > # Test memory search. >