Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFAv2 1/3] Implement 'set print frame-info|frame-arguments presence'.
Date: Mon, 10 Jun 2019 12:48:00 -0000	[thread overview]
Message-ID: <1560170884.22517.6.camel@skynet.be> (raw)
In-Reply-To: <878suhl1hh.fsf@tromey.com>

On Tue, 2019-06-04 at 11:11 -0600, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> 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 <main+823>
(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 <main+823> and ends at
0x55555555549d <main+838>.
(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


  reply	other threads:[~2019-06-10 12:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-11 18:56 [RFAv2 0/3] Implement 'set print frame-info|frame-arguments Philippe Waroquiers
2019-05-11 18:56 ` [RFAv2 3/3] Document 'set print frame-info|frame-arguments presence' Philippe Waroquiers
2019-05-11 19:18   ` Eli Zaretskii
2019-05-11 18:56 ` [RFAv2 2/3] Test " Philippe Waroquiers
2019-06-04 17:15   ` Tom Tromey
2019-05-11 18:56 ` [RFAv2 1/3] Implement " Philippe Waroquiers
2019-06-04 17:15   ` Tom Tromey
2019-06-10 12:48     ` Philippe Waroquiers [this message]
2019-06-10 20:10       ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1560170884.22517.6.camel@skynet.be \
    --to=philippe.waroquiers@skynet.be \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox