Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@wasabisystems.com>
To: Steven Johnson <sjohnson@neurizon.net>
Cc: gdb@sources.redhat.com
Subject: Re: GDB and ARM Frame Pointer strangeness
Date: Thu, 10 Jun 2004 02:20:00 -0000	[thread overview]
Message-ID: <m3brjs5f2j.fsf@gossamer.airs.com> (raw)
In-Reply-To: <40C79F44.6050006@neurizon.net>

Steven Johnson <sjohnson@neurizon.net> writes:

> 3. It is a pipe dream to say "all stubs should be immune to bad memory
> reads" its certainly an ideal goal, but unfortuantely it can not
> always be achieved.

Let's get concrete about this one.  Why can this not always be
achieved?  Every stub that I've ever worked with achieves it.

For example, let's look at gdb/i386-stub.c, which is a sample stub for
the i386.  This stub presumes the existence of an external function
exceptionHandler which causes a specified function to be a trap
handler for a specifed exception.  For, e.g., exception 13, the stub
installs a trap handler which, among other things, calls the macro
CHECK_FAULT.  That macro checks whether the global variable
_mem_fault_routine is non-zero.  If it is, the exception handler calls
it in a somewhat tricky fashion, and then returns from the exception.

When the stub is asked to read from a memory location, it sets
_mem_fault_routine to set_mem_err.  The set_mem_err function just sets
the global variable mem_err to 1.

The effect is that if the read from memory is from an invalid address,
the function set_mem_err is called, and the program continue running.
After the memory is fetched, the code checks mem_err.  If mem_err is
set, the memory address was invalid, and the stub indicates that to
the caller.

That is a concrete example of how a common stub handles this issue.
That general approach is used by every stub I've worked with.  Every
processor must give you some mechanism to trap invalid memory
addresses.  If it doesn't, many things become impossible.

If we want to continue this discussion, please explain why your stub
can not do something similar.

Ian


  reply	other threads:[~2004-06-10  2:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-07  8:50 Steven Johnson
2004-06-08  4:25 ` Steven Johnson
2004-06-08  4:29   ` Daniel Jacobowitz
2004-06-08  5:02     ` Steven Johnson
2004-06-08 12:26       ` Mark Salter
2004-06-08 23:47         ` Steven Johnson
2004-06-09 15:14           ` Andrew Cagney
2004-06-10  0:06             ` Steven Johnson
2004-06-10  2:20               ` Ian Lance Taylor [this message]
2004-06-10  4:37                 ` Steven Johnson
2004-06-10  5:10                   ` Ian Lance Taylor
2004-06-10  7:16                     ` Steven Johnson
2004-06-10 21:32                       ` Andrew Cagney
2004-06-11  0:46                         ` Steven Johnson
2004-06-11 15:33                           ` Andrew Cagney
2004-06-10  9:03                   ` Richard Earnshaw

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=m3brjs5f2j.fsf@gossamer.airs.com \
    --to=ian@wasabisystems.com \
    --cc=gdb@sources.redhat.com \
    --cc=sjohnson@neurizon.net \
    /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