From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 4FE5C3858C20 for ; Tue, 16 Aug 2022 12:49:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4FE5C3858C20 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-156-QrcMIIiFOeiJJcsrYbxIgA-1; Tue, 16 Aug 2022 08:48:59 -0400 X-MC-Unique: QrcMIIiFOeiJJcsrYbxIgA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C99EF1C07823; Tue, 16 Aug 2022 12:48:58 +0000 (UTC) Received: from [10.33.36.178] (unknown [10.33.36.178]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B5C540CFD0A; Tue, 16 Aug 2022 12:48:58 +0000 (UTC) Message-ID: <6cfef95e-106b-0e06-368e-a340e8d77665@redhat.com> Date: Tue, 16 Aug 2022 13:48:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 To: hilbert Cc: Luis Machado , gdb@sourceware.org References: <700833f8.5150.182a59bc271.Coremail.swdtian@163.com> <217b746f-65e8-66c0-1678-376eb8cb1aca@arm.com> <5c30085e.8da0.182a5f3377d.Coremail.swdtian@163.com> <2271bb26-4534-44ce-b7e4-551343ffa871@redhat.com> <7ffede02.9b19.182a627c39c.Coremail.swdtian@163.com> From: Andrew Dinn Subject: Re: How does GDB get the function call stack In-Reply-To: <7ffede02.9b19.182a627c39c.Coremail.swdtian@163.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-GB Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2022 12:49:03 -0000 On 16/08/2022 11:16, hilbert wrote: > @Andrew Dinn > Now I totally understand. Thank you very much for your patience. You are very welcome. > By the way, when a multithreaded program hits a breakpoint, GDB can use > the command: /*thread ID */ > /**/to switch between threads arbitrarily,  and view the memory and > other information of each thread. > This is also implemented using ptrace, right? I would assume it relies on ptrace to stop all the threads. However, I have almost zero knowledge of how gdb actually controls the inferior process (my knowledge of gdb is exclusively on the gdb-process side of the fence). You will need to find someone else to obtain a definitive answer. regards, Andrew Dinn ----------- Red Hat Distinguished Engineer Red Hat UK Ltd Registered in England and Wales under Company Registration No. 03798903 Directors: Michael Cunningham, Michael ("Mike") O'Neill