From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id beuUO0z3uWJBvgcAWB0awg (envelope-from ) for ; Mon, 27 Jun 2022 14:30:36 -0400 Received: by simark.ca (Postfix, from userid 112) id E17B81E22B; Mon, 27 Jun 2022 14:30:36 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.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 63E7B1E222 for ; Mon, 27 Jun 2022 14:30:36 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E8E53386C582 for ; Mon, 27 Jun 2022 18:30:35 +0000 (GMT) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by sourceware.org (Postfix) with ESMTPS id D891E3858C53 for ; Mon, 27 Jun 2022 18:30:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D891E3858C53 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f54.google.com with SMTP id i1so9766482wrb.11 for ; Mon, 27 Jun 2022 11:30:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=RD1gFcKQKHTIGyFI3JURGW8mLr09OudmsfCtn6k1VVE=; b=SkfXcymfjXS9xSYc1xC4zeoEBlXLHp4aZgoG42K6DlQAIG8jfnrXE0WtBVSY6aI0lK 7k3U8zRGrtpyfdwAty9oLoyj/zSaNCx4ppLDGH2OxuA1HBGlzzKHXo5/OvjrGeZ0MHGD 0Ol+kcvUjUyPTNNA/HhRjjEBAWqu8Amg8RTrYJBKhi+XyOXkHlmOMzr1HVFFh2wVYF1K RUoAHKWiebbaj5K3fDo5jibZkSDqN8OPlKBTnLkN6QnZXXgectRvzyNZtApUsWCXmAjx p8HEfsITwB9AdORrGWovQr1onAHKQI+xAfsw8A5175mKWIgXJW+Nq8wv/vmYdhPGHS/9 qBkw== X-Gm-Message-State: AJIora/oBYc4OE7xKHq1OCQRNg3oRdc+6RRNmwg4SEjfZ5qpUbSXJkJY GzTY8gJ66wApyF6aSqQLTEDifOntrzA= X-Google-Smtp-Source: AGRyM1t7n8Y35y8pw8h0humy7t69R8LvT3Y7AB9GcsOVX8j3pjjce/J8FHQEgt5uIswuwfejaYU9+w== X-Received: by 2002:a5d:66c3:0:b0:21b:994a:a6fa with SMTP id k3-20020a5d66c3000000b0021b994aa6famr13391366wrw.15.1656354622715; Mon, 27 Jun 2022 11:30:22 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:5b14:8ad0:780f:bdda? ([2001:8a0:f924:2600:5b14:8ad0:780f:bdda]) by smtp.gmail.com with ESMTPSA id f17-20020a7bcd11000000b0039c811077d3sm13889453wmj.22.2022.06.27.11.30.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jun 2022 11:30:21 -0700 (PDT) Message-ID: <6fde2a0d-73a3-7018-92b5-6d871269bf85@palves.net> Date: Mon, 27 Jun 2022 19:30:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 3/4] gdb, gdbserver: Allocate only a sane amount of buffer when fetching registers. Content-Language: en-US To: Felix Willgerodt , gdb-patches@sourceware.org References: <20220506121226.137608-1-felix.willgerodt@intel.com> <20220506121226.137608-4-felix.willgerodt@intel.com> From: Pedro Alves In-Reply-To: <20220506121226.137608-4-felix.willgerodt@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2022-05-06 13:12, Felix Willgerodt via Gdb-patches wrote: > A couple of functions blindly allocate a buffer of the size of > I386_MAX_REGISTER_SIZE. With the addition of AMX, this size has increased > drastically from 64 bytes to 8192. This changes these buffer allocations > to only use the actual amount needed, similar to how it is already done in > amd64-tdep.c (amd64_pseudo_register_read_value). > > For the i387_collect_xsave and i387_cache_to_xsave functions any feedback is > welcome. I opted to take the middle ground and only distinguish > between "AMX" and "Not-AMX". That might be unnecessary optimization, > we could alternatively be okay with using an 8kB buffer unconditionally or > be okay with having many smaller buffer allocations. Seems fine, with the bare sizes issue John pointed out, addressed. VLAs are actually not part of standard C++, but seems like no compiler complains so we can keep ignoring that...