From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id H0hxCb9e0WM9VSEAWB0awg (envelope-from ) for ; Wed, 25 Jan 2023 11:54:23 -0500 Received: by simark.ca (Postfix, from userid 112) id 1A12E1E128; Wed, 25 Jan 2023 11:54:23 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=NM25nOyA; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C5B7C1E110 for ; Wed, 25 Jan 2023 11:54:22 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 27FE83858D28 for ; Wed, 25 Jan 2023 16:54:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 27FE83858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674665662; bh=kxVXs/7bfZUHVLL4nZhfcUrqlw7gMWGMl1ZdjJii808=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=NM25nOyAAFhOEGj9X4UvGT6boD7zqWoNqtEdAKqgoLWiBuUgVZHD4f/BcwNw2jm6J ncqIVQELc6uK2Gl/xGbqkx2UkMmOb4Hb7Uagh0kkpj9emw/s16CkKcjUI5NbTt0aHS 0/CAiP55zCmt6AXBY41zdbwSMvW4cWT7WAru2D5E= Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 198063858D33 for ; Wed, 25 Jan 2023 16:53:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 198063858D33 Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id B3D9F1E110; Wed, 25 Jan 2023 11:53:55 -0500 (EST) Message-ID: <306793c0-a49e-b799-44b3-594d5e47a8d0@simark.ca> Date: Wed, 25 Jan 2023 11:53:55 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: working of backtrace command in GDB Content-Language: en-US To: Varun Kumar Erigila , "gdb@sourceware.org" References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: , From: Simon Marchi via Gdb Reply-To: Simon Marchi Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" On 1/24/23 23:49, Varun Kumar Erigila wrote: > Hello Everyone, > I'm trying to figure out whether gdb makes use of CFI information for "backtrace command." > In case of watchpoints, gdb tries to figure out whether the frame containing the variable on which watchpoint is set is still present by going through all the frames in stack. (it calls execute_cfa_program function to figure this out). > But in the case of the backtrace command it does not call the execute_cfa_program to unwind all the frames. > Is there another mechanism gdb uses to unwind the stack frames apart from CFI information. Hi, If a frame's PC falls within a region described by DWARF debug info (.debug_frame), then GDB will typically use it. But if it doesn't, for instance if the frame is in a library for which you don't have debug info, then GDB will revert to its architecture-specific unwinders, which tries to unwind the frame using some knowledge of the architecture's ABI, or by analyzing the code. Here's the fallback unwinder for the AArch64 architecture, for instance: https://gitlab.com/gnutools/binutils-gdb/-/blob/d8f5b7d1d1e8e1f0352848b7066dd133edd50773/gdb/aarch64-tdep.c#L1144-1154 Simon