From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id F387E3858430 for ; Mon, 27 Feb 2023 21:29:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F387E3858430 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677533384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VAcGwoQsXPBdqo6g6jvR07kkpBIirPxbhE4LPYHY4aE=; b=ByOVI6V+1iemYeXxQCcS6tNwtqU699mE91w9ZeTQhwcJUeI1DuBRd0+wYixArc04Y+djo0 BmuX7CzQPq8E2Vp5qt4tHFxwSHQZJ2kUWRaRoskOijKgIxYkGBELZfYnJG3X4DmBScYDDv MiFEfBosPp8swIODZxxRrHx0EcMRs7o= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-647-FuHSXVFqOJmH3gj58HpFEg-1; Mon, 27 Feb 2023 16:29:43 -0500 X-MC-Unique: FuHSXVFqOJmH3gj58HpFEg-1 Received: by mail-wm1-f71.google.com with SMTP id n27-20020a05600c3b9b00b003e9ca0f4677so3407455wms.8 for ; Mon, 27 Feb 2023 13:29:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677533381; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VAcGwoQsXPBdqo6g6jvR07kkpBIirPxbhE4LPYHY4aE=; b=ntxqIqABEVRn7q3CsUGO2fKoMha3tSTvNx7GipKkh6R5fK4k/RW9oeEFm9MzZ3B3ss KNWtjlkPQ+5Dq9APw8MZN2zfu20IC9wcETP1zT8ItNME3l5IFUUIFXSNtay/wq7xoe+O CzTL1eaOhiho3Hi5+QSNXYNcKVEiqwc6vnnEL8PJIaJ+07voyr+WCGqr1Y94UpFvSdwy ou90OKjOYRed4RAA6UFQbo88Z+QFEfCse3fJJZ4Lb6v0jU29iYZ6miCL+KNeTdfeoU5B O0sFUliwGi/u3LAc22KNimEaIgv4a+AnyAyW6CuycWcyDGq/l6C7F78/+mFzKgiO0brM uFSQ== X-Gm-Message-State: AO0yUKUME5INgU75Kp8HYJEQ7Xn7V3/ex8C+MPcERSrC0AgX7OJvnNaU zziIz6sukTQGMw77k2myaCHs3Vdg0SKqQ1nftg1JXrdueLKUqkR+kB5hToGgPbgGZ+B01S1qGtA CHrLhIceQfJGCnpi493rDLVvtqfoHpr5gnIGVIGJqLcooM3wRx5w6YmZ5CDMxYuC5eMXEmDHvph XnDhA= X-Received: by 2002:a05:6000:12c3:b0:2c7:84e:1cfa with SMTP id l3-20020a05600012c300b002c7084e1cfamr408122wrx.40.1677533381568; Mon, 27 Feb 2023 13:29:41 -0800 (PST) X-Google-Smtp-Source: AK7set+6EP38N6REM19CT8XGAMh9uYpYehiFpEvyVN70s21N+1hxUdJTSYVN2pTgOECwF9AKZrOFcg== X-Received: by 2002:a05:6000:12c3:b0:2c7:84e:1cfa with SMTP id l3-20020a05600012c300b002c7084e1cfamr408111wrx.40.1677533381265; Mon, 27 Feb 2023 13:29:41 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id ja18-20020a05600c557200b003eb0d6f48f3sm13229150wmb.27.2023.02.27.13.29.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 13:29:40 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 08/13] gdb: remove use of alloca from linux-nat-trad.c Date: Mon, 27 Feb 2023 21:29:21 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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: Remove use of alloca from linux-nat-trad.c and replace with gdb::byte_vector. I've compiled for the mips-linux target (which uses this file) to ensure that the file still builds, but I've not tested GDB for a target that uses this file. Still, I'm pretty confident that I've not broken anything with this change. There should be no user visible changes after this commit. --- gdb/linux-nat-trad.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gdb/linux-nat-trad.c b/gdb/linux-nat-trad.c index 8204f3883f5..408d9118766 100644 --- a/gdb/linux-nat-trad.c +++ b/gdb/linux-nat-trad.c @@ -32,7 +32,6 @@ linux_nat_trad_target::fetch_register (struct regcache *regcache, int regnum) struct gdbarch *gdbarch = regcache->arch (); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR addr; - gdb_byte *buf; size_t size; pid_t pid; int i; @@ -49,7 +48,8 @@ linux_nat_trad_target::fetch_register (struct regcache *regcache, int regnum) pid = get_ptrace_pid (regcache->ptid ()); size = register_size (gdbarch, regnum); - buf = (gdb_byte *) alloca (size); + gdb::byte_vector buf_storage (size); + gdb_byte *buf = buf_storage.data (); /* Read the register contents from the inferior a chunk at a time. */ for (i = 0; i < size; i += sizeof (PTRACE_TYPE_RET)) @@ -95,7 +95,6 @@ linux_nat_trad_target::store_register (const struct regcache *regcache, enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR addr; size_t size; - gdb_byte *buf; pid_t pid; int i; @@ -108,7 +107,8 @@ linux_nat_trad_target::store_register (const struct regcache *regcache, pid = get_ptrace_pid (regcache->ptid ()); size = register_size (gdbarch, regnum); - buf = (gdb_byte *) alloca (size); + gdb::byte_vector buf_storage (size); + gdb_byte *buf = buf_storage.data (); /* Write the register contents into the inferior a chunk at a time. */ regcache->raw_collect (regnum, buf); -- 2.25.4