From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99943 invoked by alias); 8 Oct 2017 14:18:55 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 99931 invoked by uid 89); 8 Oct 2017 14:18:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_50,GIT_PATCH_2,KAM_LAZY_DOMAIN_SECURITY,MIME_BASE64_BLANKS,MSGID_FROM_MTA_HEADER,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*F:D*edu.cn, D*edu.cn, H*r:qq.com, H*RU:qq.com X-HELO: smtpbgbr2.qq.com Received: from smtpbgbr2.qq.com (HELO smtpbgbr2.qq.com) (54.207.22.56) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Oct 2017 14:18:49 +0000 X-QQ-GoodBg: 2 X-QQ-SSF: 00400000000000F0 X-QQ-FEAT: 92FxZ2TPvnfl6RYxKb6bpRiZGa7vg4GbKFXC59nMzTEHbBjgwHFzd3qUs9whn UZaKYXQVtBj1g3vxCyzMsgCpR5ikPdsfTgnUZ7dJuRWcieOSAt8IehM1rG3EO6htP3SVtiC w0NdwQbdBv2PcU/jVxt9ghQWvWz36yrnoivDgyB4eS3WvOeEKcXYIm+HWvCTVQlNMsQjCHd syTmlic1V1q6ewW2DiuvoNEA4SFXNFIXg0PzJKM420FmOZfGUZe1OMZ2bOjuqe1s7f9piZj epYqH6EwopsLw0 X-QQ-BUSINESS-ORIGIN: 2 X-QQ-STYLE: X-QQ-mid: bizmailsvip90t1507472322t6021 From: "=?utf-8?B?5byg6Zuo5aeXKFpIQU5HwqBZdXNoYW4pLTExMzEwMzgw?=" To: "=?utf-8?B?SmFuIEtyYXRvY2h2aWw=?=" Cc: "=?utf-8?B?Z2Ri?=" Subject: Re: Question on process record feature Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Date: Sun, 08 Oct 2017 14:18:00 -0000 Message-ID: X-QQ-MIME: TCMime 1.0 by Tencent X-QQ-Mailer: QQMail 2.x References: <20171008092335.GA13127@host1.jankratochvil.net> In-Reply-To: <20171008092335.GA13127@host1.jankratochvil.net> X-QQ-ReplyHash: 1893729336 X-QQ-SENDSIZE: 520 Received: from qq.com (unknown [10.121.126.11]) by smtp.qq.com (ESMTP) with SMTP id ; Sun, 08 Oct 2017 22:18:43 +0800 (CST) Feedback-ID: bizmailsvip:mail.sustc.edu.cn:qybgforeign:qybgforeign2 X-QQ-Bgrelay: 1 X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00021.txt.bz2 SGkgSmFuLA0KDQpUaGFuayB5b3Ugc28gbXVjaCwgdGhlIHdvcmthcm91bmQg aGVscHMgd2l0aCBteSBpc3N1ZS4NCiANCll1c2hhbiANCiANCg0KLS0tLS0t LS0tLS0tLS0tLS0tIE9yaWdpbmFsIC0tLS0tLS0tLS0tLS0tLS0tLQ0KRnJv bTogICJKYW4gS3JhdG9jaHZpbCI8amFuLmtyYXRvY2h2aWxAcmVkaGF0LmNv bT47DQpEYXRlOiAgU3VuLCBPY3QgOCwgMjAxNyAwNToyMyBQTQ0KVG86ICAi 5byg6Zuo5aeXKFpIQU5HIFl1c2hhbiktMTEzMTAzODAiPHpoYW5neXMzQG1h aWwuc3VzdGMuZWR1LmNuPjsNCkNjOiAgImdkYiI8Z2RiQHNvdXJjZXdhcmUu b3JnPjsNClN1YmplY3Q6ICBSZTogUXVlc3Rpb24gb24gcHJvY2VzcyByZWNv cmQgZmVhdHVyZQ0KIA0KT24gU3VuLCAwOCBPY3QgMjAxNyAxMTowMDo0MyAr MDIwMCwg5byg6Zuo5aeXKFpIQU5HIFl1c2hhbiktMTEzMTAzODAgd3JvdGU6 DQo+IEJ1dCBhY3R1YWxseSB3aGF0IGhhcHBlbnMgdG8gbWUgaXMgdGhlIHBy b2dyYW0gc3RvcHMgYWZ0ZXIgdGhlIGZpcnN0DQo+ICJjb250aW51ZSIgY29t bWFuZCwNCg0KRnJvbSB0aGUgYXR0YWNoZWQgc2NyZWVuc2hvdCBpdCBpczoN CmkzODYgcmVjb3JkOiBNaXNzaW5nIEFWWA0KaHR0cHM6Ly9zb3VyY2V3YXJl Lm9yZy9idWd6aWxsYS9zaG93X2J1Zy5jZ2k/aWQ9MTczNDYNCg0KU29tZSB3 b3JrYXJvdW5kIGlzIHByb3ZpZGVkIGluIGEgQnVnIHJlZmVyZW5jZWQgdGhl cmU6DQpodHRwczovL2J1Z3ppbGxhLnJlZGhhdC5jb20vc2hvd19idWcuY2dp P2lkPTE0NTA5OTIjYzUNCg0KDQpKYW4= >From gdb-return-46094-listarch-gdb=sources.redhat.com@sourceware.org Sun Oct 08 17:51:52 2017 Return-Path: Delivered-To: listarch-gdb@sources.redhat.com Received: (qmail 37463 invoked by alias); 8 Oct 2017 17:51:52 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Delivered-To: mailing list gdb@sourceware.org Received: (qmail 37451 invoked by uid 89); 8 Oct 2017 17:51:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=ones, confused, managed X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Oct 2017 17:51:41 +0000 Received: from [10.0.0.11] (cable-192.222.251.162.electronicbox.net [192.222.251.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id ABF3A1E515; Sun, 8 Oct 2017 13:51:39 -0400 (EDT) Subject: Re: Breakpoint commands in MI mode and "backtrace" To: Eli Zaretskii , gdb@sourceware.org References: <8360bqt0im.fsf@gnu.org> From: Simon Marchi Message-ID: <8a3d7153-7486-032f-aabc-6c3453f96459@simark.ca> Date: Sun, 08 Oct 2017 17:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <8360bqt0im.fsf@gnu.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-10/txt/msg00022.txt.bz2 Content-length: 1878 On 2017-10-08 06:08 AM, Eli Zaretskii wrote: > There seems to be a problem with execution of "bt" as part of > breakpoint commands in MI mode: the output of "bt" is not shown. > > What I did was invoke GDB as "gdb -i=mi PROGRAM", then set a > breakpoint or a watchpoint in that program, and defined the following > as its breakpoint commands: > > bt > end > > When the breakpoint triggers, I don't see the backtrace. > > I tried other commands, like "up" and "print SOME-VARIABLE", and they > do seem to be executed and the output shown. So why doesn't that > happen with "backtrace"? Is it a bug or am I missing something? > > (FWIW, I also tried using -break-commands, with a similar result: the > backtrace is not shown when the breakpoint triggers.) > > This problem prevents "bt" from being useful in breakpoint commands > when running with the Emacs GDB front-end, which uses MI. > > Thanks in advance for any pointers. > It is most certainly a bug, I don't see why a command that produces some output should work and not another one. It seems like even though we are executing CLI commands, the current interpreter and uiout are the MI ones. I'm always confused by all these data structures, but I managed to hack it to work with this: diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 0a93e8b54f..bc8e1047c5 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -482,7 +482,10 @@ execute_control_command (struct command_line *cmd) { /* A simple command, execute it and return. */ std::string new_line = insert_user_defined_cmd_args (cmd->line); - execute_command (&new_line[0], 0); + + scoped_restore_interp restorer (INTERP_CONSOLE); + current_interpreter ()->exec (&new_line[0]); + ret = cmd->control_type; break; } Does that work for you? It might not be the right solution, but it's a start. Simon