From patchwork Thu Nov 21 20:35:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 101697 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5B7103857346 for ; Thu, 21 Nov 2024 20:37:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B7103857346 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=aJjdhhoH X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by sourceware.org (Postfix) with ESMTPS id 229C93857C6E for ; Thu, 21 Nov 2024 20:35:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 229C93857C6E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 229C93857C6E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::12c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732221321; cv=none; b=cLpQz9w7QFXMHgGuhxF2Fp0st6j0eZ5MnCBnIbiLIMSs4BkGkQcXTpUXG/7K42Z/osBFyNO8YWojpiS/zmTZllZUs68gyVu/qWT0Sk+M8xo0CFrWTwlA0NyFC2re/5NjP/cW5i9rthmNYftaTbyxDsKT4R83c0bj+MarwcPPRpc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732221321; c=relaxed/simple; bh=7eR8ZUtkb7H0rlz/aMC+CdaEmpXkcKLnY2WDggwegNo=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=a/HYRHn3rl8V29waqkddAX3kbQ1Cl9hoMnId/A3Mznv1xdhJgR8IqJ0OQVjId1voinjNVaUrFdAJq9Uf7LYG6hRIf3MwtZ6IBW5O6dbxqz4vIdsZyRlYlClJ/x9zmSQh3EhYNM9OS39ak4McuxkH5QMKF5sWJQrnXqYtNT9g/5Q= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 229C93857C6E Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-3a75f77d859so5166905ab.3 for ; Thu, 21 Nov 2024 12:35:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1732221320; x=1732826120; darn=sourceware.org; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zV7KrBN36bsLGEUwJqcy3v8tD5bfPb6IRtof8wBLdxQ=; b=aJjdhhoHWf5WFZUBr5+YSX632B1UDFlPsc/3ukgSzxcV/dKsopqNs04kYVBpBhvrks o1DpY7KyQlsobVNXF8nSSya5TTE5V0smAqdozltNa8HRCsVnHo/7LE90MCTQtF4VXiwW b8H/QVFcRFK8PdkV17+Qxm8oYeVUH6AAblJ3wzc4kIlqBR9ejqasC39auMAVwwVONs3S tHn8e2tWfCLwpkY0RHEvKnWRXySJu/YJtoxouzypt0nlYFrukBAznf4ZO3G8ABt2Bqyf u8psqYMv4fT2VpztLPcPsICdK8sLlvkdjatiWgwHEa6dr/n2OM8Jup2MY4tH4LzVmbIH 3AJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732221320; x=1732826120; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zV7KrBN36bsLGEUwJqcy3v8tD5bfPb6IRtof8wBLdxQ=; b=or6UJgINjB93SxqDcoDilvorP5LeVKXI/lQC8GyFerLQT1cFoDe1xAPtV42F793kkw ohCH3nPacqGNygNM+V3bAQBKb/5gWdezdtoa4bdNX5blfP+CrEhDVWQCSPhhVPrSbvYe tnCapcIrWITl67C8GMZ/1PXqbz4GPpf9KevaEblCvK0cxZyHb0sW2FbMaER3oRy4eW6D PtpTFVl+e2ANRI4yxyQLC1eTrKd4ZClCkS9XtQypYD01ZZqNqWWdSL38Xe0OAq8ovISU ilAr94Fd8aVy2dTgctui+r7M9ao8stQRUiavLC/8pHh/grwPpliKcQmqHAp+ShbnlabI e+7g== X-Gm-Message-State: AOJu0YwTJQvN26gmpNCjCEK8zHSHN8BzxIiLa6o1SxNSsRIJspRTwkAJ 3zhHUMM275v6T64zQLB9kuytn03NMapIo9E71PQ1eroUsAaIly6t82D78a53T6yAeBrq0gNYLXI = X-Gm-Gg: ASbGnct4sETrqM0UaCOLwLMebTl2J98gt8Y/ZAoLndvuTH08Gp+ASdL1oVDbh37ibRv yDjkIeg0h2zNqpHMfeqEEDrLM9IZCMBDxjsmh9pEqEeGJVuq3RPWYqNThGScxgzX3x/+s0e8JG7 pgNY7Z/W/lLyUb23+9ygK+WDVHKo3lu/zJK3DMwuixDUuGo0Ldnjx9yWqZ60FIVHRwv4yOsU6Hv 55BXauUEdvSgzXOqZl1GtBVo2GcYgxyFFT/O5iqkbRxs1o7z2TJTP+Zp9dvdfGUP2IctczINMUr aiYTLxaJ6lCBeFpt X-Google-Smtp-Source: AGHT+IEenWP8l6lWdrFSggcRkmbzlE+HtB/cSBzndqnQKUR6/l7xGwuB8IAVjexs5Lz0vsErUZn8mQ== X-Received: by 2002:a05:6602:164c:b0:83a:a9cc:69ff with SMTP id ca18e2360f4ac-83ecdd2ff2cmr29732139f.13.1732221320433; Thu, 21 Nov 2024 12:35:20 -0800 (PST) Received: from localhost.localdomain (97-122-113-155.hlrn.qwest.net. [97.122.113.155]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83ecd43fb95sm9263139f.51.2024.11.21.12.35.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 12:35:19 -0800 (PST) From: Tom Tromey Date: Thu, 21 Nov 2024 13:35:16 -0700 Subject: [PATCH 1/7] Reimplement DAP's stopAtBeginningOfMainSubprogram MIME-Version: 1.0 Message-Id: <20241121-dap-launch-v3-v1-1-c1fa046b3285@adacore.com> References: <20241121-dap-launch-v3-v1-0-c1fa046b3285@adacore.com> In-Reply-To: <20241121-dap-launch-v3-v1-0-c1fa046b3285@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.14.2 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org Right now, stopAtBeginningOfMainSubprogram is implemented "by hand", but then later the launch function uses "starti" to implement stopOnEntry. This patch unifies this code and rewrites it to use "start" when appropriate. --- gdb/python/lib/gdb/dap/launch.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gdb/python/lib/gdb/dap/launch.py b/gdb/python/lib/gdb/dap/launch.py index 65444bf976a03ffe6d8ff0d927dd66adf63256d1..6444c8b7b6741c4847a6c12df78685afca37847a 100644 --- a/gdb/python/lib/gdb/dap/launch.py +++ b/gdb/python/lib/gdb/dap/launch.py @@ -53,17 +53,19 @@ def launch( if program is not None: file_command(program) inf = gdb.selected_inferior() - if stopAtBeginningOfMainSubprogram: - main = inf.main_name - if main is not None: - exec_and_log("tbreak " + main) inf.arguments = args if env is not None: inf.clear_env() for name, value in env.items(): inf.set_env(name, value) expect_process("process") - exec_and_expect_stop("starti" if stopOnEntry else "run") + if stopAtBeginningOfMainSubprogram: + cmd = "start" + elif stopOnEntry: + cmd = "starti" + else: + cmd = "run" + exec_and_expect_stop(cmd) @request("attach")