From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78825 invoked by alias); 25 Nov 2016 12:22:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 78804 invoked by uid 89); 25 Nov 2016 12:22:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 spammy=installs, single-step, singlestep, dig X-HELO: sessmg22.ericsson.net Received: from sessmg22.ericsson.net (HELO sessmg22.ericsson.net) (193.180.251.58) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 25 Nov 2016 12:22:27 +0000 Received: from ESESSHC007.ericsson.se (Unknown_Domain [153.88.183.39]) by (Symantec Mail Security) with SMTP id 0C.E4.31000.FFC28385; Fri, 25 Nov 2016 13:22:25 +0100 (CET) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.39) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 25 Nov 2016 13:22:22 +0100 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=antoine.tremblay@ericsson.com; Received: from elxa4wqvvz1 (192.75.88.130) by VI1PR0701MB1887.eurprd07.prod.outlook.com (10.167.197.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.5; Fri, 25 Nov 2016 12:22:20 +0000 References: <1467295765-3457-1-git-send-email-yao.qi@linaro.org> <20161121120822.GA28605@E107787-LIN> <20161124215510.pbsobdtj6niycjhd@localhost> User-agent: mu4e 0.9.17; emacs 24.5.50.1 From: Antoine Tremblay To: Yao Qi CC: Antoine Tremblay , Pedro Alves , Subject: Re: [PATCH 0/9 V3] Use reinsert breakpoint for vCont;s In-Reply-To: <20161124215510.pbsobdtj6niycjhd@localhost> Date: Fri, 25 Nov 2016 12:22:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: BN3PR16CA0046.namprd16.prod.outlook.com (10.165.72.142) To VI1PR0701MB1887.eurprd07.prod.outlook.com (10.167.197.23) X-MS-Office365-Filtering-Correlation-Id: 75831f22-c897-459b-8d57-08d4152db4ab X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:VI1PR0701MB1887; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0701MB1887;3:WwlE/OPp6LyuVuSLw8+D79ft6Zbsl3yuwo1lTO/DMp67d5BZHC6ez3HaZoi4iZ0c7z3NWf3hbEcZAmMlCewyUKN3ZVQOs+Os9+PwraciNKX+iw7tfiAJnTczwINZEwOGeqDh2jbEZr1tF+13AmaNhgsErE8hxc6x6MZWyu/19wYQJT17Hus3sdgulvkziSkyHA7YM4GTiuJXTRAZH9ze2cQ3Ez0ljMDe2xgh0jalo90HGEoFWzNQU9uIPA/dZeLZngIUNjBJdjpI4F/eZW9NpA==;25:tWUcXAUyOTP9JXKiGMYgQ3XqR6JWwPxIogtXY1YBu/Z0L3JbudBNIqxHIzdZIGyaLBavqBqX34g2zouzqQymxKuibvkNYYuEeCduPHUSiXV7cMnRCcTmivavbQO98HB0A8EbAndRi27yhkh/j7t6RL41N9+vrjYZMZud4ti8kO/UWOr3RUxwFmyC/b8QrXbloslpvUSv/N+VKz3IsH1cOow/XO1h4qout6/6OQ4IicYvJYZWgbalgWadkfBLrzV1Acsp+yzaANa3CJ3j6UoZ7Vg/IUVzj+FgUuuuZvUBhKWm+T6Aj74fv8ci0gOL0MTkTCFrbiCOrVphU4aMGKtxAEkUGKykTCLywAkBHnZKyx+vXjknc5x4jV/5Y694M67q4WlKIILfdficAs/FC3rXKNBkVg0Dn/zcJFwJ+8ot25C7g7OJCO5JWxO41p5pEVjNs0GHulAKWovaZw8XQiY40w== X-Microsoft-Exchange-Diagnostics: 1;VI1PR0701MB1887;31:uLeWCO87DB/yE7wfDXfjjmiQBiu7AkyqEiuqJkUo41t+24FvrNlZFXG0pwFn9Bjw5F8ySBXARIU4t3JGvIaaqQEA3txjIVCXyMikTXKY1Jc1Qqsnm0qqHF8VqXfNz+vQgZiJENZKkpx3d9NiA4T7pfjW83k0tC3QF1I5KEdxsb1cQgyvW6iV06Gp/69rk4yHE2DKST4M/Ebyu7T9OslE0q53VWYue6vIAbVz4UlfIxdP/8UaHk9gxSZsTXDtg053Ytk3HzYlJVy8NUgGFVERlA==;20:COg5vFM0tukRx+MXX/QhDzOmCSfzOmopFmxpPjj2+7m4kJv2mpbOz5/WfuvS3LY9j7NvjYo+++sM4vHId8npW05m+Yi7NTfJp57wdzVlC74WV4ZG01KiRf0m2t2lm4VJZDciJ4qUlenQ5VORj1eKw/Ky2cVqun8GxvNx0wlu6wfg4aU7uPVsKgDiTPtgnivEw+7+9fApTAClFaCXOTcZReT8mDVKI8cP8NU3OZvMq7vFXdoreP1RyviefppnlPgaZu7z8BQ5b7cXTJ4yaCMs8z7msYZR+aa5tJtrDfzC4Mr7BPZXTDldATWgAPsco/vaZLVRtJgO8FsTjN6RdvjuYDwqiV2/q3ehW+4un0H1JHiIqKjBZNdXHPzZWYWH19QJ8y4PB79puVVEVm09t+/EAK7sv0nX0j6QjfQ4His5vwgG/Py3bL1REDulFHrk+MRmsCZtmwNrLaejjrusAsqA/DPllbyzwVdm9fY4X91HAwrReH/6vOr94WRuXoGRrvIR X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6045199)(6060326)(6040361)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6061324)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(20161123558021);SRVR:VI1PR0701MB1887;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0701MB1887; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0701MB1887;4:W4hK6epRx4zQtp1s+uQaetgN5JjrTBO3iyXDWxJETSfNccxkKW+kDDuDGSLnXT40t2xK+bZ9AtttvdZCOkFc6JUjs6chVdYaEP2k+7wglL7/tP/erF7gXuYrk9Q4gu8nPshHL8KG9nBXbJhD//lij3aayUAS26o2Yy/c2v+Klbbj73xnQzXqDYIRKI9uLEjAPKGJ/aAZ8nLh6JN08NzsBAMuFAt59C13l6nacL5L/lxMtIFsHEnBajDRUyBh3gLvPVTMLAdjisH11J16FS9Ob5cQlcgjefw5uiakZO8GT10thnHvDAYWb/JcSez0rgOLSNjotc2XHZKPQXKaJZpKzMR9i5TxI0DizOZMUGPCjI5AEF46/fu/eoYh9SWgy/vPARRO6DYrP8N41E8Rwv1aDxNxjeeIdiMFSRCVqlEUDEmsDUepeUwgEbPYAYq72uDEal/m6+J9tRbEHX11ApYoxAl9YmTiIzEBIddg6TMP+7MQHStWYZalNknXkN8Z0Nv9lGtO8Zb9vZU3DTfDsXfYM3GPP4XiWUwUn0tFDtFh3YJfa47+aC7qjpyYEYF4GS58YPZv3uJAmKugbrQwY6An8ugvyEgPC2JOKpKM6QDqvn8plKMpftNi23ScF/3reB7ZuljJjiWBUkEQ3jxkvYnnBw== X-Forefront-PRVS: 01371B902F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(43544003)(52314003)(24454002)(199003)(189002)(47776003)(1411001)(7846002)(4001350100001)(305945005)(48376002)(7736002)(2906002)(42186005)(4326007)(93886004)(97736004)(101416001)(3846002)(6116002)(50466002)(36756003)(76176999)(50986999)(2950100002)(54356999)(92566002)(105586002)(6916009)(6666003)(189998001)(5660300001)(39060400001)(39410400001)(39380400001)(110136003)(77096005)(39400400001)(81166006)(81156014)(39450400002)(8676002)(83506001)(229853002)(86362001)(66066001)(33646002)(106356001)(5003940100001)(38730400001)(68736007)(4226002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0701MB1887;H:elxa4wqvvz1;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR0701MB1887;23:LExvrrNc+Os9vPHwMOFQppQmfCVmjD2Hm39tKg5?= =?us-ascii?Q?L0l++I66kR67SrxvBfiGxyhjN+ZrLyJD72/ymSwj70iIUdbx/SNv3waxQSsZ?= =?us-ascii?Q?1J8EU7z/QAAu6qmoxwvZZViKiBETEioB6RdySGpqWiiXCC8vAxL4HVoIgvZc?= =?us-ascii?Q?iJhOnk1g74fkV1RqpakqrUQ2CQKl3CpPmFAPc4pXdLmjdcAJL/1qrssjEg24?= =?us-ascii?Q?VjWR6uqJTSJ/Vh2mF8/69ynQyn7EFZw/g7t8xmfWtZpeqTrShRp+BsVUQfSY?= =?us-ascii?Q?pz7YMSDd4/jhuxTEXaXIb05a7LSnNFmfZSwB9u0f0HZCjn9Rp2WKfpp6lFRv?= =?us-ascii?Q?EUbHMFsXFz/fVlxp1tbzTMJAgTgfMZZ2wvR+r/MAU24CRn+Fwm1KSk45HtsO?= =?us-ascii?Q?GxpJeGNIiCes7rxEtm9ODbq1JuOweMky+6iIjmn5J5zJYZs1huEIDijGBB+x?= =?us-ascii?Q?KLahEGEDna7tGmjSwaqCe7pgEFIaQI2L97WPK9IP32r3DbLSj1NRci9vGqSx?= =?us-ascii?Q?iB8F3uLk7WbT9UG/cev3Y9WAd3iG2Y5Iaeba3VhcX7fHwiU901vVID17042H?= =?us-ascii?Q?IvgpuhxfyAh+H/CFD+nh+5VBmBBcF/kVh7Ztj9Oq2Rh3BGC4fWuDSlHtKrcv?= =?us-ascii?Q?bjAPY8MtO5kuQCOiXqoXL3CWhotlA51WQBS5gPemThSueTMh22aSLhWq/TcD?= =?us-ascii?Q?FHLOoc2pDHQ8bNBg6KkIwuGVloVMxAlExMn+pB8UQhwdqd4+6G99mKc1XnMg?= =?us-ascii?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jZRKyP06PP+au/yzVOamFMAItTgqloNzxP5EYz091Agc9sEuu++PyhdcJ3mftpXfHQDUyS/jEi8jZvxYLuy17SEwGpm7O/7MO88M7mCIwhNaS0sp+CX+tvhPg9XvG0oJBu0zzYhj8RDUhe7h4H5wfE1bYcfhldBxctIvJqF3Lj+fOeLl11iKj5wl8A==;5:cO12juT+OAi0wioBaPlQCeIftB+yny8USZVqHr7CjLsqnQh3tk3e31JYY6C61bt4Z7640sBhlc4wYsFHHJ3frrV00X1up7Yrx04hf23Z5TcfAvjF5poXJm5cB7NnmWG0AlU7qstsSnWeR3suunlNyA==;24:zEjB6jGKIMbxm+YpMguXJOPQ4MZgM4/p0Wbr2hvx/m2/yqUPRTxOvW1id4uxZSYAxY/KJykIt4wP+jHM9jsNEsE8dqy9XOpLPT2cvoW6N2k= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0701MB1887;7:fbjEQsiK469BJuZrp4TqCQ8qz6YUu3t8Lh3/bzVNERKzqW4Y1RrghEyG8EdeKQV0pQ5LHwGIt+E04ZMswDIZtU/Gvu2griAyleVvg/CuCLrSU9tzHkbM1lY13GtUsSqH9fOUQGyEAt4HfsJM0Plip5v0i8OAOhlG7UJ7z/sKLzBB6sfVfRT/AfeFJjipqDTFvLHPhRO7a3kyyw1bqVESC+TsBTZ9G92iXo6jTvM+A59Z5ED33UdTiSccZQb+ZxZgl7Q3foOY2cW/ANX/pFF9lpElpK6rcJkg+LQP/KYAIA3CcAnpX94uIhaXcnFQgSu53lsagQid5KUDE0aFwLUMQUlijVJsQD3VNyyA4SS3feuWjdC4E6H3WbTxUBACdkH5CZFJVGQdwU6JVbUlF7qL6PeejDhQxk53njdp3DGPzUgcGbybucZanoXO7+h6UEGJUZz8SICRzbPVFZ3cZOh7gg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2016 12:22:20.6499 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0701MB1887 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00803.txt.bz2 Yao Qi writes: > On Mon, Nov 21, 2016 at 10:34:44AM -0500, Antoine Tremblay wrote: >> > Thread 1 either sees the original instruction on address A or the >> > breakpoint instruction. Unless ptrace read/write 32-bit is not >> > atomic, IOW, partial ptrace write result is visible to other >> > threads, I don't see why we get SIGILL here. >> >> I think this is the problem, ptrace read/write doesn't seem to be >> atomic, and thread 1 sees some half written memory. (Given that we get >> SIGILL/SIGSEGV issues) > > We need to check in linux-arm-kernel@. > >> >> Did you have any reference suggesting it was atomic ? >> > > No. > >> While testing it seems to be atomic for 32bit writes but in thumb mode >> with a 16 byte write, it is not. > > I think you meant "16 bit write". Why is that? > Yes 16 bit write sorry, because it can write a thumb breakpoint : 0xde01. >> >> Given the SIGILL/SIGSEG I get maybe that one is 2 writes of 1 byte ? >> I'll have to dig in the ptrace code I guess. >> > > It is good to get some a clear answer instead of ambiguous speculation. > I think we need to ask in linux-arm-kernel@ Did you see my follow up email ? : https://sourceware.org/ml/gdb-patches/2016-11/msg00681.html Also, I think this will become a moot point in the patch I'm about to post since: To install a single step breakpoint on a thread GDBServer needs to make sure that there is not a breakpoint at the thread's current pc, since it can't determine what is the next_pc of a breakpoint instruction. Usually for stepping over it's OK since it's stopped at pc X and it will install a single-step breakpoint at pc X + next_pc_offset. So need_step_over returns true and GDBServer starts a step_over process, which removes all breakpoints, installs a single-step breakpoint on the nextpc and resumes. But in this case it is installing single-step breakpoints in threads at different pcs then the one we're stopped, so the step-over process is not triggered and it should not be. So GDBSever does not take care to remove all breakpoints like is the case in the step-over process. Because of that it can try to install a single-step breakpoint where there is already a breakpoint in memory and thus break get_next_pc and install a breakpoint at an invalid location. Consider this case: in non-stop, thread 1-3 are stepping in a loop similar to non-stop-fair-events test. - thread 1 hits its single-step breakpoint at pc A. - delete its single-step breakpoint. - a check for need_step_over is done, but there's no breakpoint at pc A anymore, and nobody is stopped there anyway so it returns false. - proceed_one_lwp is called on each thread. Now here is the problem: thread 1 is at pc A thread 2 is at pc B B is a branch to A. thread 1 installs a single-step breakpoint at pc B since it's range stepping. thread 2 does not have a single step breakpoint but needs one installed. - proceed_one_lwp finds that it needs to install a single-step breakpoint on thread 2. - It calls install_single_step_breakpoints, which calls get_next_pc. - get_next_pc reads the current instruction in memory at pc B, but since it's a breakpoint, it missinterprets the instruction, you can't step over a breakpoint like that anyway, but this is what happens now. A single-step breakpoint is now inserted at an invalid location. So my approch in my patch is to fix this by always removing all breakpoints and fast_tracepoints_jumps, like we do in start_step_over before calling install_software_single_step. This makes the breakpoint installation a multiple steps process and thus can't be atomic. WDYT ? Thanks, Antoine