diff options
author | Sergio Durigan Junior <sergiodj@redhat.com> | 2019-09-26 14:24:30 -0400 |
---|---|---|
committer | Sergio Durigan Junior <sergiodj@redhat.com> | 2019-09-26 14:24:30 -0400 |
commit | 50fa3001ce25e221ca2e54564b5589d29c4bed19 (patch) | |
tree | 4f99db1e48244cf2e3d86b867a90314dcf6d7777 /gdb/gdbserver | |
parent | 381beca6146ac68b57edf47d28cdb335fbd11635 (diff) | |
download | gdb-50fa3001ce25e221ca2e54564b5589d29c4bed19.zip gdb-50fa3001ce25e221ca2e54564b5589d29c4bed19.tar.gz gdb-50fa3001ce25e221ca2e54564b5589d29c4bed19.tar.bz2 |
Revert "Improve ptrace-error detection on Linux targets"
This reverts commit 381beca6146ac68b57edf47d28cdb335fbd11635.
The patch hasn't been fully reviewed yet, and Pedro would like to see
more fixes.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 14 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 9 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 14 | ||||
-rw-r--r-- | gdb/gdbserver/thread-db.c | 2 |
4 files changed, 6 insertions, 33 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index e60980d..c0c6f51 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,17 +1,3 @@ -2019-09-26 Sergio Durigan Junior <sergiodj@redhat.com> - Pedro Alves <palves@redhat.com> - - * linux-low.c (linux_ptrace_fun): Call - 'linux_ptrace_me_fail_reason'. - (attach_proc_task_lwp_callback): Call - 'linux_ptrace_attach_fail_reason_lwp'. - (linux_attach): Call 'linux_ptrace_attach_fail_reason'. - * server.c (handle_v_attach): Use try..catch when calling - 'attach_inferior', and send an error message to the client - when needed. - * thread-db.c (attach_thread): Call - 'linux_ptrace_attach_fail_reason_lwp'. - 2019-09-20 Christian Biesinger <cbiesinger@google.com> * debug.c (debug_threads): Remove comment in favor of the header. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index c0e15c1..d64c364 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -967,8 +967,7 @@ linux_ptrace_fun () { if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0) < 0) - trace_start_error_with_name ("ptrace", - linux_ptrace_me_fail_reason (errno).c_str ()); + trace_start_error_with_name ("ptrace"); if (setpgid (0, 0) < 0) trace_start_error_with_name ("setpgid"); @@ -1166,7 +1165,7 @@ attach_proc_task_lwp_callback (ptid_t ptid) else if (err != 0) { std::string reason - = linux_ptrace_attach_fail_reason_lwp (ptid, err); + = linux_ptrace_attach_fail_reason_string (ptid, err); warning (_("Cannot attach to lwp %d: %s"), lwpid, reason.c_str ()); } @@ -1198,8 +1197,8 @@ linux_attach (unsigned long pid) { remove_process (proc); - std::string reason = linux_ptrace_attach_fail_reason (pid, err); - error (_("Cannot attach to process %ld: %s"), pid, reason.c_str ()); + std::string reason = linux_ptrace_attach_fail_reason_string (ptid, err); + error ("Cannot attach to process %ld: %s", pid, reason.c_str ()); } /* Don't ignore the initial SIGSTOP if we just attached to this diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 976ecbd..67e8e3e 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -2893,21 +2893,9 @@ handle_v_attach (char *own_buf) { client_state &cs = get_client_state (); int pid; - int ret; pid = strtol (own_buf + 8, NULL, 16); - - try - { - ret = attach_inferior (pid); - } - catch (const gdb_exception_error &e) - { - snprintf (own_buf, PBUFSIZ, "E.%s", e.what ()); - return 0; - } - - if (pid != 0 && ret == 0) + if (pid != 0 && attach_inferior (pid) == 0) { /* Don't report shared library events after attaching, even if some libraries are preloaded. GDB will always poll the diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c index e3acf83..c6b43a0 100644 --- a/gdb/gdbserver/thread-db.c +++ b/gdb/gdbserver/thread-db.c @@ -224,7 +224,7 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p) err = linux_attach_lwp (ptid); if (err != 0) { - std::string reason = linux_ptrace_attach_fail_reason_lwp (ptid, err); + std::string reason = linux_ptrace_attach_fail_reason_string (ptid, err); warning ("Could not attach to thread %ld (LWP %d): %s", (unsigned long) ti_p->ti_tid, ti_p->ti_lid, reason.c_str ()); |