From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 198592A1B2 for ; Sun, 12 Jan 2025 12:22:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.188.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736684534; cv=none; b=bTjrg7nwQYkpg9ias1Ijg6vILXgOrj+4OdVwB8Nw0WSG0UBL89vPkPd0XeiAfhDY0uCaXMi06LMzxSbQ3Sge5ekoF1SMx2gV9eFcXihWwgnA1dhbjWGkjBL7zWTWVA09HYfIL37TXSdS53jGSqTG4jaBfcB6AaVg3eq1fRNThFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736684534; c=relaxed/simple; bh=NXnqDO/Rr+jfMTT0FDFKZH+0CK3UGDiyNkIWOgBT8cY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=CoUmwrnOSEtTIP0gBw6+NuwZPt1W69mM9kH1kOlo/woZocCnrMOuGfCAZi4Mi94evOd2lXIn9QiZgUE+ne0SuMCPqaRzNXsXQ3Ku1lMSzdY6d6bYNsf/eoTcyInZ1/4fl/uuPC8ioloMeUVrVYnEsI7zXse/8Oli/oxcbY9piz0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com; spf=pass smtp.mailfrom=canonical.com; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b=iymvn0mz; arc=none smtp.client-ip=185.125.188.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=canonical.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b="iymvn0mz" Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) (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 smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id BC0D63F5AB for ; Sun, 12 Jan 2025 12:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1736684523; bh=F3Sys9DRjY305Dx0vc0wiSDOG8/qiAbi9q3+BQMs3t4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=iymvn0mz6mx71w7f8m+g7kYCfKXkyjcH30T4T6Wdtixnm7afOQ0U8dEfvaR71ZmD+ j8JhiWHQrl05lPsaddLdOxFTBpyCtBVZr8yDbkfJjqpx83NVeOEER/yP1S4HUAQCF8 hyaxN0gEn4LxxCKoSn1oo2bay99nCbIajEqbJz7bpDoTG7ug+aqUzC9JqcQ0S6aMOL jWMQxhZep7CECEBH6vQnqSlO2qvlNq0mI0l+/q9fmyrlMQrEdf98cbzN+Xl+yh+rN2 W6JnooVOTa8tM7/Ue3V5g+sFYo6OOfubdJiD1TDjul2tQi6qsGgl+NKHWbqdi7vCkL ha1vmOYU3o/Jw== Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-21640607349so76551605ad.0 for ; Sun, 12 Jan 2025 04:22:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736684521; x=1737289321; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=F3Sys9DRjY305Dx0vc0wiSDOG8/qiAbi9q3+BQMs3t4=; b=d8IdWQ275Ak3aQUXjnyBjH1O4vsdT3d/aziBwxb/79j3jfbX3XWXb6TxinX1FI1t1d 819078tCs+cwH3TXxPhFxbAdwUFAJlAZrb5mlmGREJ7AKS4dnNASPpXU+68wgauCG4r2 OClZMnpmRCQIkCw/3h+l29+OSQRJyOxFdYHeC1l4MdpslKG8STst+xOyd1KiIL40S34h 9v86mw+PlgWZ9uOhH/YE+RkWjT+uDbIv/yy8uC980cE1bCzSb3Ikz46m8crm6IXdWcnD 1mnsbwUfyZtPdO2ep4vRPWDIhx7o9OxY4AqsQMh5SHucCvmGa4+qS7Oq+eVbpTfMSwxm ELZg== X-Forwarded-Encrypted: i=1; AJvYcCWulVkTotIYxotFKDKJ48ScVspVMXwQ0u+4B8KNw40nvdlqLivlxYBD91jQiwZ+j0iBGlfJYLxcD0Gf2kg=@vger.kernel.org X-Gm-Message-State: AOJu0YyRWAGfH8ELl25Sm/wZAU6/3kE5+xnhDjkjp3Ax0BGyEaaKPYM9 ylEkMtCIoey2yXb/kdpEqZK/ynzMoyulZwh1//HGqwXQP39GDzFiCcnw2nFY5H2kiplgG0oyitY jFhkSDLOZYe3dlodY9KtIuMlyC2WhlxofALXWMKnG//pu4NZwN+Cbju7tue3QYDmagx2vWD8RR4 busw== X-Gm-Gg: ASbGnctPl9X53flkEednOiS63MY5oVfe2oK5dICF+8haX780I8hdoDg8verz0mfHxMc XTEfLTsyqZzwEl10sxiXjkXmzx/U37Ks+ly3qNZvYvYVJG+Cfjm8WfcbJTlJy4dYqbyeH2VXXcB Kj3Gz+tWhouPHekndWpNIitHwvvtqbxoOtyNJHaK/8OCR7J5h5jqMW0IO/PxjpMIZETMFEy2lZR 4/8P7X5HdEknUiNTwOW25b+3i1u7IP5GZK+ov9Ufb2yryRfTmfEMycOpw== X-Received: by 2002:a17:903:2311:b0:216:4724:2757 with SMTP id d9443c01a7336-21a83f46a3fmr276931385ad.4.1736684521283; Sun, 12 Jan 2025 04:22:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVjvCoo99rsTGjbomuyevxYsYbs2BFrDRvkpSrci9LIKhu9hmutUyOof9Pd/O2OvE+y68GJg== X-Received: by 2002:a17:903:2311:b0:216:4724:2757 with SMTP id d9443c01a7336-21a83f46a3fmr276931205ad.4.1736684520999; Sun, 12 Jan 2025 04:22:00 -0800 (PST) Received: from z790sl.. ([240f:74:7be:1:2846:8ec3:3898:1a7f]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21a9f13ae60sm38034325ad.89.2025.01.12.04.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jan 2025 04:22:00 -0800 (PST) From: Koichiro Den To: linux-next@vger.kernel.org Cc: jan.kiszka@siemens.com, kbingham@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scripts/gdb/symbols: follow up on refactoring for const struct bin_attribute Date: Sun, 12 Jan 2025 21:21:49 +0900 Message-ID: <20250112122149.9939-1-koichiro.den@canonical.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The work for 'const struct bin_attribute' [1] was merged into linux-next but did not include updates to the lx-symbols code. So it now fails with the following error: Python Exception : There is no member named nsections. Error occurred in Python: There is no member named nsections. Restore its functionality by aligning it with those changes on kernel/module/sysfs.c. [1] https://lore.kernel.org/all/20241227-sysfs-const-bin_attr-module-v2-0-e267275f0f37@weissschuh.net/ Signed-off-by: Koichiro Den --- scripts/gdb/linux/symbols.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py index f6c1b063775a..8efefd30df49 100644 --- a/scripts/gdb/linux/symbols.py +++ b/scripts/gdb/linux/symbols.py @@ -89,16 +89,26 @@ lx-symbols command.""" return name return None + def _iter_bin_attrs(self, bin_attrs): + while True: + try: + bin_attr = bin_attrs.dereference() + except gdb.MemoryError: + break + if bin_attr == 0: + break + yield bin_attr + bin_attrs += 1 + def _section_arguments(self, module, module_addr): try: sect_attrs = module['sect_attrs'].dereference() except gdb.error: return str(module_addr) - attrs = sect_attrs['attrs'] section_name_to_address = { - attrs[n]['battr']['attr']['name'].string(): attrs[n]['address'] - for n in range(int(sect_attrs['nsections']))} + bin_attr['attr']['name'].string(): bin_attr['private'] + for bin_attr in self._iter_bin_attrs(sect_attrs['grp']['bin_attrs'])} textaddr = section_name_to_address.get(".text", module_addr) args = [] -- 2.45.2