From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1p8w1H-0002pe-Gh for mharc-grub-devel@gnu.org; Fri, 23 Dec 2022 23:20:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p8w17-0002mk-Ns for grub-devel@gnu.org; Fri, 23 Dec 2022 23:20:19 -0500 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p8w16-0000XN-4Z for grub-devel@gnu.org; Fri, 23 Dec 2022 23:20:13 -0500 Received: by mail-pf1-x42d.google.com with SMTP id 65so4386339pfx.9 for ; Fri, 23 Dec 2022 20:20:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gWKzEmP82kco+2J9Avp5oae5+7ypEiDIN0N9Z4P/Oao=; b=wXXcjXxTO1LqLuflYkCEXXOHSHiYtnA19nFv8KSCHs0ibPIk9UIM5wxJ8SeZPMksSp MujIjhF8vhJe0Dn2NkBXDCZ/aUYm+wrWLsTpzlBNPCQ/J+1fpdhYmZQIoP4pQ+aAOHLX CbdVd/yp+cSaqGNkxYOFHj0zq9UBhs73rDL9R6pTAOqOZE1MMboSfumuvdb1hImymLoy dBh3GxYHfq1e6RC4kZm0AkyBlSWyG0M8RTwld6V9312ZVIspER3DblTuBqD0xYizvOuY DJXlMYz1hhJVTHxpkBkqtqrEKgwiAaCqiVDol/5PgKR0C6mFyFNhoNmWouxG5AMKSVq1 DsTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gWKzEmP82kco+2J9Avp5oae5+7ypEiDIN0N9Z4P/Oao=; b=SBueNYqbKpHxGvx0dXnrWs0s8kjbmkVSFjBL7GxiMFzwWfnX7WDlzfg9DLqBO1zovZ PiEztvFk3UE3njh1KiNi/XIaYzctn42I8197ERiVzGw+ziAi14pmcZpHtVrpQT+Wf8Iw fo10YprXdOuAFJdEuayxmH+HgxhOfcxzA0O1MfQyQF2FK8J7DNK2LaJ4guIxm3fF3Y1z PAr7cx3SyYJs/RqpB2ugVffaw/oV2HiCtcWpDT+1AOVVI7RTBR6EDobr58CeEsV6vigg njzK745XwaJdmphfCvNskBMUYin8vjCLpeYvOxOOHsNiSd+h+zL8yO1pBp4XTTrDFcDJ tuFA== X-Gm-Message-State: AFqh2ko0Jn0EITL1H+AD/vhCsy0EABMls4BFr1Qnacv2WpXBCZr9Our/ LkEq7YI04EdUXTeUUEKuLT64cO/oINP8xrar X-Google-Smtp-Source: AMrXdXung0gXnaMpTFW4p5gfsNrr/uD5V04jBkD+spkmGdQggTz1QxRK03Y9hF0/1Wlyu5N94nDO3Q== X-Received: by 2002:a05:6a00:1c9f:b0:576:84ae:59a with SMTP id y31-20020a056a001c9f00b0057684ae059amr12955975pfw.3.1671855610331; Fri, 23 Dec 2022 20:20:10 -0800 (PST) Received: from localhost.localdomain ([204.13.164.84]) by smtp.gmail.com with ESMTPSA id x19-20020aa79413000000b005743b5ebd7csm3324185pfo.92.2022.12.23.20.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Dec 2022 20:20:09 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Robbie Harwood , Peter Jones , Glenn Washburn Subject: [PATCH v5 06/14] gdb: Only connect to remote target once when first sourced Date: Fri, 23 Dec 2022 22:19:27 -0600 Message-Id: <20221224041935.787292-7-development@efficientek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221224041935.787292-1-development@efficientek.com> References: <20221224041935.787292-1-development@efficientek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=development@efficientek.com; helo=mail-pf1-x42d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2022 04:20:19 -0000 The gdb_grub script was originally meant to be run once when GDB first starts up via the -x argument. So it runs commands unconditionally assuming that the script has not been run before. Its nice to be able to source the script again when developing the script to modify/add commands. So only run the commands not defined in user-defined commands, if a variable $runonce has already been set and when those commands have been run to set $runonce. Signed-off-by: Glenn Washburn --- grub-core/gdb_grub.in | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/grub-core/gdb_grub.in b/grub-core/gdb_grub.in index 620d1def72..4ca939f69a 100644 --- a/grub-core/gdb_grub.in +++ b/grub-core/gdb_grub.in @@ -94,12 +94,15 @@ set confirm off set $platform_efi = $_streq("@platform@", "efi") -if $platform_efi - # Only load the executable file, not the symbols - exec-file kernel.exec -else - file kernel.exec - runtime_load_module -end +if ! $runonce + if $platform_efi + # Only load the executable file, not the symbols + exec-file kernel.exec + else + file kernel.exec + runtime_load_module + end -target remote :1234 + target remote :1234 + set $runonce = 1 +end -- 2.34.1