public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
To: "simark@simark.ca" <simark@simark.ca>,
	Aditya Kamath1 <Aditya.Kamath1@ibm.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] 0001-Fix-multi-thread-debug-bug-in-AIX.patch
Date: Tue, 8 Nov 2022 12:17:18 +0000	[thread overview]
Message-ID: <5df6ab523034d1997ffda5bb06c3bd87777dcccb.camel@de.ibm.com> (raw)
In-Reply-To: <CH2PR15MB3544280C0A0B3D7F2F35BD0FD63F9@CH2PR15MB3544.namprd15.prod.outlook.com>

Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>>You should find out why the "priv" field isn't
>>set up correctly, and fix whatever was going
>>wrong there.  (I believe this should have been
>>done in sync_threadlists.)
>
>You were right about this. What is happening is the main process 
>and the thread representing it are treated as two separate threads
>by the libpthread library. Main process had no private data set
>whereas the thread representing it had. Usually, both of them
>should have it and their private data must be the same. 

I see.  I agree this is the root cause of the issue, but the fix
doesn't look quite right to me.

You should not even *have* the duplicate GDB thread in the first place.

>(gdb) info threads
>  Id   Target Id                          Frame 
>* 1    process 12059046                   0xd0595fb0 in _p_nsleep () from /usr/lib/libpthread.a(shr_xpg5.o)
>  2    Thread 1 (tid 39125487, running)   0xd0595fb0 in _p_nsleep () from /usr/lib/libpthread.a(shr_xpg5.o)
>  3    Thread 258 (tid 23396809, running) thread_function (arg=0x0) at continue-pending-status.c:36
>  4    Thread 515 (tid 36503883, running) thread_function (arg=warning: (Internal error: pc 0x0 in read in psymtab, but not in symtab.)

This is not how GDB threads are handled on any other platform.  While
you do have a single dummy thread representing the process if it is
*non-threaded*, as soon as the process is recognized as multi-threaded,
you will only see a single GDB thread per target thread, and no
separate "thread" for the whole process.

So I think instead of adding a "priv" struct to that GDB thread
identifying the main process, the sync_threadlists routine should
actually just delete it (or replace it with the actual first thread,
whatever is easier).

Looking at the code, there already seems to be a place where
sync_threadlists deletes GDB threads that do not match onto
and of the threads reported by the AIX thread library - can
you verify why this doesn't trigger here?

Bye,
Ulrich


  parent reply	other threads:[~2022-11-08 12:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CH2PR15MB35447ECA01D9D2F75AEACC1DD6319@CH2PR15MB3544.namprd15.prod.outlook.com>
2022-10-28  9:49 ` Ulrich Weigand
     [not found]   ` <CH2PR15MB3544280C0A0B3D7F2F35BD0FD63F9@CH2PR15MB3544.namprd15.prod.outlook.com>
2022-11-08 12:17     ` Ulrich Weigand [this message]
     [not found]       ` <CH2PR15MB3544E198B0622C3AD22597A2D6029@CH2PR15MB3544.namprd15.prod.outlook.com>
2022-11-15 18:16         ` Ulrich Weigand
     [not found]           ` <CH2PR15MB35442C5A578DC4042072FC83D60A9@CH2PR15MB3544.namprd15.prod.outlook.com>
2022-11-23 14:15             ` Ulrich Weigand
     [not found]               ` <CH2PR15MB35441FE8F8E1FECD83202EF6D60C9@CH2PR15MB3544.namprd15.prod.outlook.com>
2022-11-23 17:09                 ` Ulrich Weigand
     [not found]                   ` <CH2PR15MB3544AB7CA50F834387522DB0D60C9@CH2PR15MB3544.namprd15.prod.outlook.com>
     [not found]                     ` <CH2PR15MB354465C64C4B32DA395C110AD6129@CH2PR15MB3544.namprd15.prod.outlook.com>
2022-11-30 14:57                       ` Ulrich Weigand
     [not found]                         ` <CH2PR15MB354486F155F5CC97501D056DD6179@CH2PR15MB3544.namprd15.prod.outlook.com>
2022-12-05 18:33                           ` Ulrich Weigand
     [not found]                             ` <CH2PR15MB35447EE88C64F7F36A0C61F5D61D9@CH2PR15MB3544.namprd15.prod.outlook.com>
2022-12-08 16:29                               ` Ulrich Weigand
     [not found]                                 ` <CH2PR15MB3544B1D8ED7EA9E56FEC79E5D6E19@CH2PR15MB3544.namprd15.prod.outlook.com>
2022-12-15 15:53                                   ` Ulrich Weigand
     [not found]                                     ` <CH2PR15MB35449A5A2BA7153A02CE913BD6E59@CH2PR15MB3544.namprd15.prod.outlook.com>
2022-12-22 12:50                                       ` Ulrich Weigand
     [not found]                                         ` <CH2PR15MB3544BD03B93F39BA8E9E5452D6EC9@CH2PR15MB3544.namprd15.prod.outlook.com>
2023-01-09 14:04                                           ` Ulrich Weigand
     [not found]                                             ` <CH2PR15MB354417A03BCE77E3BA1C3A20D6FF9@CH2PR15MB3544.namprd15.prod.outlook.com>
2023-01-11 13:31                                               ` Ulrich Weigand
     [not found]                                                 ` <BY5PR15MB3540261B391EA10F29AF5120D6C29@BY5PR15MB3540.namprd15.prod.outlook.com>
2023-01-20 14:44                                                   ` Ulrich Weigand
     [not found]                                                     ` <CH2PR15MB3544A44737D2C7BF3CDC9BAAD6CC9@CH2PR15MB3544.namprd15.prod.outlook.com>
2023-01-30 19:54                                                       ` Tom Tromey
     [not found] <CH2PR15MB35449137854F561F1EA7DE04D6D69@CH2PR15MB3544.namprd15.prod.outlook.com>
2023-02-02 17:43 ` Ulrich Weigand
     [not found]   ` <DM6PR15MB3545C1FD15BEC2D160B3AB81D6D79@DM6PR15MB3545.namprd15.prod.outlook.com>
2023-02-06 19:07     ` Ulrich Weigand
     [not found]       ` <CH2PR15MB35449148A6541A1581B1749ED6DB9@CH2PR15MB3544.namprd15.prod.outlook.com>
2023-02-08 18:44         ` Ulrich Weigand
     [not found]           ` <DM6PR15MB3545F7F15C72DF6970E4D0AED6DE9@DM6PR15MB3545.namprd15.prod.outlook.com>
2023-02-13 19:01             ` Ulrich Weigand
     [not found]               ` <CH2PR15MB35444D2E4EC3340265427F47D6A29@CH2PR15MB3544.namprd15.prod.outlook.com>
2023-02-16 19:46                 ` Ulrich Weigand
     [not found]                   ` <CH2PR15MB354455A756AF729AE5F796E2D6A19@CH2PR15MB3544.namprd15.prod.outlook.com>
2023-02-17 12:04                     ` Ulrich Weigand
     [not found]                       ` <CH2PR15MB3544B015A880690CA1F6284AD6A19@CH2PR15MB3544.namprd15.prod.outlook.com>
2023-02-17 14:18                         ` Ulrich Weigand
     [not found]                           ` <CH2PR15MB3544E905156ECE35D5ADCD43D6A19@CH2PR15MB3544.namprd15.prod.outlook.com>
2023-02-17 19:14                             ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5df6ab523034d1997ffda5bb06c3bd87777dcccb.camel@de.ibm.com \
    --to=ulrich.weigand@de.ibm.com \
    --cc=Aditya.Kamath1@ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sangamesh.swamy@in.ibm.com \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).