From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id czvECtoIgWhprDoAWB0awg (envelope-from ) for ; Wed, 23 Jul 2025 12:07:54 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NQpdqgyk; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 15F091E11C; Wed, 23 Jul 2025 12:07:54 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DE7ED1E089 for ; Wed, 23 Jul 2025 12:07:52 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1D1843858C66 for ; Wed, 23 Jul 2025 16:07:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D1843858C66 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NQpdqgyk Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 6BE7C3858D3C for ; Wed, 23 Jul 2025 16:07:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6BE7C3858D3C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6BE7C3858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1753286837; cv=none; b=LySNZ4SPKjDMQUuBO8wvNtNst33dPfZtR2rRlKp+353xgrkLEFOIUI4fxMtEA72sjJtLOKa6uI6w76sb54J0Q8AXpUOYRSTB2nk+glapDAkSam/dpLcEK+eIoNJyOZtu0/WxygWtt5J4qadf+O3GOaMyHrLA+mhsxn5WWxtnZ38= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1753286837; c=relaxed/simple; bh=ccRtEI6khEQrOpdqUOFbvUSl7UaviSnTjAn/5N6nMDI=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=IX9eF+cp2rwtw36lbrglOrHGrmSCRDQ9/sDVQi7BrGdnjcLL4FUIcSKLAtiJUgCwH993kAFqi4AaAKnn52pqwVSsjd506GFz8mXKrQt9cLOhvWbAEK6GNY556vFO6wIA/eEmt+lm1GlkiODsvIxch27Rq2+KouK8mEjhGZfkSnw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BE7C3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753286837; 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=JmrvubvE8/7a4E4dSekKcO7rB08+UGSMUIAw1JKAhtc=; b=NQpdqgyknOH8ncsmgByXuoYLoN1//lPsOs9P0x/rzyKC+D0t5soy3mrk8c4rEW4gra4ChI kzj6wSyUncPyztTqzaeLp+pEXAYGol0Zbpazg0nG7BlQ2IUx1a0gWzU4vank9mDgntvVnn ByIdkWw3llx0TtdF2MYbz4C5DHruppU= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-359-UcLNscX1MQe7r_EtyZd8Ug-1; Wed, 23 Jul 2025 12:07:16 -0400 X-MC-Unique: UcLNscX1MQe7r_EtyZd8Ug-1 X-Mimecast-MFC-AGG-ID: UcLNscX1MQe7r_EtyZd8Ug_1753286835 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6fb3487d422so378836d6.0 for ; Wed, 23 Jul 2025 09:07:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753286835; x=1753891635; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JmrvubvE8/7a4E4dSekKcO7rB08+UGSMUIAw1JKAhtc=; b=iuDGae49mIDicRKYJc6L1I0nhezRJ9zrX9y2aJob2LP+9cBuW/SiA/0zo1b6QAPtRl YQum+8XDL4+vPxlYg5crdQ8QsPO3LOgSDEBtmiONVhp/ZXm5BiQRp7b0R0XjNcM6kvq1 JCFfFijilAMFBiN3yXoMq5e0Shz+b1Cm9xpbaOGDuoBcJu2UE347s+Ihi/4Vi+JfMWNE hlWRmI3Z5eaM7v3Fo+QKKjI2Vh+aw8s3YEY/GtrkLy694BPjBhkJcjAWimRAH5yZsgem spZ1BEfCn5V9ybozUMnWhJhREl3W9mgbgbQloH9Kz0K6yd3GlP/z4fMjGT9e8rH0tBt3 lSJA== X-Forwarded-Encrypted: i=1; AJvYcCXXPVBKWTQi2dx1HKiXvKQDogzH2nIhDZdCkobcVJvzQOc4mot5/H0EllhB+lwrlPq6u6nA7f6wJX+vQQ==@sourceware.org X-Gm-Message-State: AOJu0YwmLZvVKtQ5u1GohFCkAV0EF1KzWJuXVcW04ySxQ+rk4t5RP33x OKg6KphWdC2OQ6OapQ43esCDXMfD57RKItdm6iI1f37gUp99U3cn04bvLPwDfgwTxxapuSQkfov fLsE15eDnYwJF9RxT2DXiFG+uJPCOVn+R8L0rXsJB6a7SKZQyBny1LoehU495fcc= X-Gm-Gg: ASbGncvbFFhoygPvJ85pNrmVBjnXGX56hqKD6M29GkRhSTHpP3cgdGlpRxf7Ka2GUhJ VTYJ1/eMbGzgzXUuSMkt9VlKwiqyp2vOosJmPQ7L+jGKbLUozmky7R4wko1XsFsc/wHPOKFabpM CtPPP1f2EM+agoRV/M0LMac3pJKD9T487XJ09kYG0dPg6Iah/VrBmazKU6yAznehNR+3FNARZ33 C9doTwPNiQHFAFtY6ioRmC7iVgKQXYG7sVQ2c8wMFAK4gw2F4e6dCwYnFMBa/MU+jDI10NS1SKY EddI/yg5MNuHXrXiePOxf5dQBIAo27/3KZ7duo8bs6Cro3fA4k4= X-Received: by 2002:ad4:5c66:0:b0:705:fed3:9813 with SMTP id 6a1803df08f44-707004fd68amr50065796d6.1.1753286834901; Wed, 23 Jul 2025 09:07:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsRtQtAasOnLkIg8ldVxk4ECtFSbUcfEc/f7BDwd7zxDsYGshxoyVev30hJV9sCEEOsq9StQ== X-Received: by 2002:ad4:5c66:0:b0:705:fed3:9813 with SMTP id 6a1803df08f44-707004fd68amr50065356d6.1.1753286834303; Wed, 23 Jul 2025 09:07:14 -0700 (PDT) Received: from ?IPV6:2804:14d:8084:9a69::1000? ([2804:14d:8084:9a69::1000]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7e356c3e187sm665839985a.54.2025.07.23.09.07.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Jul 2025 09:07:13 -0700 (PDT) Message-ID: <99618601-b154-4fda-b8df-7d8c446e9dc7@redhat.com> Date: Wed, 23 Jul 2025 13:07:11 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] gdb, amd64: extend the amd64 prologue analyzer to skip register pushes To: "Kupczak, Pawel" , "gdb-patches@sourceware.org" Cc: "Schimpe, Christina" References: <20250701104759.52595-1-pawel.kupczak@intel.com> <20250701104759.52595-2-pawel.kupczak@intel.com> <91a1e38e-2978-4e81-a168-762ed55d3811@redhat.com> From: Guinevere Larsen In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: wvoYpseEMf5eYiVTd3VdWVhXh3OTgZXdDYapk4_KrB4_1753286835 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 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 On 7/23/25 7:34 AM, Kupczak, Pawel wrote: >> -----Original Message----- >> From: Kupczak, Pawel >> Sent: Friday, July 18, 2025 5:15 PM >> To: Guinevere Larsen ; gdb- >> patches@sourceware.org >> Subject: RE: [PATCH 1/3] gdb, amd64: extend the amd64 prologue analyzer to >> skip register pushes >> >> Hi! Thanks for taking a look. >> >>> -----Original Message----- >>> From: Guinevere Larsen >>> Sent: Friday, July 18, 2025 3:44 PM >>> To: Kupczak, Pawel ; gdb- >>> patches@sourceware.org >>> Subject: Re: [PATCH 1/3] gdb, amd64: extend the amd64 prologue analyzer Skipped for brevity >>>> + for (int i = 0; i < 16 && pc < current_pc; i++) >>>> + { >>>> + int reg = 0; >>>> + int pc_offset = 0; >>>> + >>>> + if (target_read_code (pc, &op, 1) == -1) >>>> + return pc; >>>> + >>>> + /* %r8 - %r15 prefix. */ >>>> + if (op == 0x41) >>> Looking over on the disassembler for record-full, I see that all 0x4- >>> are considered prefixes, and (in 64 bit targets) they all have this effect. >>> >>> Is this something that could affect this prologue analyzer? ie, that >>> some prefix like 0x40 is used to mean "push a register larger than 7", >>> which would cause us to not skip that instruction? >>> >> Now that I checked AMD64 manual, it indeed mentions that this prefix >> ranges from 0x40 - 0x4F. I might've tunneled too hard on one value, I >> checked compiler explorer now and it uses a different one too (0x48). > Correction on that - first, that 0x48 never actually happened (I was looking > at the wrong thing). > > Second, regarding REX values. I think for those register pushes, 0x41 is the > only value relevant here. Looking at instruction set and reading about the > prefix at https://dn720004.ca.archive.org/0/items/os-dev-manuals/amd%20amd64%20sdm%20instructions.pdf, > it mentions in section 1.4.4 the meanings of the 4 bits. I think in this case > REX.B is the only one that's gonna be set: > 'push' will always take 64 bit operand here so REX.W would not be set. > 'push' also doesn't use ModRM AFAIK so REX.R shouldn't be applicable. > REX.X seems completely irrelevant. > > Based on that I think REX.B is the only bit that will be set in such cases, > which maps to REX == 0x41. > > Let me know your thoughts :D well, I think you probably know a lot more of me :D If I was writing it, I'd say "if ((op & 0xf1) == 0x41)", but that's because I'm overly cautious about this stuff since I don't know how compilers behave when "bit will be ignored". I'm fine with whichever option you prefer in this case. -- Cheers, Guinevere Larsen She/Her/Hers > > With regards, > Paweł > --------------------------------------------------------------------- > Intel Technology Poland sp. z o.o. > ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. > Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych. > > Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. > This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.