From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125847 invoked by alias); 24 Mar 2019 21:35:18 -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 125838 invoked by uid 89); 24 Mar 2019 21:35:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= 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 ESMTP; Sun, 24 Mar 2019 21:35:17 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 22DF881F18; Sun, 24 Mar 2019 21:35:16 +0000 (UTC) Received: from f29-4.lan (ovpn-117-184.phx2.redhat.com [10.3.117.184]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EBBE210018F9; Sun, 24 Mar 2019 21:35:15 +0000 (UTC) Date: Sun, 24 Mar 2019 21:35:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: Re: [RFA] Fix internal error with 'set debug infrun 1' under high load Message-ID: <20190324143515.2463f3a3@f29-4.lan> In-Reply-To: <1553461783.1504.3.camel@skynet.be> References: <20190324142505.27486-1-philippe.waroquiers@skynet.be> <20190324135043.043ef0d9@f29-4.lan> <1553461783.1504.3.camel@skynet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2019-03/txt/msg00521.txt.bz2 On Sun, 24 Mar 2019 22:09:43 +0100 Philippe Waroquiers wrote: > On Sun, 2019-03-24 at 13:50 -0700, Kevin Buettner wrote: > > Hi Philippe, > >=20 > > There is definitely a bug in this section of code from infrun.c: > >=20 > > else if (ws.kind =3D=3D TARGET_WAITKIND_THREAD_EXITED > > || ws.kind =3D=3D TARGET_WAITKIND_EXITED > > || ws.kind =3D=3D TARGET_WAITKIND_SIGNALLED) > > { > > if (debug_infrun) > > { > > ptid_t ptid =3D ptid_t (ws.value.integer); > >=20 > > fprintf_unfiltered (gdb_stdlog, > > "infrun: %s exited while " > > "stopping threads\n", > > target_pid_to_str (ptid).c_str ()); > > } > > } > >=20 > > This line... > >=20 > > ptid_t ptid =3D ptid_t (ws.value.integer); > >=20 > > ...doesn't make sense to me since ws.value.integer is supposed to > > be the exit status for TARGET_WAITKIND_THREAD_EXITED and > > TARGET_WAITKIND_EXITED. > >=20 > > However, for TARGET_WAITKIND_SIGNALLED, the signal number is in > > ws.value.sig (which, due to being part of a union occupies some > > of the same bytes as ws.value.integer). > >=20 > > So trying to find the ptid in that manner makes no sense at all. > >=20 > > I'm guessing that the ptid values are bogus when it does work. > >=20 > > Does it work when you use=20 > >=20 > > ptid_t ptid =3D ptid_t (event_pid); > >=20 > > instead?=20=20 > I guess you mean to only print event_ptid. >=20 > Yes, that is working (the proposed patch was printing both > event_ptid and the ptid derived from ws.value.integer, assuming > that sometimes ws.value.integer was something relevant). >=20 > Here is the trace I obtain after a few trials under high load: > infrun: stop_all_threads, pass=3D0, iterations=3D0 > infrun:=C2=A0=C2=A0=C2=A0Thread 0x7ffff7fcfb40 (LWP 3587) not executing > infrun:=C2=A0=C2=A0=C2=A0Thread 0x7ffff7310700 (LWP 3632) executing, need= stop > [Thread 0x7ffff7310700 (LWP 3632) exited] > infrun: target_wait (-1.0.0, status) =3D > infrun:=C2=A0=C2=A0=C2=A03587.3632.0 [LWP 3632], > infrun:=C2=A0=C2=A0=C2=A0status->kind =3D thread exited, status =3D 0 > infrun: LWP 3632 exited while stopping threads > infrun:=C2=A0=C2=A0=C2=A0Thread 0x7ffff7fcfb40 (LWP 3587) not executing > infrun: stop_all_threads, pass=3D1, iterations=3D1 > infrun:=C2=A0=C2=A0=C2=A0Thread 0x7ffff7fcfb40 (LWP 3587) not executing > infrun: stop_all_threads done >=20 > The above is obtained with the patch: >=20 > diff --git a/gdb/infrun.c b/gdb/infrun.c > index ad7892105a..7f1339a917 100644 > --- a/gdb/infrun.c > +++ b/gdb/infrun.c > @@ -4365,12 +4365,10 @@ stop_all_threads (void) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0{ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0if (debug_infrun) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0{ > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0ptid_t ptid =3D ptid_t (ws.value.integer); > - > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0fprintf_unfiltered (gdb_stdlog, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0"infrun: %s exited while " > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0"stopping threads\n", > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= target_pid_to_str (ptid).c_str ()); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= target_pid_to_str (event_ptid).c_str ()); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0} > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0else >=20 You make a good point about trying to make use of ws.value.integer. So, here are my suggestions: 1) Move TARGET_WAITKIND_SIGNALLED into another "else if" clause. It doesn't make sense for the debug message to indicate that the process has exited when it's actually been signalled. 2) Make the TARGET_WAITKIND_THREAD_EXITED / TARGET_WAITKIND_EXITED case print the exit status and make the TARGET_WAITKIND_SIGNALLED case print the signal. These are available (respectively) in ws.value.integer a= nd ws.value.sig. Kevin