[5/6] linux-nat: Add function lwp_is_stepping
Commit Message
Add the function lwp_is_stepping which indicates whether the given LWP
is currently single-stepping. This is a common interface, usable from
native GDB as well as from gdbserver.
gdb/gdbserver/ChangeLog:
* linux-low.c (lwp_is_stepping): New function.
gdb/ChangeLog:
* nat/linux-nat.h (lwp_is_stepping): New declaration.
* linux-nat.c (lwp_is_stepping): New function.
---
gdb/gdbserver/linux-low.c | 8 ++++++++
gdb/linux-nat.c | 8 ++++++++
gdb/nat/linux-nat.h | 4 ++++
3 files changed, 20 insertions(+)
Comments
Hi Andreas,
Patch is good to me. One nit below ...
On Thu, Sep 15, 2016 at 1:01 PM, Andreas Arnez <arnez@linux.vnet.ibm.com> wrote:
> Add the function lwp_is_stepping which indicates whether the given LWP
> is currently single-stepping. This is a common interface, usable from
> native GDB as well as from gdbserver.
"single-stepping" in hardware or software? I know it is hardware single
step.
>
> +/* Return nonzero if we are single-stepping this LWP. */
> +
> +extern int lwp_is_stepping (struct lwp_info *lwp);
> +
> #endif /* LINUX_NAT_H */
in gdbserver,
struct lwp_info
{
....
/* If this flag is set, the last continue operation at the ptrace
level on this process was a single-step. */
int stepping;
in gdb,
struct lwp_info
{
...
/* Non-zero if we were stepping this LWP. */
int step;
Looks the comments in gdbservers is better than the comments in
gdb. lwp_is_stepping, as an api, should be documented clearly.
Something like,
/* Return nonzero if we are single-stepping this LWP at the
ptrace level. */
@@ -176,6 +176,14 @@ lwp_stop_reason (struct lwp_info *lwp)
return lwp->stop_reason;
}
+/* See nat/linux-nat.h. */
+
+int
+lwp_is_stepping (struct lwp_info *lwp)
+{
+ return lwp->stepping;
+}
+
/* A list of all unknown processes which receive stop signals. Some
other process will presumably claim each of these as forked
children momentarily. */
@@ -355,6 +355,14 @@ lwp_stop_reason (struct lwp_info *lwp)
return lwp->stop_reason;
}
+/* See nat/linux-nat.h. */
+
+int
+lwp_is_stepping (struct lwp_info *lwp)
+{
+ return lwp->step;
+}
+
/* Trivial list manipulation functions to keep track of a list of
new stopped processes. */
@@ -85,4 +85,8 @@ extern enum target_stop_reason lwp_stop_reason (struct lwp_info *lwp);
extern void linux_stop_lwp (struct lwp_info *lwp);
+/* Return nonzero if we are single-stepping this LWP. */
+
+extern int lwp_is_stepping (struct lwp_info *lwp);
+
#endif /* LINUX_NAT_H */