This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] New option "trust-readonly-sections"
Stan Shebs wrote:
>
> Daniel Jacobowitz wrote:
> >
> > On Wed, Jan 23, 2002 at 07:23:18PM -0800, Michael Snyder wrote:
> > >
> > > [...]
> >
> > <asbestos suit on>
> >
> > I'd rather see this default to on. If you give GDB a binary, it's
> > reasonable that GDB read from it - I though it did in a lot of cases,
> > but maybe I was mistaken.
>
> This is not the first time that someone has tried their hand at
> pruning target reads - Steve Chamberlain introduced a data
> cache for instance.
>
> Hard experience tells us that this is not something you want to
> default to be on. The problem is that most cross-debugging is
> to non-memory-protected systems, which means that the supposedly
> inviolate text section may very well be scribbled on by an
> errant program. In fact, since the program is buggy (that's
> why you're using the debugger, right? :-) ), there is a very
> good chance that the program is going to be modified without
> you realizing it. And that is *really* confusing - I experienced
> this myself, and it's most peculiar to have a display/i $pc on,
> be si'ing along, and have the effect of each step be quite
> different from what the displayed instructions are telling
> you should be happening.
>
> For a flag like this, by defaulting to off, we lessen the
> chance of unpleasant surprises for newer users, while the
> more experienced risk-takers can turn it on in .gdbinit
> and not think about it again (or at least until they get hosed
> by the optimization :-) ).
I agree with Stan -- I'd rather start out by being conservative.
What if we accept the conservative change for now, and
then if somebody wants to they can look into adding a
further enhanced interface allowing specific back-ends
to change the default to "on" if they wish?