From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id F00A6386184C for ; Tue, 30 Mar 2021 22:03:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F00A6386184C Received: by mail-pl1-x636.google.com with SMTP id f17so6867349plr.0 for ; Tue, 30 Mar 2021 15:03:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Zz3ZK21VkQci06YvF55pFtbkqWrvSumDQlZU8168GSo=; b=H23Qp/8MeMYYXcWoMKgqXFw5PSO7WDJqejDG8rB5oC9RWK7lHH1na0B+ACcYe9eTV3 YHnUBHxKfaMACjEbDFCSrvF4oy5vXHB58o4Nqj7M6Lp4M7qi+ffefXZWgL8Nffu3tTKf u172s58zcGeyyRV4wxl5lDlNWC77jnAlXKc/aKXjwoequON7HqHP9fJYPbvKg2N5N/qF TvvPNe2Yz/zKtnCrcMoYBpiM/4ZS6ZamYthpt8dNf7uUPIVN5NBjKgsGTjIu83yIMB0n M/rGAXCRlinxX3qTtYvWsbEMojQaMbO/tEfyp21/53sfnUSpGjjQtFOY59TL6zns9GeW c5kA== X-Gm-Message-State: AOAM5301WN+NS2wyNMXkXg5/DFSP8TMrDRHZ01C0OSUc8k1VXRFEF+Bi Tj7SHYrv9Y76bhY4BaEziRzI7xkRHIIeZRk8ACs= X-Google-Smtp-Source: ABdhPJwgSwS/vAm9HxjbOUWn8sMXXPQ+EDWw9FvLssZ50eetXxyHH7ngnSYJLOiMrspO8vbYjEYhLLniNFx0Lw+hHPk= X-Received: by 2002:a17:90b:3553:: with SMTP id lt19mr389937pjb.222.1617141811149; Tue, 30 Mar 2021 15:03:31 -0700 (PDT) MIME-Version: 1.0 References: <6b00bbbe-1400-7f11-bdcf-811595bf8e31@polymtl.ca> In-Reply-To: <6b00bbbe-1400-7f11-bdcf-811595bf8e31@polymtl.ca> From: David Blaikie Date: Tue, 30 Mar 2021 15:03:20 -0700 Message-ID: Subject: Re: Remote query for structure layout To: Simon Marchi Cc: Tim Newsome , gdb X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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, 30 Mar 2021 22:03:33 -0000 On Tue, Mar 30, 2021 at 2:49 PM Simon Marchi wrote: > On 2021-03-30 5:41 p.m., David Blaikie wrote:> > > Is the register layout in this struct part of the ABI? If so the > debugger could assume it/hardcode the knowledge. > > I don't think this is part of any ABI, this is just how FreeRTOS stores > the registers of inactive tasks. So it's like an implementation detail > of FreeRTOS, but one that the debugger needs to know in order to inspect > existing threads. > > From what I undersand from Tim's message, the GDB stub inside OpenOCD > already hardcodes that knowledge, but the problem is that the layout can > change based on compilation options (which OpenOCD probably can't easily > detect), and the layout could change between FreeRTOS versions. > > > If not, then it seems to me the right thing might be for the compiler to > have builtin support for emitting this struct under a reserved name into > every CU, perhaps? Not relying on source quirks to encourage it (as you > say, would leave you at the whims of the compiler implementation), but > actually make it explicitly part of compiler support for this architecture. > > Maybe an attribute > > struct the_struct { > } __attribute__((always_emit_debug)); > > ? > Perhaps - though I was thinking actually hardcoded in the compiler - since it's the one that chooses/knows the layout, it's not (presumably) using any code it reads from a header, etc, in user code to define the layout.