public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@yahoo.de>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH v2] Fix raw-frame-arguments in combination with frame-filters
Date: Mon, 17 May 2021 10:54:08 +0000 (UTC)	[thread overview]
Message-ID: <981574547.1965792.1621248848432@mail.yahoo.com> (raw)
In-Reply-To: <20210517094824.GM3067949@embecosm.com>

 Am Montag, 17. Mai 2021, 11:48:27 MESZ hat Andrew Burgess <andrew.burgess@embecosm.com> Folgendes geschrieben:

> * Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> [2021-01-31 14:46:11 +0100]:
>
> > Currently, if frame-filters are active, raw-values is used instead of
> > raw-frame-arguments to decide if a pretty-printer should be invoked for
> > frame arguments in a backtrace.
> >
> > In this example, "super struct" is the output of the pretty-printer:
> >
> >    (gdb) disable frame-filter global BasicFrameFilter
> >    (gdb) bt
> >    #0  foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47
> >    #1  0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57
> >
> > If no frame-filter is active, then the raw-values print option does not
> > affect the backtrace output:
> >
> >    (gdb) set print raw-values on
> >    (gdb) bt
> >    #0  foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47
> >    #1  0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57
> >    (gdb) set print raw-values off
> >
> > Instead, the raw-frame-arguments option disables the pretty-printer in the
> > backtrace:
> >
> >    (gdb) bt -raw-frame-arguments on
> >    #0  foo (x=42, ss=...) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47
> >    #1  0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57
> >
> > But if a frame-filter is active, the same rules don't apply.
> > The option raw-frame-arguments is ignored, but raw-values decides if the
> > pretty-printer is used:
> >
> >    (gdb) enable frame-filter global BasicFrameFilter
> >    (gdb) bt
> >    #0  foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47
> >    #1  0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57
> >    (gdb) set print raw-values on
> >    (gdb) bt
> >    #0  foo (x=42, ss=...) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47
> >    #1  0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57
> >    (gdb) set print raw-values off
> >    (gdb) bt -raw-frame-arguments on
> >    #0  foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47
> >    #1  0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57
> >
> > So this adds the PRINT_RAW_FRAME_ARGUMENTS flag to frame_filter_flag, which
> > is then used in the frame-filter to override the raw flag in enumerate_args.
> >
> > Then the output is the same if a frame-filter is active, the pretty-printer
> > for backtraces is only disabled with the raw-frame-arguments option:
> >
> >    (gdb) enable frame-filter global BasicFrameFilter
> >    (gdb) bt
> >    #0  foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47
> >    #1  0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57
> >    (gdb) set print raw-values on
> >    (gdb) bt
> >    #0  foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47
> >    #1  0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57
> >    (gdb) set print raw-values off
> >    (gdb) bt -raw-frame-arguments on
> >    #0  foo (x=42, ss=...) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47
> >    #1  0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57
>
> Thanks for working on improving this behaviour.
>
> I think that there's something weird going on with the MI behaviour.
>
> I ran the py-frame-args.c test program, stopped at line 47, then I see
> this:
>
>   (gdb) set print raw-frame-arguments off
>   (gdb) set print raw-values off
>   (gdb) interpreter-exec mi "-stack-list-variables 1"
>   ^done,variables=[{name="x",arg="1",value="42"},{name="ss",arg="1",value="super struct = {\n  a = m=<1>,\n  b = m=<2>\n}"}]
>   (gdb) interpreter-exec mi "-stack-list-arguments 1"
>   ^done,stack-args=[frame={level="0",args=[{name="x",value="42"},{name="ss",value="super struct = {\n  a = m=<1>,\n  b = m=<2>\n}"}]},frame={level="1",args=[]}]
>
>   (gdb) set print raw-frame-arguments on
>   (gdb) interpreter-exec mi "-stack-list-arguments 1"
>   ^done,stack-args=[frame={level="0",args=[{name="x",value="42"},{name="ss",value="super struct = {\n  a = m=<1>,\n  b = m=<2>\n}"}]},frame={level="1",args=[]}]
>   (gdb) interpreter-exec mi "-stack-list-variables 1"
>   ^done,variables=[{name="x",arg="1",value="42"},{name="ss",arg="1",value="super struct = {\n  a = m=<1>,\n  b = m=<2>\n}"}]
>
>   (gdb) set print raw-values on
>   (gdb) interpreter-exec mi "-stack-list-arguments 1"
>   ^done,stack-args=[frame={level="0",args=[{name="x",value="42"},{name="ss",value="super struct = {\n  a = m=<1>,\n  b = m=<2>\n}"}]},frame={level="1",args=[]}]
>   (gdb) interpreter-exec mi "-stack-list-variables 1"
>   ^done,variables=[{name="x",arg="1",value="42"},{name="ss",arg="1",value="{\n  a = {\n    m = 1\n  },\n  b = {\n    m = 2\n  }\n}"}]
>   (gdb)
>
> The summary is:
>
>   - when just doing '-stack-list-arguments' neither 'set print
>     raw-values' or 'set print raw-frame-arguments' seem to effect what
>     is printed, and
>
>   - when doing '-stack-list-variables', 'set print raw-values' seems
>     to effect how arguments are printed, but 'set print
>     raw-frame-arguments' does not.
>
> I guess I would expect 'set print raw-frame-arguments' to be the
> controlling option in both these cases.

I'm not completely sure now, is that something this patch breaks?
Or do you mean this should be fixed as well, since it's a very similar problem?


Hannes

  reply	other threads:[~2021-05-17 10:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210131134611.3255-1-ssbssa.ref@yahoo.de>
2021-01-31 13:46 ` Hannes Domani
2021-02-14 15:51   ` [PING] " Hannes Domani
2021-05-17  9:48   ` Andrew Burgess
2021-05-17 10:54     ` Hannes Domani [this message]
2021-05-27 18:31       ` Hannes Domani
2021-06-02 13:16       ` Andrew Burgess
2021-06-04 14:03         ` Hannes Domani

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=981574547.1965792.1621248848432@mail.yahoo.com \
    --to=ssbssa@yahoo.de \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).