From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1p63Jh-0004CB-Te for mharc-grub-devel@gnu.org; Fri, 16 Dec 2022 00:31:36 -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 1p63JE-00041M-JH for grub-devel@gnu.org; Fri, 16 Dec 2022 00:31:04 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p63J9-00049M-V0 for grub-devel@gnu.org; Fri, 16 Dec 2022 00:30:58 -0500 Received: by mail-pl1-x62b.google.com with SMTP id t2so1289299ply.2 for ; Thu, 15 Dec 2022 21:30:53 -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=s4Y0bYm2MNjcPeMScjGaCS/9b08zXGpMh4aYdBno3YI=; b=brqqKoVc+ylCFZ0wgjle3wqHReZfU5678gBIpvXvMY/FqBuZE+6yJDeXKTRRglfAPu 8X+3Ic0g5ZWXDXIe5HGWhvsdmluv3b//IQUyHdk4oU8P6JzPfz8+BIFqR3oRKmuia8eE 0EtoHpSNhvSDaRa+m1A5vy8PPun12l7Cyjr9CZ8zt+hb6gVNbv0ZgjbTUn0UaDe3/1kO l0FnlbfEzOSYHov8B7RAJpmRbMQ2JdJwt9KoogZxK075T8KF5DTphx/XF/mcE7Cb501N LX4WtKBbyNiaC+ygNaq6nI4FYhNn/I434TsjYYGbXy26Vvu984aukCIndkEaxJyKjjUS 80QQ== 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=s4Y0bYm2MNjcPeMScjGaCS/9b08zXGpMh4aYdBno3YI=; b=fw330GT6rN8x49IBChd/CJBR6PbPo1Kx8YScASyfM+atyMtZDGaP5w5SWReU4nneNz UxJBNStzEWWqsBF0KAAtW9ULE5xYI/nVqqpCbdw/x3/MKJbshaVttyDuT2prQte2hMVT OBqSQzz1JkAFnPVLr/SFm2dsi/c6fyYjWjJDTGXS+6xO5BMq+8UwtcyktwfmgAYghZWS ohdXhFz6znD2qBkVbl8T1EQS0q65IODOiFzHb1j0ePOmDlluLEyuqxxZCZT1mQYcxAjW XdLCgutoscJlIGwai4aHSxDvneI6h6JPG7ahwluhE8zfhwe3alQumeiYIwy8T1+fzCv1 lk3A== X-Gm-Message-State: ANoB5pmRlrJGx4/MC7tBRUuSYGOHjME34PTgjT2dSk7DKgDqPPPC5Ivt bjRmD2w6beah+LcS+PVOhsftzssHW6w43jLv X-Google-Smtp-Source: AA0mqf4c4ETYdRa78o+kkdxgZEVeQGr7Wvruz46lM5c2rhEuzfbxCNK/SckDk8pZ+m1ZdFlViIkW1w== X-Received: by 2002:a05:6a21:2d07:b0:9e:9685:f15e with SMTP id tw7-20020a056a212d0700b0009e9685f15emr38696087pzb.0.1671168652304; Thu, 15 Dec 2022 21:30:52 -0800 (PST) Received: from crass-HP-ZBook-15-G2.lan ([37.218.244.251]) by smtp.gmail.com with ESMTPSA id u4-20020a17090341c400b00187033cac81sm577714ple.145.2022.12.15.21.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 21:30:51 -0800 (PST) From: Glenn Washburn To: "grub-devel @ gnu . org" , Daniel Kiper Cc: Glenn Washburn Subject: [PATCH v4 10/15] gdb: Only connect to remote target once when first sourced Date: Thu, 15 Dec 2022 23:29:33 -0600 Message-Id: <20221216052938.224564-11-development@efficientek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221216052938.224564-1-development@efficientek.com> References: <20221216052938.224564-1-development@efficientek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=development@efficientek.com; helo=mail-pl1-x62b.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: Fri, 16 Dec 2022 05:31:09 -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 1a3dcbd57d..a0c6b1ae07 100644 --- a/grub-core/gdb_grub.in +++ b/grub-core/gdb_grub.in @@ -121,12 +121,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