From 94a60b56b84b573a429648ee50bf895f9e4bd0dc Mon Sep 17 00:00:00 2001 From: Boris Astardzhiev Date: Wed, 17 Dec 2025 13:37:51 +0200 Subject: [PATCH] When receving the `target.xml` from a gdb-remote it typically contains the architecture name the remote represents. This name is later used for finding the corresponding `CoreDefiniton` so that `lldb` would be able to set up the target accordingly. SBFv0-v4's `CoreDefinitons` are given name strings starting with `sbfv*`. Yet when invoking the `parseBPFArch` function it's the `sbpfv*` names that are compared against the provided `ArchName` in the attempt to return the most appropriate `Triple`. Unittests for v0-v4 triples are only written for the `sbpfv*` cases. To make matters worse if remote's `target.xml` contains, for example, `sbfv1` this later breaks `lldb` when trying to get the output of `target dump typesystem`. The aim of this patch is to prevent this confusion and align the names to using simply sbpf*. Structures and Enums aren't touched. --- lldb/source/Utility/ArchSpec.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp index 4913f0c7b9eb2..5c986c4ad1356 100644 --- a/lldb/source/Utility/ArchSpec.cpp +++ b/lldb/source/Utility/ArchSpec.cpp @@ -249,11 +249,11 @@ static const CoreDefinition g_core_definitions[] = { {eByteOrderLittle, 4, 1, 4, llvm::Triple::wasm32, ArchSpec::eCore_wasm32, "wasm32"}, {eByteOrderLittle, 8, 8, 8, llvm::Triple::bpfel, ArchSpec::eCore_bpf, "bpf"}, - {eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbfv0, "sbf"}, - {eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbfv1, "sbfv1"}, - {eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbfv2, "sbfv2"}, - {eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbfv3, "sbfv3"}, - {eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbfv4, "sbfv4"}, + {eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbfv0, "sbpf"}, + {eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbfv1, "sbpfv1"}, + {eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbfv2, "sbpfv2"}, + {eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbfv3, "sbpfv3"}, + {eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbfv4, "sbpfv4"}, }; // Ensure that we have an entry in the g_core_definitions for each core. If you