/* Low level interface to ptrace, for the remote server for GDB.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 Free Software Foundation, Inc.
This file is part of GDB.
#endif
#include "nat/linux-namespaces.h"
-#ifdef HAVE_PERSONALITY
-# include <sys/personality.h>
-# if !HAVE_DECL_ADDR_NO_RANDOMIZE
-# define ADDR_NO_RANDOMIZE 0x0040000
-# endif
-#endif
-
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
};
/* This is set while stop_all_lwps is in effect. */
-enum stopping_threads_kind stopping_threads = NOT_STOPPING_THREADS;
+static stopping_threads_kind stopping_threads = NOT_STOPPING_THREADS;
/* FIXME make into a target method? */
int using_threads = 1;
/* When the event-loop is doing a step-over, this points at the thread
being stepped. */
-ptid_t step_over_bkpt;
+static ptid_t step_over_bkpt;
bool
linux_process_target::low_supports_breakpoints ()
return options;
}
-lwp_info *
+void
linux_process_target::filter_event (int lwpid, int wstat)
{
client_state &cs = get_client_state ();
if (child == NULL && WIFSTOPPED (wstat))
{
add_to_pid_list (&stopped_pids, lwpid, wstat);
- return NULL;
+ return;
}
else if (child == NULL)
- return NULL;
+ return;
thread = get_lwp_thread (child);
report this one right now. Leave the status pending for
the next time we're able to report it. */
mark_lwp_dead (child, wstat);
- return child;
+ return;
}
else
{
delete_lwp (child);
- return NULL;
+ return;
}
}
the first instruction. */
child->status_pending_p = 1;
child->status_pending = wstat;
- return child;
+ return;
}
}
}
{
/* The event has been handled, so just return without
reporting it. */
- return NULL;
+ return;
}
}
debug_printf ("LLW: SIGSTOP caught for %s "
"while stopping threads.\n",
target_pid_to_str (ptid_of (thread)));
- return NULL;
+ return;
}
else
{
target_pid_to_str (ptid_of (thread)));
resume_one_lwp (child, child->stepping, 0, NULL);
- return NULL;
+ return;
}
}
child->status_pending_p = 1;
child->status_pending = wstat;
- return child;
+ return;
}
bool
lwp = find_lwp_pid (step_over_bkpt);
if (lwp != NULL)
- finish_step_over (lwp);
+ {
+ finish_step_over (lwp);
+
+ /* If we got our step SIGTRAP, don't leave it pending,
+ otherwise we would report it to GDB as a spurious
+ SIGTRAP. */
+ gdb_assert (lwp->status_pending_p);
+ if (WIFSTOPPED (lwp->status_pending)
+ && WSTOPSIG (lwp->status_pending) == SIGTRAP)
+ {
+ thread_info *thread = get_lwp_thread (lwp);
+ if (thread->last_resume_kind != resume_step)
+ {
+ if (debug_threads)
+ debug_printf ("detach: discard step-over SIGTRAP\n");
+
+ lwp->status_pending_p = 0;
+ lwp->status_pending = 0;
+ resume_one_lwp (lwp, lwp->stepping, 0, NULL);
+ }
+ else
+ {
+ if (debug_threads)
+ debug_printf ("detach: resume_step, "
+ "not discarding step-over SIGTRAP\n");
+ }
+ }
+ }
step_over_bkpt = null_ptid;
unsuspend_all_lwps (lwp);
}
bool
linux_process_target::supports_disable_randomization ()
{
-#ifdef HAVE_PERSONALITY
return true;
-#else
- return false;
-#endif
}
bool
return true;
}
-char *
+const char *
linux_process_target::pid_to_exec_file (int pid)
{
return linux_proc_pid_to_exec_file (pid);