From patchwork Wed May 24 16:37:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 69980 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 BA0943888C54 for ; Wed, 24 May 2023 16:40:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA0943888C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684946433; bh=q/cf3//S/tYc6CEwgMIqIAKb0bfyjHETvVYzNeBCkCE=; h=Date:Subject:References:In-Reply-To:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=x9RcEUHwXeK1IsK8FPJKwvcF6RR/4RgWPw7vskkgc42QVFtsywzhvwuRjyMltN4hi +Eg321clX1A5jrhv/soaFXFJJDRztEzIAr8121XVKXJ4FRcuR+NXCXqeUjZ9Q2h9tW cg4mjM+cCN+mH/F5DcjLEMThdD0n2qg/Z6ortEcA= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by sourceware.org (Postfix) with ESMTPS id 4766B385772A for ; Wed, 24 May 2023 16:37:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4766B385772A Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-7747f76946bso224539f.1 for ; Wed, 24 May 2023 09:37:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684946250; x=1687538250; 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=q/cf3//S/tYc6CEwgMIqIAKb0bfyjHETvVYzNeBCkCE=; b=ZP7f2xVSi2ScE1Ek9exvmm/vs9JLuISXwJclk8k7mpezUI6L8ou70s41KBHjf72Weq fftrrgw3dZk+2X39YA1XN+T7VQx5c76ATc6TSU9eLwj63M2HnnqAHdCUQlDtMJ8FALKi v6Z1HmgEu/Okny6HLEtMGXKwqD2r9ShcWhJF5WsgAx4xG37qHzHczcy13o91+oHcpy3v C8s4sinCaWPlcjtgeIjoaaMU1vx4ovjBCCCuhGRyBEfwxOoNlodQSbUZrI9z9dQvUJQ9 KZMCM2LXoV4JWfq6CAIUbSCbClrgWy7hHDYpgKZ4LKRo9PUQNUV+WPm4p+cfYlvANvL1 r55w== X-Gm-Message-State: AC+VfDwbZ8j0t+43LQqzkjLZ1ouAM8CUxdQdL3NtwG6uXwajZDMup98X wuV3cIhuBo2vPRMjgXdJBUloB1mqTCikocT5vd0X9w== X-Google-Smtp-Source: ACHHUZ5IHt5HmdDJVjKNV1hlT7qkbS4ocm1zSxBDTWwEceuXG76hdlpEp7a5Wu4vF0DzBzGoOYUywg== X-Received: by 2002:a5e:dc0a:0:b0:76c:8cbe:c8fc with SMTP id b10-20020a5edc0a000000b0076c8cbec8fcmr13912iok.3.1684946250632; Wed, 24 May 2023 09:37:30 -0700 (PDT) Received: from localhost.localdomain (71-211-130-244.hlrn.qwest.net. [71.211.130.244]) by smtp.gmail.com with ESMTPSA id o22-20020a6bcf16000000b0076c81bf2731sm3397266ioa.20.2023.05.24.09.37.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 09:37:30 -0700 (PDT) Date: Wed, 24 May 2023 10:37:02 -0600 Subject: [PATCH 11/25] Implement DAP stepOut request MIME-Version: 1.0 Message-Id: <20230427-ada-catch-exception-v1-11-947caa9905e3@adacore.com> References: <20230427-ada-catch-exception-v1-0-947caa9905e3@adacore.com> In-Reply-To: <20230427-ada-catch-exception-v1-0-947caa9905e3@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-11.8 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, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This implements the DAP "stepOut" request. --- gdb/python/lib/gdb/dap/next.py | 6 ++++++ gdb/testsuite/gdb.dap/basic-dap.c | 10 +++++++++- gdb/testsuite/gdb.dap/basic-dap.exp | 5 +++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gdb/python/lib/gdb/dap/next.py b/gdb/python/lib/gdb/dap/next.py index 636dfce997d..232b1529fe5 100644 --- a/gdb/python/lib/gdb/dap/next.py +++ b/gdb/python/lib/gdb/dap/next.py @@ -44,6 +44,12 @@ def stepIn(*, threadId, granularity="statement", **args): send_gdb(ExecutionInvoker(cmd, StopKinds.STEP)) +@request("stepOut") +def step_out(*, threadId): + _handle_thread_step(threadId) + send_gdb(ExecutionInvoker("finish", StopKinds.STEP)) + + @request("continue") def continue_request(**args): send_gdb(ExecutionInvoker("continue", None)) diff --git a/gdb/testsuite/gdb.dap/basic-dap.c b/gdb/testsuite/gdb.dap/basic-dap.c index a8327141fb0..2570b8b0702 100644 --- a/gdb/testsuite/gdb.dap/basic-dap.c +++ b/gdb/testsuite/gdb.dap/basic-dap.c @@ -35,10 +35,18 @@ address_breakpoint_here () { } -int main () +int +line_breakpoint_here () { do_not_stop_here (); function_breakpoint_here (); address_breakpoint_here (); return 0; /* BREAK */ } + + +int +main () +{ + return line_breakpoint_here (); +} diff --git a/gdb/testsuite/gdb.dap/basic-dap.exp b/gdb/testsuite/gdb.dap/basic-dap.exp index f28239d8268..d4dbdac70ff 100644 --- a/gdb/testsuite/gdb.dap/basic-dap.exp +++ b/gdb/testsuite/gdb.dap/basic-dap.exp @@ -146,6 +146,11 @@ dap_wait_for_event_and_check "stopped at line breakpoint" stopped \ "body reason" breakpoint \ "body hitBreakpointIds" $line_bpno +dap_check_request_and_response "return from function" stepOut \ + {o threadId [i 1]} +dap_wait_for_event_and_check "stopped after return" stopped \ + "body reason" step + set obj [dap_check_request_and_response "evaluate global in main" \ evaluate {o expression [s global_variable]}] dap_match_values "global value in main" [lindex $obj 0] \