Re: [patch] More suggestive displaced-stepping memory error message

Yao Qi
2012-04-10T23:32:51Z

On 04/11/2012 03:19 AM, Jan Kratochvil wrote:
> - read_memory (copy, displaced->step_saved_copy, len);
> + status = target_read_memory (copy, displaced->step_saved_copy, len);
> + if (status != 0)
> + throw_error (MEMORY_ERROR,
> + _("Error accessing memory address %s (%s) for "
> + "displaced-stepping buffer, you may want to temporarily "
> + "turn it off if there is only one inferior thread."),

The error message is not clear to me. Why "one inferior thread" matters
here? If GDB is unable to do displaced-stepping due to unavailable
scratch pad, user has no choice except disable displaced-stepping for a
moment, and turn it on later.

> + paddress (target_gdbarch, copy), safe_strerror (status));
^^^^^^^^^^^^^^ why not `gdbarch'?

Think a little more, is it a little over-strict and less user-friendly
in this case? If I got such error message like "turn it off temporarily
and turn it on later", I can turn displaced-stepping off, but I don't
know when to turn it on again. Probably, GDB can be smart enough to not
use displaced stepping when get error on accessing scratch pad. So far,
displaced_step_prepare returns 1 for success and 0 for queued request.
We can add one more return value -1 for `unable to do displaced
stepping', so that caller can go non-displaced-stepping path.

--
Yao (é½å°§)