From patchwork Sat Dec 28 13:30:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 37113 Received: (qmail 105679 invoked by alias); 28 Dec 2019 13:30:58 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 105597 invoked by uid 89); 28 Dec 2019 13:30:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: EUR01-DB5-obe.outbound.protection.outlook.com Received: from mail-oln040092064026.outbound.protection.outlook.com (HELO EUR01-DB5-obe.outbound.protection.outlook.com) (40.92.64.26) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 28 Dec 2019 13:30:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YvQqKZMkwDrAIIB3M00mPE+YR1q3AyJ+TrOzBI2U1FFORkqZkndlnftDmghPgO/hJSfMoXD7IYYxM0C4zvvxHvCKK1VD+4Cl7f3HQVRYJ1cstWEiLKoZcAPWsyT1KqK4MiKA36tOqLZpIlijIev14xNERlzALj9Je7kbjL7emmIt+LbSIVR5aSQMEhOv2NfHcTSs3R7OZ+l7GTTbctOPU3J6t6PNKo+WvPOJBljPAv+8SBi7ZbtWf+UkwqfBX2iiJemQmle8eXe0Ue6aaqGpiAaYLLZfRmF341rmkXUpeS+aZuxTpb5Fj8sAkECsphvapq/E/uAPcDtoGyUhboLAwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F2fHSJOJxBmpr7KFRXoFIhVls8j4mjh/MWt6sHgree0=; b=eEnzHMqnFZqbzG0QK3IOwy2MmJ+uWLxzFPecrqTRfKGt+Fq9QB1M+2818TZgj2MFq33BvR58uP7mgB5aVNkdt0Q7N0XuNmI63AgnRhSNWa9WJeSaoib8p2VhNH17B0cB/XgvuVlvalhYRPgSTgyocdgZ2v0Wx6R4k3Tc+WwsVLhMHr8xkrJVeSmbQmSHzMfbDoZD8t4lTNcK3MmjAA10cKJ4Z7ZRNGkd2EWofdWYab4eEEJnORdLP9emi55+gDtcsHyRSFv07Husvg+d4zIg25qP4d7Sjw6SBrS6FtrHUs05PeQauk4Ch7eBIW3NwxKQHwZ+6Nyg8rVMDSkm/T3pGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DB5EUR01FT033.eop-EUR01.prod.protection.outlook.com (10.152.4.58) by DB5EUR01HT065.eop-EUR01.prod.protection.outlook.com (10.152.5.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.11; Sat, 28 Dec 2019 13:30:44 +0000 Received: from AM0PR08MB3714.eurprd08.prod.outlook.com (10.152.4.51) by DB5EUR01FT033.mail.protection.outlook.com (10.152.4.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.11 via Frontend Transport; Sat, 28 Dec 2019 13:30:44 +0000 Received: from AM0PR08MB3714.eurprd08.prod.outlook.com ([fe80::8dd1:fb18:6271:f769]) by AM0PR08MB3714.eurprd08.prod.outlook.com ([fe80::8dd1:fb18:6271:f769%7]) with mapi id 15.20.2581.007; Sat, 28 Dec 2019 13:30:44 +0000 Received: from [192.168.1.101] (146.60.252.106) by FRYP281CA0017.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.11 via Frontend Transport; Sat, 28 Dec 2019 13:30:44 +0000 From: Bernd Edlinger To: "gdb-patches@sourceware.org" , Simon Marchi Subject: [PATCH] Make skip without argument skip the current inline function Date: Sat, 28 Dec 2019 13:30:44 +0000 Message-ID: x-microsoft-original-message-id: <62826515-43ae-6c5f-90d9-6ef217e4fa07@hotmail.de> x-ms-exchange-transport-forked: True Content-ID: <9A05FBC0135B4940B90B83573A5B0FDE@eurprd08.prod.outlook.com> MIME-Version: 1.0 Hi, this would in a way complete the skip inlined function feature. That is make the skip command, when used without arguments, figure out if there is an inlined function currently executing, and skip that in future. Well, not sure if that is worth a mention in the NEWS, maybe when the remaining patch 'Fix an issue with the gdb step-over aka. "n" command' which prevents accidentally stepping over a possibly skipped inline function accidentally to step back into the inline function again. gdb: 2019-12-28 Bernd Edlinger * skip.c (skip_function_command): Make skip w/o arguments use the name of the inlined function if pc is inside any inlined function. gdb/testsuite: 2019-12-28 Bernd Edlinger * gdb.base/skip-inline.exp: Extend test. Thanks Bernd. From 75d3db50829ceac30fd92124b2df9ea730bf71de Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Wed, 25 Dec 2019 16:35:32 +0100 Subject: [PATCH] Make skip without argument skip the current inline function Previously always the outermost function block was used, but since skip is now able to skip over inline functions it is more natural to skip the inline function that the program is currently executing. --- gdb/skip.c | 17 +++++++---------- gdb/testsuite/gdb.base/skip-inline.exp | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/gdb/skip.c b/gdb/skip.c index a869aaa..9f2e5c6 100644 --- a/gdb/skip.c +++ b/gdb/skip.c @@ -209,18 +209,15 @@ skip_function_command (const char *arg, int from_tty) /* Default to the current function if no argument is given. */ if (arg == NULL) { + frame_info *fi = get_selected_frame (_("No default function now.")); + struct symbol *sym = get_frame_function (fi); const char *name = NULL; - CORE_ADDR pc; - if (!last_displayed_sal_is_valid ()) - error (_("No default function now.")); - - pc = get_last_displayed_addr (); - if (!find_pc_partial_function (pc, &name, NULL, NULL)) - { - error (_("No function found containing current program point %s."), - paddress (get_current_arch (), pc)); - } + if (sym != NULL) + name = sym->print_name (); + else + error (_("No function found containing current program point %s."), + paddress (get_current_arch (), get_frame_pc (fi))); skip_function (name); return; } diff --git a/gdb/testsuite/gdb.base/skip-inline.exp b/gdb/testsuite/gdb.base/skip-inline.exp index 4ab9ecf..c1a0556 100644 --- a/gdb/testsuite/gdb.base/skip-inline.exp +++ b/gdb/testsuite/gdb.base/skip-inline.exp @@ -76,3 +76,17 @@ with_test_prefix "triple step" { gdb_test "step 3" ".*" "step over baz, again" gdb_test "bt" "\\s*\\#0\\s+main.*" "again back to main" } + +if ![runto_main] { + fail "can't run to main" + return +} + +gdb_test "skip delete" ".*" "skip delete" + +with_test_prefix "skip current frame" { + gdb_test "bt" "\\s*\\#0\\s+main.*" "in the main" + gdb_test "step" ".*" "step into foo" + gdb_test "bt" "\\s*\\#0\\s+foo.*" "in the foo" + gdb_test "skip" "Function foo will be skipped when stepping\." "skip" +}