This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Some ideas of displaced step function


teawater wrote:
Hi all,

I read the source code of displaced step and found some fail with it
(http://sourceware.org/ml/gdb/2008-08/msg00231.html).

I have some ideas on it:

1. I think this function just for asynchronous debug. But in acutally,
it be used for any inferior:
/* Return non-zero if displaced stepping is enabled, and can be used
   with GDBARCH.  */
static int
use_displaced_stepping (struct gdbarch *gdbarch)
{
  return (can_use_displaced_stepping
          && gdbarch_displaced_step_copy_insn_p (gdbarch));
}
Why not let it just work with asynchronous debug?

2. This function will affect another code cause it change pc change
memory, but it not supply a get and set interfaces? Most of its
variables are set to static. Just have a can_use_displaced_stepping
can control it disable or enable, but user can set it too. If other
code want know the orig PC or another things, How should they do?

3.  If get memory fail, it will just output a memory fail directly.
Simple user will not know what happen. But in actually, he can use
"maintenance set can-use-displaced-stepping 0" to jump off this
problem directly.

Yes, in fact I have run into this myself. In replay debugging (for instance both Teawater's and VMware's implementation), you can't write to an arbitrary memory location when you're debugging a replay log. Actually it's true with gdb-freeplay too. So I always have to remember to do

maint set can-use-displaced-step off

before I begin.

Why are we using displaced-stepping when we're not async?
Isn't it unnecessarily expensive?

So I think maybe can add some clear fail message for example:
Displaced step write memory fail in address 0x....., Maybe you can
jump off with close displaced step function in "maintenance set
can-use-displaced-stepping 0".


Thanks, Hui


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]