Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1npeTW-0007UP-C1 for mharc-grub-devel@gnu.org; Fri, 13 May 2022 19:13:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npeTU-0007Q4-Vg for grub-devel@gnu.org; Fri, 13 May 2022 19:13:33 -0400 Received: from mail-vs1-xe33.google.com ([2607:f8b0:4864:20::e33]:47065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npeTT-0007TC-78 for grub-devel@gnu.org; Fri, 13 May 2022 19:13:32 -0400 Received: by mail-vs1-xe33.google.com with SMTP id z144so9845984vsz.13 for ; Fri, 13 May 2022 16:13:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xVEFZNbJQsb0Qsb1w/w8f7alUYWk9OWErf79Yz9Qzgg=; b=fBlwW275y1VFdHLLR/uQTe3ydANlCOhy/TtLTLfT5IYZuY2XmK/eDHREyz3CfLqQ15 X6QY0mE5JKhrsmDoaWMwWbdTHbpo4myEyzUAonamN6Tkvu1I5KwP6x3QXzSn8Alaq+50 yC08c2eOGjYx/GeW5tqRIHpn2c0/e5nAdCy0LK6k99Nqxl8QAGcPGVsnXPu3K6BS25UG Gxu50b9NjriNnK2XI1JrJirhhqjXz/OIZg9QoKEh2DDZhcYGeNIpY2mOb7Y3xDaC+cRX 0c6p88Uh2o1JJUCSFLV0GjLO2B9LpOT+zdagEaqk+0zKMFYbCjVG0qJNCdQD5qfxPiRI 3GQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xVEFZNbJQsb0Qsb1w/w8f7alUYWk9OWErf79Yz9Qzgg=; b=YkdiBeFxF0oPqPxT39ee21BugqRnBihuwHxsiIpQSmEgxAUDC0lCjWSW8Jvsxhf1cT 15YIUKcrDoaf1nPZ5bEJ80nKrGLzUaCX4TvjAiVurNdf1dj6q2+n1AIXslpp4FDRbCE+ Uhlp19NHcYTBPskBMSw6WIfQwl82ZkTolZmPIKNWbW8q8Foo17qXySaUR8nGE+FZMN1K LalKHMOoDvo2u28qxdOPpIQqHkG72aKASDtqdFqemofKW2tjxw24ZzrCssV1V3lJK9CT xKzihqoKwksdC5aBbMpIGZOnpZOm54cKRrvAGoAqLN3HBP9CS0Sv7FUUnKJDspXySNqL n4LQ== X-Gm-Message-State: AOAM5332+AfFQG8VPv2y4/xYfK2pXECYmpeyu337B7ZNoSXaHK/XRTKo a1LfO6ts3Dkk6b/sPGZthSyjid/qv3BdSx42 X-Google-Smtp-Source: ABdhPJyxp7Yu2bqmMzm3ijVhRYxaB4IMNgpsS7mxgfd+Z6/Iud0N/Iu79KIPhTCq+ycHYYadLRt39A== X-Received: by 2002:a67:f689:0:b0:32a:11fd:5f0f with SMTP id n9-20020a67f689000000b0032a11fd5f0fmr3157212vso.21.1652483610050; Fri, 13 May 2022 16:13:30 -0700 (PDT) Received: from localhost.localdomain ([37.218.244.249]) by smtp.gmail.com with ESMTPSA id 129-20020a1f1387000000b0034e6f1fd067sm423865vkt.49.2022.05.13.16.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 16:13:29 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Peter Jones , Robbie Harwood , Glenn Washburn Subject: [PATCH v2 11/15] gdb: Only connect to remote target once when first sourced Date: Fri, 13 May 2022 18:12:44 -0500 Message-Id: <9645210fe5ecf5814b90437ace9853cb290698bf.1652482822.git.development@efficientek.com> 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::e33; envelope-from=development@efficientek.com; helo=mail-vs1-xe33.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, T_SCC_BODY_TEXT_LINE=-0.01 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: Fri, 13 May 2022 23:13:33 -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 a444000ff..f4243bb71 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