This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] gdbserver/tracepoint.c, eval_agent_expr, prevent stack underflow.
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Michael Snyder <msnyder at vmware dot com>
- Date: Thu, 17 Mar 2011 11:25:28 +0000
- Subject: Re: [RFA] gdbserver/tracepoint.c, eval_agent_expr, prevent stack underflow.
- References: <4D76D89C.5070305@vmware.com>
On Wednesday 09 March 2011 01:32:12, Michael Snyder wrote:
> Pedro,
>
> Correct me if I'm wrong, but it looks to me as if this function will
> detect stack underflow only after it has happened, and an invalid stack
> element has been used. This change sets aside the zeroeth element of
> the stack as a sentinel, to prevent that.
>
> OK?
1. There are several checks on SP against 0 that you haven't
touched, that would no longer work as intended...
2. There are OPs that use 'stack[SP - 2]'.
3. gdb_agent_op_pick touches 'stack[SP - foo]', with an arbitrary foo.
So, I guess either make this use both 0 and 1 as sentinels,
or make everywhere that does --sp do `if (--sp >= 0)' instead.
(or even something else smarter.) #3 looks like should have
its own check, in either way.
This evaluator is Stan's design, dunno if he has a preference.
This goes without saying, but please make sure gdb.trace/ doesn't
regress after the patch.
--
Pedro Alves