Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pWkqz-0007Sg-5z for mharc-grub-devel@gnu.org; Mon, 27 Feb 2023 16:16:13 -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 1pWkqx-0007Qe-9q for grub-devel@gnu.org; Mon, 27 Feb 2023 16:16:11 -0500 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWkqv-0000NL-Cq for grub-devel@gnu.org; Mon, 27 Feb 2023 16:16:10 -0500 Received: by mail-qv1-xf2f.google.com with SMTP id y3so5452496qvn.4 for ; Mon, 27 Feb 2023 13:16:08 -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=BYOzWskD1BmgN3HZnB8PIAjELIZ8TGEhjfb+bxD30gE=; b=nG9Oz2fUUiTD/pfGFShWfOsXVqdFLV72hMJIWOKWB2GArrZ1Mca28WvBTMWC9nNKTO igPAs3o/Dzcxfc96WraK7FIv2hZ7KkDnQGI6W/UAqzbdYUfHn1DAvGtyN8+FGhyQcgRs hrYSIar9V/MKWdjwDmdbqaDira328PyiSXVy+AIprmhj0AdScl62cReiib1vdPff9wOx oPV4i/7X0XCG1bnNkAgyYot9+RuW8lkDC/9JSju08WflYmkKpqpEM7ECowdl6/xxdvBb 0od0hE7HSSIFlfb2Vohdn6xS/CWQX7n9uCfiVcMnCCnMM71Yg87iNN9g7eLxByMIXC08 9SOA== 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=BYOzWskD1BmgN3HZnB8PIAjELIZ8TGEhjfb+bxD30gE=; b=i2X09wvq24RhJ1WC7smbcv1QG2AJ0XO5qrPpfYre4JMlbMBUTHWgO83BOOjoaiIRH1 axeHtYUOoWI9FQfteS8CZfuRkRpHQI2JX5mVm6fQ9zsxrLsOfG8C7hJVCUATaqfwQp4O 4qEaYe/niuE2xL43lv9SEjGBvKgObQFBHfDC7SiXuPtqsbvs8Ii38VVxq0sFWscof3Vj S8CSbrwZE89sZ0QuaRIvj3riGpzuoKWBxel4ZEf6b07YI7L1lWTLjajMlWflG2B0bteV uf2TQ/BO2NtLmpOlO6BIDsUFynl1tJYpLw5egIe7zBmQuN+vD8DYiLcVmLLG/FC/15hq vDFA== X-Gm-Message-State: AO0yUKUcgE2rcndJj4rKW7Pu5qFHm5jZy4jUZXqbQn3I+WEroGRA6d1H Zg487yjG71qnGKpa/byZnGP8SruQZ54lx5rr X-Google-Smtp-Source: AK7set9fAvTqKfNFEs+cJD5uJ1NL3JyQRkOoSy24KRH8RZn2LVUTpjjorQ9hOz6iiGWJi/QpUYOTDQ== X-Received: by 2002:ad4:4ee6:0:b0:56e:a39f:f060 with SMTP id dv6-20020ad44ee6000000b0056ea39ff060mr1954887qvb.19.1677532567946; Mon, 27 Feb 2023 13:16:07 -0800 (PST) Received: from localhost.localdomain ([37.218.244.251]) by smtp.gmail.com with ESMTPSA id n76-20020a37404f000000b0071aacb2c76asm5475080qka.132.2023.02.27.13.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 13:16:07 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Glenn Washburn Subject: [PATCH 3/8] gdb: Only connect to remote target once when first sourced Date: Mon, 27 Feb 2023 15:15:33 -0600 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::f2f; envelope-from=development@efficientek.com; helo=mail-qv1-xf2f.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: Mon, 27 Feb 2023 21:16:11 -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 620d1def72d0..4ca939f69a89 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