From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pFMWe-0004i2-Am for mharc-grub-devel@gnu.org; Tue, 10 Jan 2023 16:51:20 -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 1pFMWc-0004hn-SJ for grub-devel@gnu.org; Tue, 10 Jan 2023 16:51:18 -0500 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFMWb-0002NO-EF for grub-devel@gnu.org; Tue, 10 Jan 2023 16:51:18 -0500 Received: by mail-pj1-x1031.google.com with SMTP id cp9-20020a17090afb8900b00226a934e0e5so2158380pjb.1 for ; Tue, 10 Jan 2023 13:51:17 -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=rJXEm78JAZq6Uq5bELDZFZNUd2k1TQ1/VB5JFOqzDPDUd7NC65SFufMqfeguLntTOT TTdZsYNh40cSnflFsuplQwpivJmjs1JFIdwz74fl1J355qAVe+tB9gqAuEPVSGf9GwwA 96pSOJ7it67q0ZqmkdsTexoylRBHOlGiu3B+bCrlitgKl2rFE5Iw9qsnPIiHdOOJ5Phx 5Sd9F6mcLdY+X7T1IVTvUOxzWyvl6enX9pv2a7GYIFTSFX3/loGRVswPf31yy+gzYHNT umKLLHjnoqV/f8Hgpjd0qgeEC4t3L0SrEhIDgKPdgAUETKfvAaG2ozEQLMWol3+ClMW6 synw== 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=NvluNsjyLtTvPGbiEsLVXSlde7D5FG80J1fhIPLtLNn5eGLHRMhaul2dQEqIrPpx22 f56Dt8IZXtgRNxl2zK+os3OTm0Xw1N8PyJ8CNIzc9L7JX2eawajmGLbgEoEM0HNtnRxI 6JmqfIi41w5eRx5BmpOPyeMvQ2UDUncMt32ha0h5lGWucyyW0xLLjHNo2JaBK95mq2H8 RwzB2Nj6M6p8nzzM53Dc78C1yKY8nNEx46BF/PSNVsEY6lMou8Y4khCXHMJFmT/9QElm Uig2bCbTdCg5PefSnNAgHUplImmSBrI6OsRQCAs0oxwaTzvymlHOPveFCUMkIRLZK2Vc ESEg== X-Gm-Message-State: AFqh2kpO2G+GusJzlUaLl5W0g1pkSEofw3emwwg5xMAIzYcl1glWmz3V Er/28u2qbvXpIUFsqZRAIFH/AVhcWZri7o6U X-Google-Smtp-Source: AMrXdXuQL+UONqSArrnKdrnaBRa2Dvp7T6h2iMrzlE86cUk30rneajlbjVk+0v5GRXXZvPwQZHearA== X-Received: by 2002:a17:902:f1d2:b0:194:4335:5389 with SMTP id e18-20020a170902f1d200b0019443355389mr2526386plc.35.1673387475758; Tue, 10 Jan 2023 13:51:15 -0800 (PST) Received: from crass-HP-ZBook-15-G2.lan ([199.254.238.56]) by smtp.gmail.com with ESMTPSA id u15-20020a1709026e0f00b00186c3af9644sm7760798plk.273.2023.01.10.13.51.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 13:51:14 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Robbie Harwood , Peter Jones , Glenn Washburn Subject: [PATCH v6 06/14] gdb: Only connect to remote target once when first sourced Date: Tue, 10 Jan 2023 15:50:33 -0600 Message-Id: <20230110215041.1247699-7-development@efficientek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230110215041.1247699-1-development@efficientek.com> References: <20230110215041.1247699-1-development@efficientek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=development@efficientek.com; helo=mail-pj1-x1031.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: Tue, 10 Jan 2023 21:51: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