From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1p5iNR-0007WJ-SD for mharc-grub-devel@gnu.org; Thu, 15 Dec 2022 02:09:57 -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 1p5iNQ-0007W9-Iv for grub-devel@gnu.org; Thu, 15 Dec 2022 02:09:56 -0500 Received: from mail-qt1-x82d.google.com ([2607:f8b0:4864:20::82d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p5iNP-00084o-8R for grub-devel@gnu.org; Thu, 15 Dec 2022 02:09:56 -0500 Received: by mail-qt1-x82d.google.com with SMTP id a16so4470022qtw.10 for ; Wed, 14 Dec 2022 23:09:54 -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=bkmlK98CwYHXLBDsBJvWF54qQFbVWyeVfmjJBgmkJdY=; b=kjnthMSqS/d3cCUv8NSjqpgUXflmHOuZJ7pvEAAiOEK78BFk7R8qYdsH006hbH8PLp psFzr4lt2o0O4WsrDj2JukLHWsvPlUhAZkFVu8Ev3vrE8+MNzFlK0Rate+r2tFOp+P11 GbnihsPk0UDEt+KHPW7qj7nYj0xjvKvP7OR4h0nOACMZkIPGsK7rAtUrP4KXXugmTlMv khP1RabGcsWR5mX8Q6G4ZenC/ylBpr9xEmwc2s52K0Bl5QQMzZ0sbk8XIWTpYiaYXv3T XVymNQfjfGiIquiuJfAUVe5DxpHe1Q8ZjTOVMG1xbzbLmm8mBNDi61dZujkVrWQTxbbV 9Ehw== 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=bkmlK98CwYHXLBDsBJvWF54qQFbVWyeVfmjJBgmkJdY=; b=WcqZc+/sW8ayki+Bff8xhDskxZ+QQe79wF2mOLe+b13UROFIH45w4tf6IRAg4YC/nN 5ep+eU6uS7JWm0WSg2czUKMXFsuaCGeAh2j13XATrREB9fV54pz0xiV/WzPRpmb34NqJ opbWntdydF5iLUYrgfqnhn8QLsqPpzraYhm9976BKRfY68qcXeVlJLMBddQL/KD3XO9+ 8u4IVRykeUVCXusi3vr1RDZJRGwvwAv3dDr+NiYld8MwgzJx/C2KkX1tGzU7aQpAbdDI MuX1XphdzneIpIJIKJ+fFTtHoLJ2lT+BTrsKom9l+vSNRVbYr3FKQR/O+lVrruvXj9m2 QgaQ== X-Gm-Message-State: ANoB5pm9A9vt0fow8liiQR8EKf/BCtMtCImKDW5R5zRQ9PqLrGJVSNOK PDNyp8CnW8+RE3wEMD7wzCIp1SppXk8eHa3s X-Google-Smtp-Source: AA0mqf74ipC1elFLcrroEBwDF66Y1CfDjtzzeoFQ2uGT3jFf+4dhMNvM8rOJq3HSXRbysupCg3Pl0w== X-Received: by 2002:ac8:568a:0:b0:3a8:16c0:d9c9 with SMTP id h10-20020ac8568a000000b003a816c0d9c9mr20519168qta.7.1671088194072; Wed, 14 Dec 2022 23:09:54 -0800 (PST) Received: from crass-HP-ZBook-15-G2.lan ([37.218.244.251]) by smtp.gmail.com with ESMTPSA id fy16-20020a05622a5a1000b003a7ec97c882sm3125068qtb.6.2022.12.14.23.09.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 23:09:53 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Glenn Washburn Subject: [PATCH v3 11/15] gdb: Only connect to remote target once when first sourced Date: Thu, 15 Dec 2022 01:07:46 -0600 Message-Id: <20221215070750.102591-12-development@efficientek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221215070750.102591-1-development@efficientek.com> References: <20221215070750.102591-1-development@efficientek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::82d; envelope-from=development@efficientek.com; helo=mail-qt1-x82d.google.com X-Spam_score_int: 14 X-Spam_score: 1.4 X-Spam_bar: + X-Spam_report: (1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: Thu, 15 Dec 2022 07:09:56 -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 a444000ff0..f4243bb718 100644 --- a/grub-core/gdb_grub.in +++ b/grub-core/gdb_grub.in @@ -157,12 +157,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