From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 1tiyCMwul2LTqAkAWB0awg (envelope-from ) for ; Wed, 01 Jun 2022 05:18:04 -0400 Received: by simark.ca (Postfix, from userid 112) id 152181E221; Wed, 1 Jun 2022 05:18:04 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=eLbcjsp2; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_DYNAMIC, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.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 2B3FC1E01D for ; Wed, 1 Jun 2022 05:18:03 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9B65538344E8 for ; Wed, 1 Jun 2022 09:18:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B65538344E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1654075082; bh=I9DF8RvAA3yamN5DW3CPTLU1O9Rkwg29NIAsZcqyaig=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=eLbcjsp21xvXJ2XRNhLX9ypqkSA0rpkmmeCyyzt1B2Rt32BDfF0bE4D6ANDl15DRk LLEoVJITMKnI46cu6Icws1pYGf+CoqFRBnPO3aornXYKYiFgcn10aDIWVvtwzMiM5T k9uSkvVkuLrBYzdNJWIuZ5XWwD8zg9aD2XQtO/Cw= Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2077.outbound.protection.outlook.com [40.107.21.77]) by sourceware.org (Postfix) with ESMTPS id D451138356A9 for ; Wed, 1 Jun 2022 08:55:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D451138356A9 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=OFFvIKtDEKwOpiBlO7WwVS4h7FdPQKmAJwjnfCFNix8zRtpFanDHyorn5koge1d4/MrEuQM13NTzKQyZ/stVpahHISNJvQwEBKv6Bi2TWBk0vujTLDOBobl35+ai7HziQDWXUT5jfdh43FUFPouOFbyTdtVHwYIZw2qySsqfquKsbtwT1Q8akzK/JSTwTAYingy8UR9PEbj6g9se4W54zeZMtZrWWNu+qC2vY7WK6zppVu1jYxu2N0wJgkcvQvEvcSlgwDc/Hqu7mbDp2iyhfcF80T3CB2c1KT0wY6S4pSJRPFBOxtZu0e+wCcWJ4RgnUqdVwgd4NswySRJc/PgebA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I9DF8RvAA3yamN5DW3CPTLU1O9Rkwg29NIAsZcqyaig=; b=kJIdFSa6IQJiT+Xn+nIF1PwtHMvOIJVCjErmvPKYLoNXMCfVHfBuQhGMmMlYn+PGcpcW17YnLpfgkhA0m7yyAJWbrbh+/vNSNR4zMfhNwIoj4kGV346nMBzdH2lWhvUf3xZXxcy1Vd5UGwYDAufC79BK7P7NGvhQH4TXIVIEuY1RpMJ7UMORUiYmheKULGO4KPJ0ukAI3lyt0enuWJdPutC7Vl8KSk6TGTcrOdZf39jJJgiIX4rQCMwLG1B/C9dM/ISLGYMi3DmbYb4f3LuhIMPps7StyKu9WM3U53URdG1bL76tDVsjp4UdiXvIbcvFzTYMufSoXWeSSx8uEdPjLw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from DU2PR04CA0318.eurprd04.prod.outlook.com (2603:10a6:10:2b5::23) by DB6PR08MB2870.eurprd08.prod.outlook.com (2603:10a6:6:20::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.18; Wed, 1 Jun 2022 08:55:36 +0000 Received: from DBAEUR03FT040.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b5:cafe::eb) by DU2PR04CA0318.outlook.office365.com (2603:10a6:10:2b5::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.19 via Frontend Transport; Wed, 1 Jun 2022 08:55:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT040.mail.protection.outlook.com (100.127.142.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12 via Frontend Transport; Wed, 1 Jun 2022 08:55:35 +0000 Received: ("Tessian outbound ff2e13d26e0f:v120"); Wed, 01 Jun 2022 08:55:35 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 87dfc32f117061e3 X-CR-MTA-TID: 64aa7808 Received: from 945ee5e7bb8e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B264554A-37A9-4B28-8C47-933F2F07E380.1; Wed, 01 Jun 2022 08:55:29 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 945ee5e7bb8e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jun 2022 08:55:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l2Qxyu3TFPVAdke1P6fh8Xn0pcs7KqADHVK5vWEu2oMJFy6R8jCrHRUJ+WOyBV8TzGKl4fHbb1pyv4YlPtJo25YH74eUwHy+87jl56i705+7/zYD0G8DCEMTe36u1Kf5UTwfjRc7VqN5XARFccvE99AjxMlPJlKF+5xZ83VaX9cy4i2mPKiQ4cP8u9Hn9c5zHwzfAJnKEo/9vjOxwELlLb5koHzRHEw49mPWpH50xWvIjBnYPK1fpUmBgpvBtoPm2qXQv1I4lh6l5fEdfozwvLtdo2LHV5loEDUwtuPpAlBspa9Ii2SoYENaq/XphzXM0Ocv2Mbs9ZltT5UwcLNkWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I9DF8RvAA3yamN5DW3CPTLU1O9Rkwg29NIAsZcqyaig=; b=jlrDmUg6EH2/9DyTBrNnQTqOf+oU+V2qOv52uuwYOOvfkkzcCGRHszpOn2vwkQZHDvRG1Jd0x+8qD88D5NQtPfdH9IIDN+9slArN/gRdMjKCV+RptikliWqwzlUbPt5IE1m+IQk++S06p17KwdtzZMhnI3ifW1qxrHNWxnfROgBJxqjD1ioxM2f75wJ1XjbI44b9nGD2H6v4XtU1HMQGWGUiX72gsrp8QRetWZsMf/79pyNtSFf/xfi2FjfkUHYV6kTqRZSgu+wVwuoTcmUHpBhYYFbAvFziCiTdRhpBKuGF8yJ6At7Mlm/LyViSsdqMuEAnLaHKj9CRLo29rLHcmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by DBBPR08MB6012.eurprd08.prod.outlook.com (2603:10a6:10:205::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Wed, 1 Jun 2022 08:55:27 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::9545:ff73:df89:3e50]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::9545:ff73:df89:3e50%7]) with mapi id 15.20.5314.013; Wed, 1 Jun 2022 08:55:27 +0000 Message-ID: <1e53e1fe-b470-e392-7560-a5115e174106@arm.com> Date: Wed, 1 Jun 2022 09:55:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: GDB Stub with ARM BE8 target. Content-Language: en-US To: Jon Wilson , gdb@sourceware.org References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0167.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::35) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 23e303e9-75e4-4a77-d3bd-08da43ac7e47 X-MS-TrafficTypeDiagnostic: DBBPR08MB6012:EE_|DBAEUR03FT040:EE_|DB6PR08MB2870:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: V1/5uUvvuQZm2hFJ1nCLmwAWIH1OSGBNgx0or28hEvGR8YhvEZYDy9QgcnWiH0ikZiyUfCVaxZOb0qQ+cCKWHIEdYSBwfb2bnjhZgQQMSxdKeENZYDwBwHtZWpYq5084ZEMdzlTO/RXqAeAAJVQD0cFbCtltIP+r+et/KKKNyjam2kQZ/w7x7jS/txixZ0F0zAFx5NYXTM2VYSFczL34Ys24ycfg7jO5G3HjMPtXSgowKEzkHm7b7JPESA9ppgD9qHkVlnhD8WuFqROL3M90OXeCCZBjYX3+XgULesbPCEJPaqtUCz6A6R/qjCPjiAQfxbEMNUaJcU76vmO32GkjCzQo8Di/MdbjXVpN5rKnFG8o6oJagV+QiQw8oSYMKNFizvaZ76O1gvAapFZWjVV7xeCk2aE6dXPObydHfDcPaSHzUoq2SXAg9uh8T9Z3J1nIK6/ozQhhBr8W5RP0ofxUMwmF+SSuKKRCc6INhiW12vENuEODgVAuY1Mwj0gZk+xkIB3MVsV6YppCGadH7zddZxBkfPEiD6zqnBt2na6HXevuS4JlLct3YYwFT/yo8JsnrA4njTWrljxXzIA4VZnmSQW9MUJqXSa2LeixBaFYghm++KoTCfOjnxbdNjX1iaCpoSaIHdkzElvkweZtWKDQr1aukAzFxqgVfNf4Y6O+98Z5O6LCx9uQEgNgUd+64RHLA+JGd7GKYhS6GeimQUdk7HsUzZH1lzfZ86oud8tK2hJw+9vL27QRy6mqRUDNevXwM78zIo4mAxFbRDGV+Izir9Gs6Oy6NAXIfMq1lITQWNINpsO69O1yLYd2usiKPRl9CAIJTf4Gj33zU7jpJ1AWUeMDbGBgI63ZG/LARNSjpKY= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB3919.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(508600001)(31696002)(5660300002)(66476007)(66556008)(8676002)(86362001)(83380400001)(186003)(316002)(66946007)(6486002)(8936002)(26005)(6512007)(38100700002)(44832011)(53546011)(2616005)(6506007)(2906002)(36756003)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6012 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT040.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 95e94152-9aa0-49e8-dfcb-08da43ac7922 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xMqDqIHFgqoOomsJ8odsjDuaaRapbbmtCJZ1zhROL9ijwJDYGxYzMKEm28q+9jhE8Hu3gGMzHoipY1yWMSPFIy1Vp/LvXMluRM7bXyBV0KkEpPhBJyHAMtrW+USOv3evmscPkwbDO/uxB1/KrrG8uxZdnDs3i0FD/Lh6P7p12+YbFtYxexpeyDxkutlVieXj9xCSq9nx7Ab7l8fmZq0DQax2SLY82oiLk9IbXkbn2qsYw5QWutrJfSyLn/wKbRPQgmvRFgrWqMRdpCxpo5mpyUE0iCU+YrBpwQECcx4FdWTalDWreUt5KKXS6/ltV4MKXNxnbyaPbINYkP1WN0dvoQAeI6qcxLpRmBavW342gwC8vf+aJdKlGX9/hBD2vpX25u2d76K9zmY91oCnn2yD7dY51Ukiip67Fzq9nS9deus3nRbKUr0p3TCsxgeCdJbywx2LRNpHKLQ7TLjaJNNqLZfQPjkzDnrCVoY80CSueYMR3phJwLULsREMHVv+4kRQ5lnH2iihH0BRMDAcmjpnyuNTRkKn8aQ+YYmzQg6dc+Y6hRKZtKOh6DiILNHzlVt0hSAe5lXfp61rBQQ1OPwuWyH5FJEHKMAS+el+T4KXwazgJNf+Fzz9GVjoWh3MMFURH2AwFgn1adQnVdTUnRDZmdMuEOwArUWa0vGynyqIN64Lxun6z3A2df60sEYuUAUZ4gxMYKgMl8ZWScdjq5vRw7wPIRaIVbYB2YL+jfgBnMyvEqMWCIYbILlklDloke09QZVH+27fxkyWw9cleGbLAJVyJSXNmFSwWU/conyTMQXNLtdqYmosxt4cxpddjbbu/d1c20SoA3HUh4YqYSEX9g== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(81166007)(6486002)(44832011)(186003)(508600001)(8936002)(356005)(5660300002)(36860700001)(40460700003)(83380400001)(6512007)(86362001)(47076005)(2616005)(336012)(2906002)(53546011)(26005)(6506007)(31696002)(8676002)(31686004)(70586007)(70206006)(82310400005)(316002)(36756003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2022 08:55:35.8418 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23e303e9-75e4-4a77-d3bd-08da43ac7e47 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT040.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2870 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Luis Machado via Gdb Reply-To: Luis Machado Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" Hi Jon, On 5/31/22 00:03, Jon Wilson via Gdb wrote: > I am trying to integrate a GDB stub with a ARM BE8 target. However, it would appear that using "set endian big" defaults to BE32 architecture. I cannot seem to find a way to have the debugger interpret memory according to the BE8 architecture. The only support for BE8 mode I can see seems to be for when using BE8 core dumps or processes (https://github.com/bminor/binutils-gdb/blob/9606310bbbf8a2d529b5c2aa71cac48a46f65869/gdb/arm-tdep.c#L9781). I can't seem to find any documentation on the topic (which is pretty forgivable given how niche it is). The "set endian" command might not do what you'd expect, as it will set the endianness for data accesses only. The "code access" endianness will be set by the binary's ELF flag EF_ARM_BE8. So once you load a BE8 binary, GDB will know how to deal with it. > > I looked at handling the endianness in the stub itself (e.g. inverting the endianness of memory based on permissions), but given the code stream can contain both instructions (which should be little endian in BE8) as well as data (which should be interpretted as big endian), this is not possible. > > Have I missed an option somewhere? If this support is missing, then how should it be added? Should it be handled in a similar way to how GDB handles ARM versus Thumb mode? (https://github.com/bminor/binutils-gdb/blob/9606310bbbf8a2d529b5c2aa71cac48a46f65869/gdb/arm-tdep.c#L10589)? I don't think you've missed an option. Technically GDB should support BE8 mode, but in practice, since it is less exercised, it may have regressed and may need to be fixed. Basically GDB needs to be aware of data/code endianess when dealing with memory. There might be places that are not dealing with this correctly. Detection of BE8 should happen through the ELF flag mentioned above, so you wouldn't need to fiddle with GDB option or thumb-like heuristics. > > I'd be very grateful for any advice. > > Kind Regards. > > > Jon >