From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53032 invoked by alias); 10 Jun 2019 12:48:31 -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 52970 invoked by uid 89); 10 Jun 2019 12:48:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=aims, appeals, HTo:U*tom, pc X-HELO: mailsec117.isp.belgacom.be Received: from mailsec117.isp.belgacom.be (HELO mailsec117.isp.belgacom.be) (195.238.20.113) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Jun 2019 12:48:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1560170888; x=1591706888; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=87aHF/I575ImEso3tYz7GXaZDjpaweMH1BZYt6wy3PA=; b=If3Kxz1hHtPCQR2LztErAJHNrcOR7oec/JFs7LZ4nTyLo/Gx4tL2GOf3 kIR7lzTbtHqWRhzMlzWftvXC7vE0XA==; Received: from 161.32-242-81.adsl-dyn.isp.belgacom.be (HELO md) ([81.242.32.161]) by relay.skynet.be with ESMTP/TLS/AES256-GCM-SHA384; 10 Jun 2019 14:48:05 +0200 Message-ID: <1560170884.22517.6.camel@skynet.be> Subject: Re: [RFAv2 1/3] Implement 'set print frame-info|frame-arguments presence'. From: Philippe Waroquiers To: Tom Tromey Cc: gdb-patches@sourceware.org Date: Mon, 10 Jun 2019 12:48:00 -0000 In-Reply-To: <878suhl1hh.fsf@tromey.com> References: <20190511185603.17231-1-philippe.waroquiers@skynet.be> <20190511185603.17231-2-philippe.waroquiers@skynet.be> <878suhl1hh.fsf@tromey.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-06/txt/msg00193.txt.bz2 On Tue, 2019-06-04 at 11:11 -0600, Tom Tromey wrote: > > > > > > "Philippe" == Philippe Waroquiers writes: > > Philippe> New settings allow to better control what frame information is printed. > Philippe> 'set print frame-info' allows to override the default frame information > Philippe> printed when a GDB command prints a frame. > > Thanks for the patch. > > I wanted to mention - in the last series, I noticed that the ChangeLog > entries didn't wind up in the commit messages. I think it is a gdb > standard to do that, so please make sure it happens for future pushes. Sorry, I thought that having the ChangeLog file was sufficient. I will ensure that it is done in the future. > > I realize this is a bit of a pain, but various people have scripts for > automating it, I believe, and so you can pretty much pick one approach > that appeals to you. > > Philippe> + if (args_type == CLI_PRESENCE) > Philippe> + { > Philippe> + if (args_iter != Py_None) > Philippe> + { > Philippe> + if (PyIter_Next (args_iter.get ()) != NULL) > > This causes a memory leak, because PyIter_Next returns a new reference. > You can wrap it in a gdbpy_ref<> to avoid this problem. Fixed. (Note that also for this patch series, I will wait for Pedro to push cli-option to avoid pushing merge conflicts to him). > > Sometimes I think we just use wrapper functions for the Python API that > let us spell out this stuff in the type system. > > Philippe> + /* Note that this print_what default implies that 'bt' and 'bt no-filters' > Philippe> + shows different information, as the default for 'bt no-filters > Philippe> + is LOCATION. */ > Philippe> + enum print_what print_what = LOC_AND_ADDRESS; > > Is this a pre-existing bug? It seems like something we should change, > since my believe is that "no filters" should produce the same output as > the situation where there are actually no filters installed. Yes, it is a pre-existing "bug", but the difference of behaviour is between 'bt' and 'bt no-filters' *when there are some filters*. here is a log with the HEAD: (gdb) bt #0  0x000055555555548e in niam (argc=1, argv=0x7fffffffe0d8) at sleepers.c:194 (gdb) bt no-filters #0  main (argc=1, argv=0x7fffffffe0d8) at sleepers.c:194 (gdb) p $pc $1 = (void (*)()) 0x55555555548e (gdb) frame #0  main (argc=1, argv=0x7fffffffe0d8) at sleepers.c:194 194   sleeper_or_burner(&m); (gdb) info line Line 194 of "sleepers.c" starts at address 0x55555555548e and ends at 0x55555555549d . (gdb)  As you can see, the first 'bt' is applying a filter (the 'Reverse' filter of gdb/testsuite/gdb.python/py-framefilter.py), and shows the address, while the 'bt no-filters' does not show the address. This difference of behaviour will be visible as long as there is one filter active, even if the filter is a 'no effect' filter. This is because backtrace_command_1 calls apply_ext_lang_frame_filter. If this finds at least one active filter, it will print the frame itself by calling py_print_frame. If there are no active filter or with 'bt no-filters', backtrace_command_1 calls 'print_frame_info (..., LOCATION, ...). So, the GDB HEAD has a different default way to print a frame when it is printed by py_print_frame or by stack.c print_frame_info. The 'set print frame-info auto' setting aims at keeping a backward compatible behaviour : in GDB HEAD, different commands have different behaviours, and 'auto' means to let each command decide by itself what to do. If the user chooses a specific value (e.g. 'set print frame-info location'), then with this patch, the python frame filtering will do what the user wants. So, the question is: do we want to change the default output behaviour of python frame filters to be LOCATION ? That is of course a user visible change. Philippe