From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6123 invoked by alias); 4 Jun 2016 12:29:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 6109 invoked by uid 89); 4 Jun 2016 12:29:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=STATE, ctrl, 12920, 1667 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 04 Jun 2016 12:29:13 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5FB163E21 for ; Sat, 4 Jun 2016 12:29:12 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-44.ams2.redhat.com [10.36.116.44]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u54CT9Sl026738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sat, 4 Jun 2016 08:29:12 -0400 Date: Sat, 04 Jun 2016 12:29:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Fix for newer kernels with: t (tracing stop) Message-ID: <20160604122904.GA11651@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="bp/iNruPH9dso1Pn" Content-Disposition: inline User-Agent: Mutt/1.6.1 (2016-04-27) X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00072.txt.bz2 --bp/iNruPH9dso1Pn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1075 Hi, I did provide wrong ptrace data which should fail on their write. error (_("Unexpected error setting hardware debug registers")); But GDB did not print that error, only inferior did hang, because the data was not written. It is because this error/exception gets suppressed by: linux_resume_one_lwp(): 1578 if (!check_ptrace_stopped_lwp_gone (lp)) 1579 throw_exception (ex); Which happens because check_ptrace_stopped_lwp_gone() expects 'T (tracing stop)' while recent Linux kernels provide 't (tracing stop)' instad. What does lowercase t means in ps state code http://stackoverflow.com/questions/35895886/what-does-lowercase-t-means-in-ps-state-code Found it on: kernel-4.4.6-301.fc23.aarch64 by: gdb/nat/aarch64-linux-hw-point.c - ctrl |= ((1 << len) - 1) << 5; + ctrl |= (((1 << len) - 1)&~1) << 5; It does not change testsuite results on that F-23.aarch64 machine. I see no real regessions on rawhide.x86_64 machine (with F-23 kernel) although there were some fuzzy results I will need to check more. OK for check-in? Thanks, Jan --bp/iNruPH9dso1Pn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="tracestop.patch" Content-length: 2465 gdb/ChangeLog 2016-06-04 Jan Kratochvil * nat/linux-procfs.c (linux_proc_pid_has_state): Add parameter state2. (linux_proc_pid_is_stopped): Update caller. (linux_proc_pid_is_trace_stopped_nowarn): Add 't (tracing stop)'. (linux_proc_pid_is_zombie_maybe_warn): Update caller. --- a/gdb/nat/linux-procfs.c +++ b/gdb/nat/linux-procfs.c @@ -129,17 +129,20 @@ linux_proc_pid_is_gone (pid_t pid) } } -/* Return non-zero if 'State' of /proc/PID/status contains STATE. If - WARN, warn on failure to open the /proc file. */ +/* Return non-zero if 'State' of /proc/PID/status contains STATE or STATE2. + STATE2 can be NULL. If WARN, warn on failure to open the /proc file. */ static int -linux_proc_pid_has_state (pid_t pid, const char *state, int warn) +linux_proc_pid_has_state (pid_t pid, const char *state, const char *state2, + int warn) { char buffer[100]; int have_state; have_state = linux_proc_pid_get_state (pid, buffer, sizeof buffer, warn); - return (have_state > 0 && strstr (buffer, state) != NULL); + return (have_state > 0 + && (strstr (buffer, state) != NULL + || (state2 != NULL && strstr (buffer, state2) != NULL))); } /* Detect `T (stopped)' in `/proc/PID/status'. @@ -148,16 +151,18 @@ linux_proc_pid_has_state (pid_t pid, const char *state, int warn) int linux_proc_pid_is_stopped (pid_t pid) { - return linux_proc_pid_has_state (pid, "T (stopped)", 1); + return linux_proc_pid_has_state (pid, "T (stopped)", NULL, 1); } -/* Detect `T (tracing stop)' in `/proc/PID/status'. - Other states including `T (stopped)' are reported as false. */ +/* Detect `t (tracing stop)' or `T (tracing stop)' (present in older + kernels) in `/proc/PID/status'. Other states including `T (stopped)' + are reported as false. */ int linux_proc_pid_is_trace_stopped_nowarn (pid_t pid) { - return linux_proc_pid_has_state (pid, "T (tracing stop)", 1); + return linux_proc_pid_has_state (pid, "t (tracing stop)", "T (tracing stop)", + 1); } /* Return non-zero if PID is a zombie. If WARN, warn on failure to @@ -166,7 +171,7 @@ linux_proc_pid_is_trace_stopped_nowarn (pid_t pid) static int linux_proc_pid_is_zombie_maybe_warn (pid_t pid, int warn) { - return linux_proc_pid_has_state (pid, "Z (zombie)", warn); + return linux_proc_pid_has_state (pid, "Z (zombie)", NULL, warn); } /* See linux-procfs.h declaration. */ --bp/iNruPH9dso1Pn--