From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by sourceware.org (Postfix) with ESMTPS id 2AD4A3856DC4 for ; Wed, 2 Nov 2022 19:15:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2AD4A3856DC4 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=UwXXZoQmjDqq++npWdxctDSHIYXlgJc0OCGmiyWpKfyJ87w9tjjUqomLFXetGhAgrNZUVNBQdDmCT4fEGh9PEOPHIv2FdOYC1YQjOqdqMRKei/9RYe1NXmb9o+AapI1/c4oUjfut5qcXb+Z6OKwQzTnqfJ5V1CmlQWkevlEMHGHbXEgQgHAUy3GC9kBYE3zISYkVzJlXhRdCplZg22gykw1qL/2JMs8+N8MV6sVSwDZxxWA6PFlhNY8KsUIoOTXEedfxq3WuMl9zIU0z5Ne3YhthbzPTtdJf9Kn42U46oi+b0i+YZ74LlJwP2y7WfwdXFUm+uxiBc1FZVU/eGvVRhw== 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=ligeCYaFQTrwslXnJ4atJMtiiFxDBnDKzqyuWcAEcxM=; b=g6NoH7zjOTHOybtfBpGdM4PkaO6Gi8ZXJfj0sAoTmb9ACnjizmmHVV1emjULNjR01pvEm5cWqOw6tWJUkFeoMOiSr9vY0JZP2dsEZOyw4ZqKkqVfE6XTmh8g3/eWbGqP8BolzhA88o60MgLKJECLGbXVTK2IlOiK40UBMlcnOrBPM+xoKDs7iJelNcUNcNl1uM+adwcfn5kDyVHppoXvpLMF1lH/i8s/TsFwfMDLBxE3IpaEWKyzE7Eq6IH0QhRTBQSZPYYmUarHKRR2PUf2GAXovo5OJGHSKo09kKuvrzg/sB+3oMpFTS8b0mgFTAUurDRCSKpQGK9fwPB4g8mrpA== 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]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ligeCYaFQTrwslXnJ4atJMtiiFxDBnDKzqyuWcAEcxM=; b=LYlNYSEokF0dEVk8bIKIfEyVGWOj0uaqChWA33bJz43GDLgizDEQDdJoXfTIUkGMFusR4YddyVfrRfTVUui7bWr5TZHJEtAIxHpUJ5BRsiIvTPYRadyInOyKejBJ2aAVBbhy3c1KeUdnl6axBAOaUTcHTsNLFPYuAatj0zqxR7w= Received: from AS9PR06CA0523.eurprd06.prod.outlook.com (2603:10a6:20b:49d::24) by GV2PR08MB8390.eurprd08.prod.outlook.com (2603:10a6:150:bc::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15; Wed, 2 Nov 2022 19:15:19 +0000 Received: from AM7EUR03FT015.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:49d:cafe::97) by AS9PR06CA0523.outlook.office365.com (2603:10a6:20b:49d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20 via Frontend Transport; Wed, 2 Nov 2022 19:15:19 +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 AM7EUR03FT015.mail.protection.outlook.com (100.127.140.173) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20 via Frontend Transport; Wed, 2 Nov 2022 19:15:19 +0000 Received: ("Tessian outbound 0800d254cb3b:v130"); Wed, 02 Nov 2022 19:15:19 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a95c953abb1b3e5f X-CR-MTA-TID: 64aa7808 Received: from 43577092559c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E3D6D5FD-85A5-47FC-A688-7131A71172A7.1; Wed, 02 Nov 2022 19:15:11 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 43577092559c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 02 Nov 2022 19:15:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ERJDZfJk2jnqTVLgPu0aOHrmSXWwnPvWAKn894I/TOGc5oMYJ+a9M3KLH0/3/qAPR8bYLGel8p3JdFqPofo7kU+/1RtnkAA57C2vam9TlXLKCL5asf+sAWf3uQG+NEhCFB/kmoUzsDiKWvOH8ZTzqPQR1MON4WOFKBaR1c5jAELo3vc0xstmlYlk2uPTm3mKQT8KMVld3FZDh9QyRwRWm1OoOvL8iOv7anq4d+hktRVhsq48oK8X9Ta/wbiWYEFWb8owAXOjqEH/g35vpTJqbnbJPd1g/T9v/7mFbkngwJ0+NiqM5lbdd1mL1qzo64Cn8/gMkPcqcx0pAiG761E7Kw== 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=ligeCYaFQTrwslXnJ4atJMtiiFxDBnDKzqyuWcAEcxM=; b=dBVYWVl4hlxkNB4R2YJTcn4UE3sPOiEhX3dU1F5+wVoGcncngyymTl+ldvM6BHeW/S+erka/kEBpsQXJsfDzuUTfR0QgngmFyloaZeHBaVZwe5gZWOMQzzfQzYOPp6sDUSkycKBd+/seqYOtRZxuzwW3yfjj6dAkazANklBWHrVEjcZxCiSvF3Cmfc3b12ub2hs4dVEx3vOlHNC/7+6508xaNce+3LYWSdu4/iccQ0O2DtheS2CjlOQ2SyP3vahco02TsBchCLQmlWj6hqwiVHdWcaeXiBo4cRyMiGg/hivLEXj+vcY7iSh4qSSEmRcVx5dpOxYhjybfmgNVBENXtw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ligeCYaFQTrwslXnJ4atJMtiiFxDBnDKzqyuWcAEcxM=; b=LYlNYSEokF0dEVk8bIKIfEyVGWOj0uaqChWA33bJz43GDLgizDEQDdJoXfTIUkGMFusR4YddyVfrRfTVUui7bWr5TZHJEtAIxHpUJ5BRsiIvTPYRadyInOyKejBJ2aAVBbhy3c1KeUdnl6axBAOaUTcHTsNLFPYuAatj0zqxR7w= 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 DB9PR08MB6476.eurprd08.prod.outlook.com (2603:10a6:10:258::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Wed, 2 Nov 2022 19:15:09 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::6ba4:2f18:7531:943b]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::6ba4:2f18:7531:943b%7]) with mapi id 15.20.5769.021; Wed, 2 Nov 2022 19:15:09 +0000 Message-ID: <9352e5fd-dcc7-e379-1035-c341dda72a62@arm.com> Date: Wed, 2 Nov 2022 19:15:03 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH, v2] [PR gdb/29272] Make sure a copy_insn_closure is available when we have a match in copy_insn_closure_by_addr Content-Language: en-US To: Simon Marchi , Simon Marchi , gdb-patches@sourceware.org References: <20221026084100.28009-1-luis.machado@arm.com> <20221102143341.2807182-1-luis.machado@arm.com> <376afc60-6910-56b2-bad5-b9850d2999b5@simark.ca> <9f98d3c6-1a56-e66a-e987-c0ece9a3d2b6@efficios.com> From: Luis Machado In-Reply-To: <9f98d3c6-1a56-e66a-e987-c0ece9a3d2b6@efficios.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SA9PR13CA0166.namprd13.prod.outlook.com (2603:10b6:806:28::21) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|DB9PR08MB6476:EE_|AM7EUR03FT015:EE_|GV2PR08MB8390:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a82f52d-0300-48bd-5c57-08dabd069519 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: Tsd9lV0jUZjXrYQTul96bzcJpuG27dAxN+Trn+bYJbDPeApOA8F4YDW9/sMOdyjIeUqJwMpNXPgfT8AAUeSV7PiHwsjTQGRvZHu6o/ErmrT0lefAD/CLB4H5rykhzNcifS2iFjqgplR5sgerjgPTRtCMRJSBQNFs7QH0Xc9d4NoTZC4+2XGPTmf4516IgevrU/ejhSKpduDkyV7Sf1mnc47JAdWPncGqm3MvqQBQiDCBKeYS6eLWLXKnA8pLnTYtIiQH7n+tEOvdETBDIwi8eRmfVZISWg+XLcgciNeDgv1bNv2xL60dPfmuFQe1db4VKaAj++593BXClCnHxNs7rl9pZsg6j9NKLmb/hJ2l7Xd7JtFBJlFuHVF2bJnHcSjRGSAoof1Ndq59Gq7FWS1zz8bBs21nvmjYCBkd6BmoxTqPScEZ0hO8FEQSasn+hYxYQw8awwQhzVtdGcwDfDzVOJ5jt6u9/AO1RkdoaRr4P3OG5ilw1OhyIo6KVHm2mORWBYcUB3OSC19U/8nzW31LsTmtnYCeeSFLWo4BkNFMYCvdXq5OD3ap/cUaV6j7ocJgXVXUN2J9GlwEHsBDgFf0FgGj8Quw1Npxq78pbNpMvFSOUon/Fw7A1ZeBoF9ghV8VJ0afwGiytHrbTcGcTmg7GQoTQcyenHj3tAb76yaw3UMKz5kRKTJ2wZTWVA5v2zfwHm0TP/kBl+BnU7qVQmtlmaD6CpeuufBIiS3RhwxJpsAa4kqrK5Xy3c2mntaFHFtcHBE/HPo7ETbMVOKIl0dKjd43ipBdbG5wBHzva0MRywEuy2/fLDtk9dSi7FZfbivD 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:(13230022)(4636009)(346002)(396003)(376002)(136003)(39860400002)(366004)(451199015)(110136005)(66946007)(66556008)(66476007)(8676002)(41300700001)(83380400001)(316002)(478600001)(966005)(186003)(2616005)(6486002)(38100700002)(2906002)(53546011)(5660300002)(6506007)(31686004)(36756003)(44832011)(26005)(86362001)(6512007)(6666004)(8936002)(31696002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6476 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: AM7EUR03FT015.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 873f7444-8aad-404a-da7b-08dabd068ef2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4ggudBoS9HQCoHIZ8/q+aOI9doejLZUxgZggUeRL7LqSsdpD3OwkCrc5HSTGoGgJsQpGJ5D3EmSlHmo5ZGTVeSQB23FciDaCowAPl+PjzpoLRd5B+FDnrCXgwLfahjF5m30cpDMsILqt71iK9LCeeCbZsp7yNOb97kVU6bfGe16NfcHImHV7+bg09TQkvvnySKSzrhT4JrWMUT/ZDUZDa/ATMd9+0v0AhXXh1698maUoo660EClpmrMn5U3hOZJCf9LEegMfPP+/+sE4u7BcEqqgjyEU9v5pMTlT6J3SVzHKPn0R8M+Gv3tJ0GDGh590oUXHKA4Hbxxfi0vtNK2fGGKZl1yb7vy1i1RppPhtyZeMOleNAKhl6JZbWMhyqYYOAWqZAEAxXAqiCETAN6pGL/nb3DZ7wfbiSs+bynnDVCgyWAvPf3+tVXR+qmGki5EyDGHVCag7FEfsCIyjmVkkTWx1DBjCS6qORojIfCn9jcefNPInuPsYICjjQyl2Jthiv5wwSabzmJeB914ie9g88avip8vIxYUJNuuOnIe3TyH4p7210wMUn3gwUsq+htZvCdmcuaZmxyUQyLKiKyskx6lIxaxrg6g/pO/B1tEc81SNYQkDHvtlesadulhahiO63K0+Pr6pUWtrMKh/HWYhM5KYTFjYev2awTnQfjnCkiRHDjCgT8xekWNmAINQ29FEROyQ0xm+eQN3MBhvBYD/xyMoU2wKQVmaEZMZu4teDSl2eiIrs5olI+8j38tuW0ZUyVR1Xq5GkKr4ZdQFZlDcd3evhSVFFLHVdbZ6Zl/6PGc+U5hIp6v3qyd7k9DyRIze0rgdOhM9Tw2GQmfebJjIRw== 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:(13230022)(4636009)(136003)(396003)(39860400002)(376002)(346002)(451199015)(36840700001)(40470700004)(46966006)(478600001)(47076005)(2906002)(36860700001)(316002)(110136005)(6486002)(26005)(6512007)(53546011)(6506007)(8936002)(6666004)(41300700001)(8676002)(186003)(966005)(70586007)(70206006)(40460700003)(83380400001)(336012)(40480700001)(86362001)(2616005)(31686004)(5660300002)(356005)(44832011)(82310400005)(31696002)(82740400003)(36756003)(81166007)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2022 19:15:19.4642 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a82f52d-0300-48bd-5c57-08dabd069519 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: AM7EUR03FT015.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8390 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY 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: On 11/2/22 18:22, Simon Marchi wrote: > On 11/2/22 14:06, Luis Machado wrote: >> On 11/2/22 17:44, Simon Marchi wrote: >>> On 11/2/22 10:33, Luis Machado via Gdb-patches wrote: >>>> v2: Add try/catch block >>>> >>>> Investigating PR29272, it was mentioned a particular test used to work on >>>> GDB 10, but it started failing with GDB 11 onwards. I tracked it down to >>>> some displaced stepping improvements on commit >>>> 187b041e2514827b9d86190ed2471c4c7a352874. >>>> >>>> In particular, one of the corner cases using copy_insn_closure_by_addr got >>>> silently broken. It is hard to spot because it doesn't have any good tests >>>> for it, and the situation is quite specific to the Arm target. >>>> >>>> Essentially, the change from the displaced stepping improvements made it so >>>> we could still invoke copy_insn_closure_by_addr correctly to return the >>>> pointer to a copy_insn_closure, but it always returned nullptr due to >>>> the order of the statements in displaced_step_buffer::prepare. >>>> >>>> The way it is now, we first write the address of the displaced step buffer >>>> to PC and then save the copy_insn_closure pointer. >>>> >>>> The problem is that writing to PC for the Arm target requires figuring >>>> out if the new PC is thumb mode or not. >>>> >>>> With no copy_insn_closure data, the logic to determine the thumb mode >>>> during displaced stepping doesn't work, and gives random results that >>>> are difficult to track (SIGILL, SIGSEGV etc). >>>> >>>> Fix this by reordering the PC write in displaced_step_buffer::prepare >>>> and, for safety, add an assertion to >>>> displaced_step_buffer::copy_insn_closure_by_addr so GDB stops right >>>> when it sees this invalid situation. If this gets broken again in the >>>> future, it will be easier to spot. >>>> >>>> Guard the code in a try/catch block to handle the case where we can't >>>> write the PC, so as to not leave partial state in the displaced step >>>> machinery. >>>> >>>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29272 >>>> --- >>>>   gdb/displaced-stepping.c | 26 +++++++++++++++++++++++--- >>>>   1 file changed, 23 insertions(+), 3 deletions(-) >>>> >>>> diff --git a/gdb/displaced-stepping.c b/gdb/displaced-stepping.c >>>> index eac2c5dab94..3b5376cf31b 100644 >>>> --- a/gdb/displaced-stepping.c >>>> +++ b/gdb/displaced-stepping.c >>>> @@ -139,15 +139,31 @@ displaced_step_buffers::prepare (thread_info *thread, CORE_ADDR &displaced_pc) >>>>         return DISPLACED_STEP_PREPARE_STATUS_CANT; >>>>       } >>>>   -  /* Resume execution at the copy.  */ >>>> -  regcache_write_pc (regcache, buffer->addr); >>>> - >>>>     /* This marks the buffer as being in use.  */ >>>>     buffer->current_thread = thread; >>>>       /* Save this, now that we know everything went fine.  */ >>>>     buffer->copy_insn_closure = std::move (copy_insn_closure); >>>>   +  /* Adjust the PC so it points to the displaced step buffer address that will >>>> +     be used.  This needs to be done after we save the copy_insn_closure, as >>>> +     some architectures (Arm, for one) need that information so they can adjust >>>> +     other data as needed.  In particular, Arm needs to know if the instruction >>>> +     being executed in the displaced step buffer is thumb or not.  Without that >>>> +     information, things will be very wrong in a random way.  */ >>>> +  try >>>> +    { >>>> +      regcache_write_pc (regcache, buffer->addr); >>>> +    } >>>> +  catch (const gdb_exception_error &except) >>>> +    { >>>> +      /* Reset the displaced step buffer state if we failed to write PC. >>>> +     Otherwise we will prevent this buffer from being used, as it will >>>> +     always have a thread in buffer->current_thread.  */ >>>> +      buffer->current_thread = nullptr; >>>> +      copy_insn_closure = std::move (buffer->copy_insn_closure); >>> >>> The intention would be clearer by just doing: >>> >>>    buffer->copy_insn_closure.reset () >>> >>>> +      return DISPLACED_STEP_PREPARE_STATUS_CANT; >>> >>> I think we should just let the exception escape, >>> DISPLACED_STEP_PREPARE_STATUS_CANT isn't meant to convey an error. >> >> Wouldn't letting it escape completely abort the single-stepping operation? I was expecting a return of >> DISPLACED_STEP_PREPARE_STATUS_CANT to have a fallback of stepping in-place. Isn't that the case? > > Yeah, but I think that's what we want. Failing to write the PC is an > "abort mission" kind of failure, IMO. Something is very broken. > > DISPLACED_STEP_PREPARE_STATUS_CANT is not equivalent to an errorp, it's "we have > successfully analyzed the instruction and concluded it can't be > displaced-step". If we wanted to return a status code, I would suggest > to introduce a new one (e.g. DISPLACED_STEP_PREPARE_STATUS_ERROR). But > I think the exception is fine, this is how other kinds of failure that > happen when resuming are reported, like when we fail to insert > breakpoints. We arguably are not very good at handling those > gracefully, but that's the problem of this code here. Yeah. That's a reasonable point. I was hoping to salvage something from this bad situation and at least let the user complete a single-stepping. Let me get a v3 going. > > Simon