From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by sourceware.org (Postfix) with ESMTPS id 3FAA53858C52 for ; Sat, 4 Feb 2023 15:21:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FAA53858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-142b72a728fso10086186fac.9 for ; Sat, 04 Feb 2023 07:21:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=rzzYeXdSUHtW9pBLKWKgE2ugccz09xlaNTzGUs9kQ6I=; b=S5D/bgGQLtIKIk6gnZXXEbIIpeyuJEOFNc7GxoJT+1EqY0h0AlyILyNoWcn/SFPkrb 0AhLHEWiPJVhr5GbAo/YMx0ZhL1d+0v+ibst46YHdC2+Jy2n7Z6czjIIcULmZTMQgTb1 KaWdJ0nu4VaaPTry5BJG7oNmJ/hLVgTw65FyaaeV2xzlpUQmujitD4y+TGwSE62zK0p1 5urRF/NdPaEJ+XPmMlyW5nIQJmRzTA/xzfKKjPSuUzHR9qLX6RE+CX7V5/EEoQ00KfuC yEgXKbETmL1m6vOkL0IEmkDgy43eeIsp3oaV7elHhwxfQQN8Xx51By3qCgcq9feO1jKR 7YJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rzzYeXdSUHtW9pBLKWKgE2ugccz09xlaNTzGUs9kQ6I=; b=nwRzM77lN9n12KuwEOGlG2xbX6qQCZJmaGvQswwSZ+8j90RSI4D5jnxDYLdA4VfKIr DwLMi56jraTOXfbKy9DW6GQkjZEXSgMIcpggnlwDzq6Pfo9BEQFEZdwdP3kvWPFS5H5p FaPLZJNFhWWBK4p9VpcwW2A2WVBiPep74hBR4XcP98ktBXqwTwa0Upo8cuhJ56kfpZuQ x4GGl5dG+KFWmHcXVEszhUxtKmo83EobUhmzlVKM0jtjtxRmD0iDKe3wSRFTcu8ARDA7 W9iOUdea7L5/h8kx+slE1dtwBL7I7FqRMg+Se0zQwMADUtrGNoHnJvCHQ/izxrG0RUME ZtXQ== X-Gm-Message-State: AO0yUKXiL/m92HGW2OAPwpzjEgRuBoe/xdJ2Jx6OAgnRUxyyxtIGsTtG qPmeeI/dy8+TAXiCKDtuiJr0yQ== X-Google-Smtp-Source: AK7set8LMEfO4dJYt7KC7c+cad933+UiydZ/JO5jSr6C3cFBccYlKOfnsomcE4pSmpASGBwOge4Vvg== X-Received: by 2002:a05:6870:1717:b0:163:88f9:2c56 with SMTP id h23-20020a056870171700b0016388f92c56mr7985856oae.13.1675524096528; Sat, 04 Feb 2023 07:21:36 -0800 (PST) Received: from localhost ([189.100.172.221]) by smtp.gmail.com with ESMTPSA id e5-20020a056870450500b0011d02a3fa63sm1903349oao.14.2023.02.04.07.21.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 07:21:35 -0800 (PST) References: <20230130044518.3322695-1-thiago.bauermann@linaro.org> <20230130044518.3322695-5-thiago.bauermann@linaro.org> <87pmattzjw.fsf@redhat.com> <7970ac03-1123-d5f6-7b17-808832d43be6@simark.ca> <9a85e2fe-078a-e2ee-7e49-53fe0ceef492@arm.com> <87y1pgaib6.fsf@linaro.org> <9d30751a-589b-eb95-09b1-61d083ad9730@arm.com> User-agent: mu4e 1.8.13; emacs 28.2 From: Thiago Jung Bauermann To: Luis Machado Cc: Simon Marchi , Andrew Burgess , Thiago Jung Bauermann via Gdb-patches Subject: Re: [PATCH v3 4/8] gdbserver/linux-aarch64: When thread stops, update its target description In-reply-to: <9d30751a-589b-eb95-09b1-61d083ad9730@arm.com> Date: Sat, 04 Feb 2023 15:21:32 +0000 Message-ID: <87leldmp6r.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Luis Machado writes: > On 2/2/23 03:47, Simon Marchi wrote: >> On 2/1/23 21:54, Thiago Jung Bauermann wrote: >>> In any case, it wouldn't be possible to make get_thread_target_desc just >>> return thread_info->tdesc because at least the way these patches are >>> currently written, when the inferior starts or a new thread of the >>> inferior is spawned thread_info->tdesc is nullptr. gdbserver will only >>> call get_thread_tdesc after the first stop (in get_thread_regcache, in >>> the process of obtaining the pc register), so we will need to cope with >>> that situation. >> Ok. Would it work if a new thread initially inherited the tdesc from >> its process? >> > > It should be fine because the first time we fetch a process target > description, it is eventually obtained from the first and only thread. > So the SVE vector length should be correct. > > Any subsequent attempts to use the process' target description (the > first one we obtained), after further stops, may end up using an > incorrect description. > > I think this is handled correctly by the target architecture target > hook though. But there are other places where this is potentially > incorrect. > > For example... > > - When using gcore to dump a core file, GDB only dumps a single target > description. While this might be correct for a target with a fixed > target description or a AArch64 target that doesn't support SVE, it > likely won't be correctly for one AArch64 target supporting SVE if its > threads changed vector length mid-execution. Either we emit target > description notes by thread, or we don't emit a target description > note for those cases. > > - When loading the above/older gcore core files back, GDB will use a > potentially incorrect target description. If we decide to emit > per-thread target descriptions, it should be fine. Otherwise we may > need to have a "thread architecture" hook for core files as well. > > - The remote has no concept of a thread architecture (Thiago is > addressing this with this patch series). > > - AArch64 frames may have slightly different vg values, which means > their gdbarches are different as well. > > Given the differences between two gdbarches are small, we mostly get > away with it. But if there are further differences (different hooks, > for example), I fear we may run into a situation where we use an > incorrect gdbarch to call a particular hook. Indeed, good points! Thank you for bringing them up. I can address core file dumping/loading after this series. Regarding frames with different vg values, it's important to be aware of this discrepancy but IMHO it makes sense to work on it when it becomes a problem... -- Thiago