From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1674665635; bh=/O9RIEN/ZNfhs9L1tbO5hIZjU6oyvYF1u/Vlh3f6T5g=; h=Date:Subject:To:References:From:In-Reply-To:From; b=OqcTQ/h6jWz/f1aUj1hURaWwTSNHHSOffVwKF2vVA3IHquyA61jLa6PhAqQ4ZyST8 3tZPoiJO1Vj0HYtY2gPTw8lOrJornKvEfnyZp8xCqk3bHkupee9ii2pfhHW+kzNMS8 jlxF2RUY6rFpO9rjc466spivtJRH8cfNqhxFDaGc= 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: From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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