From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57502 invoked by alias); 21 Nov 2018 17:12:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 57120 invoked by uid 89); 21 Nov 2018 17:12:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Nov 2018 17:12:14 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC0CF308FF22; Wed, 21 Nov 2018 17:12:13 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8317413F; Wed, 21 Nov 2018 17:12:12 +0000 (UTC) Subject: Re: [PATCH][PR python/23714] Make command-repeat work after gdb.execute To: =?UTF-8?B?QmVubm8gRsO8bmZzdMO8Y2s=?= , gdb-patches@sourceware.org References: From: Pedro Alves Message-ID: <29c87540-97ec-dd52-5882-351fc12d7b57@redhat.com> Date: Wed, 21 Nov 2018 17:12:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2018-11/txt/msg00357.txt.bz2 Hi, Thanks for the patch. On 11/21/2018 02:48 PM, Benno Fünfstück wrote: > gdb/testuite/ChangeLog: > > PR python/#23714 > * gdb.python/python.exp: Test gdb.execute("show commands"). Copy&paste ChangeLog entry detected. :-) Fixed that and merged. Thanks much for the fix again, and bonus points for adding a test. > +gdb_test " " "23" "test that gdb.execute does not affect repeat history" I dropped the "test that" bit since all tests test something. Here's what I merged. >From 1c97054b87495b008c6028d697deff61c9fb0b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benno=20F=C3=BCnfst=C3=BCck?= Date: Wed, 21 Nov 2018 17:06:05 +0000 Subject: [PATCH] Make command-repeat work after gdb.execute Since commit 56bcdbea2bed ("Let gdb.execute handle multi-line commands") command repetition after using the `gdb.execute` Python function fails (the previous command is not repeated anymore). This happens because read_command_lines_1 sets dont_repeat, but the call to prevent_dont_repeat in execute_gdb_command is later. The fix is to move the call to prevent_dont_repeat to the beginning of the function. Tested on my laptop (ArchLinux-x86_64). gdb/ChangeLog: PR python/23714 * gdb/python/python.c (execute_gdb_command): Call prevent_dont_repeat earlier to avoid affecting dont_repeat. gdb/testuite/ChangeLog: PR python/23714 * gdb.python/python.exp: Test command repetition after gdb.execute. --- gdb/ChangeLog | 6 ++++++ gdb/testsuite/ChangeLog | 6 ++++++ gdb/python/python.c | 3 ++- gdb/testsuite/gdb.python/python.exp | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1630bd87a0..d562a4b5df 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2018-11-21 Benno Fünfstück + + PR python/23714 + * gdb/python/python.c (execute_gdb_command): Call + prevent_dont_repeat earlier to avoid affecting dont_repeat. + 2018-11-21 Andrew Burgess * Makefile.in (ALL_TARGET_OBS): Add arch/riscv.o. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 093603a89e..06a1a06719 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-11-21 Benno Fünfstück + + PR python/23714 + * gdb.python/python.exp: Test command repetition after + gdb.execute. + 2018-11-20 Andrew Burgess * gdb.opt/inline-break.exp: Add test that info breakpoint output diff --git a/gdb/python/python.c b/gdb/python/python.c index a37ed10bcf..d6453e786c 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -583,6 +583,8 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) std::string to_string_res; + scoped_restore preventer = prevent_dont_repeat (); + TRY { struct interp *interp; @@ -612,7 +614,6 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) interp = interp_lookup (current_ui, "console"); current_uiout = interp->interp_ui_out (); - scoped_restore preventer = prevent_dont_repeat (); if (to_string) to_string_res = execute_control_commands_to_string (lines.get (), from_tty); diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 0723507af3..60423d2fb7 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -121,6 +121,7 @@ gdb_test "python print (x)" "23" gdb_test "python gdb.execute('echo 2\\necho 3\\\\n\\n')" "23" \ "multi-line execute" +gdb_test " " "23" "gdb.execute does not affect repeat history" # Test post_event. gdb_py_test_multiple "post event insertion" \ -- 2.14.4