Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Zoran Zaric <Zoran.Zaric@amd.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2] Replace the symbol needs evaluator with a parser
Date: Thu, 12 Nov 2020 13:11:35 -0700	[thread overview]
Message-ID: <87eekycp3c.fsf@tromey.com> (raw)
In-Reply-To: <20201007172613.21868-1-Zoran.Zaric@amd.com> (Zoran Zaric's message of "Wed, 7 Oct 2020 18:26:13 +0100")

>>>>> "Zoran" == Zoran Zaric <Zoran.Zaric@amd.com> writes:

Zoran> The problem here is that faking results of target interactions can yield
Zoran> an incorrect evaluation result.

...

Zoran> This is clearly a wrong result and it causes the debugger to crash.

Zoran> +      /* The DWARF expression might have a bug causing an infinite
Zoran> +	 loop.  In that case, quitting is the only way out.  */
Zoran> +      QUIT;

Can this really occur in this scanner?

For evaluation I can understand it, but this scanner seems to just walk
the bytecode once, so I don't see how it is possible.

For gimli (again) we have a maximum operation count to avoid this kind
of problem.  gdb could do this as well.

Meanwhile, about the linear scan -- it seems to me that nothing in DWARF
requires (1) that the expression not contain embedded garbage, and (2)
that it not be possible to branch to the middle of some other
instruction.  (If there is text along these lines, I'd like to hear
about it; I looked in the past and couldn't find it.)

This is pathological, of course.  But on the other hand, if the
motivation is to avoid crashes, it seems bad to, say, let this function
pass through some bytecode that would then be interpreted a different
way by the actual evaluator.

Personally I'd be fine with rejecting this bad stuff from the evaluator
as well.  But anyway the difficulty is that they have to be in sync, and
aren't.

Another approach would be to record which offsets are branched to; and
to pop from such a list when an unconditional branch is encountered.
This would solve both problems as well.

Tom

  parent reply	other threads:[~2020-11-12 20:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 17:26 Zoran Zaric
2020-10-21 20:35 ` Tom Tromey
2020-10-22 14:58   ` Zaric, Zoran (Zare)
2020-10-27 19:51     ` Pedro Alves
2020-11-12 20:03     ` Tom Tromey
2020-11-12 20:11 ` Tom Tromey [this message]
2020-11-12 21:17   ` Zaric, Zoran (Zare)
2020-11-12 21:29     ` Zaric, Zoran (Zare)
2020-11-30 18:18       ` Zaric, Zoran (Zare) via Gdb-patches

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=87eekycp3c.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=Zoran.Zaric@amd.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