From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69698 invoked by alias); 16 Oct 2017 21:26:18 -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 69469 invoked by uid 89); 16 Oct 2017 21:26:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy= 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; Mon, 16 Oct 2017 21:26:16 +0000 Received: from ESESSHC018.ericsson.se (Unknown_Domain [153.88.183.72]) by sessmg22.ericsson.net (Symantec Mail Security) with SMTP id 85.71.26775.6F325E95; Mon, 16 Oct 2017 23:26:14 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.72) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 16 Oct 2017 23:26:13 +0200 Received: from [142.133.49.59] (192.75.88.130) by DB4PR07MB315.eurprd07.prod.outlook.com (2a01:111:e400:982f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.5; Mon, 16 Oct 2017 21:26:10 +0000 Subject: Re: [python] Allow explicit locations in breakpoints. To: Phil Muldoon , Keith Seitz , "gdb-patches@sourceware.org" References: <04ccc2c4-7827-eedc-d8db-a83a0167acb6@redhat.com> <58311250-9ab1-39d1-99b6-07478bc8c2ab@redhat.com> <4768c7ad-cc3d-5702-fa93-40e9760d4ee8@ericsson.com> From: Simon Marchi Message-ID: <81f2b22a-ba79-cc7c-ee85-95d2d433a90e@ericsson.com> Date: Mon, 16 Oct 2017 21:26:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DM5PR12CA0060.namprd12.prod.outlook.com (2603:10b6:3:103::22) To DB4PR07MB315.eurprd07.prod.outlook.com (2a01:111:e400:982f::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e140f16-51c9-41dd-e49d-08d514dc85ec X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(2017052603219)(201703131423075)(201703031133081)(201702281549075);SRVR:DB4PR07MB315; X-Microsoft-Exchange-Diagnostics: 1;DB4PR07MB315;3:GUPri6gP5NlePqolP+zU6oGxyowtMLgVTweqnTPKuAMdPD/zmZpUT/WqyDIzkonKXeTzTnuBFT00LscotngtMgfncm4a8dq7Z4vJPBI0EA32djMI9BGrOZa8EJu669xbHCB73S6bd0Z5z4yXxrLeuGGAULL7+71LwgVQp7uPrvzDEfj5mnDr+PXhGnfACn+vqVD4psP7RGzmpSFIBL0isGnejpvhbKTwxfLScPqv4s8cJFu8FgqVDd2yHY7bVbLn;25:DXuWAb9S5g95/RIKdX1qBqdQJdmdGVPmvkVf3hGnLaSQw5fBWvJxPGxUk06kr347A1D8L/RxwNiOGCWbuoDIb8WZty3Be5YoB1l65kElm3d9eshunV2p+28nf7HWmCSLR9eZfwKyoEa9HGc/TyuDUXVlJhjjXDuzI7HrAvfLBI7icuGJT9IfoW/7Osi5s+FEyZglUprdBpydIOZ1l34JsCelE8uWu8r5ex3bB5ztAk3KSU6frYu73HDL3HTt+77jNxMwD3HeOJHRZmQXHCz+fT0xlsWkew5Z5RoL7w1b9d0hWJoJTplDmt+DaOhlazd2gbQcLqir5AtGe6JAiYbzFLrQdw+P0wj5NMHvCyAUCOo=;31:Ed1Tl9J5IxTDDefO4xmk7pSsGVUhqtBmIzEUCVd0W3iJ1Pn9nVbU9OL/sAiMVh3pXWuB3rcx5eBYBgTzeRUilNVAfSYebO6qkbgsgZc4sRBjHYs/K0H9cOV7cX04JqxlrZLNHcdsghkuHOMPePk/04495rlBzExDOoyqpLaYZDMZ24NJg9fJqmOLRfOThJrYyIER5KQzAOYItMWiBTzzMFUEUm6e1nFg9lGw0FQhiec= X-MS-TrafficTypeDiagnostic: DB4PR07MB315: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; X-Microsoft-Exchange-Diagnostics: 1;DB4PR07MB315;20:4DKey75ALceEo/85wgkJgfzYdW/HeISHO6WsqP2Y8voDS8xhRv5YurlUW/yVzHRHvKM8NrwPtOwNKBMAxXhjQ4Fs4nXfMaL8dcPsZfXRP42giWUD2RLRt0QZHxqAufRrKUOwFASViPFbtMdeq9mTsUJnmQrl5mtJ7kwEZ46wKii3ARcjFEHdKV5nzB+XZvBjMZzIGJ1C8WO5uNlIIkElTiuOjm3cxHnSUqYJbzTUtchrEeANKrYLhq7bsBazjIQWeE08DzCV6O3IW/s1YPbZQ/YFjy50GIVJJq9yOXWMXuYQPNjtav37s2Z4KvnWsFMnk5d4x7E57MO2tnXdHq7RfbVNOAkrlr8YEqmLOgEY4osoKlNJw9f9KRtGxFZresQpocUFCURXxFqbafQxEFOHp4XJZvsYsjoF1NYPChiOtcUnyROzO5EbHQqjPucXL8TgDuZFQVgMxJGbLXJLrwJbZ/fF/rxyD82H2RxMSZrsRJEHlwbgxD3L6Pj8haJEnbhY;4:GSJbB55siR3cMc+8YhvFg/CD3994HucRLb9nhB8qI3SuqTTsdavWxmGSv+6BlVdPWse3n817AomZhWQ9IaAmBjxbNQN1t5w4w3RLPy+NVs6Umd28cK3HqumME8A5oW3qIk3P7mcfu3EDtQ+Z36W951BlGJTHD9cWU9fhbzpdyyQPLfz5DH8hVx/LPTYQkXeW1qTtQM5xJVTssP7BV4TWNWct6Tgd7/k8WRmXrnhZ7JoBRcU0EhaD9WyehLGWGtC5 X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6041248)(20161123560025)(20161123555025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB4PR07MB315;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB4PR07MB315; X-Forefront-PRVS: 0462918D61 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(6049001)(376002)(346002)(39860400002)(24454002)(51914003)(377454003)(199003)(189002)(377424004)(53936002)(64126003)(66066001)(86362001)(305945005)(76176999)(50986999)(65806001)(65956001)(7736002)(47776003)(25786009)(101416001)(189998001)(2950100002)(31686004)(6246003)(50466002)(33646002)(105586002)(106356001)(6666003)(6486002)(68736007)(81156014)(8676002)(81166006)(478600001)(2906002)(83506001)(31696002)(230700001)(8936002)(229853002)(3846002)(6116002)(23676002)(16526018)(93886005)(54356999)(110136005)(97736004)(65826007)(4001150100001)(58126008)(49976008)(2501003)(5660300001)(53546010)(316002)(16576012)(36756003)(78286006);DIR:OUT;SFP:1101;SCL:1;SRVR:DB4PR07MB315;H:[142.133.49.59];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: =?utf-8?B?MTtEQjRQUjA3TUIzMTU7MjM6UGs4NUEyZTJIUGdLdXJnWklzT1ZiTEJ6Nm9L?= =?utf-8?B?Sm5pVFFndFR3cnZ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hJYnjkOMSHraHiWYYd4KDh7pWQQyq4yYRkC5Qulx4hPkGJhLZm1m9TY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2017 21:26:10.7704 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR07MB315 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00473.txt.bz2 On 2017-10-16 04:24 PM, Phil Muldoon wrote: > On 16/10/17 19:23, Simon Marchi wrote: >> On 2017-08-23 02:30 PM, Phil Muldoon wrote: >>> On 23/08/17 18:51, Keith Seitz wrote: >>>> On 08/23/2017 06:58 AM, Phil Muldoon wrote: > >> I think for Python it would make sense to support the two paradigms. If you >> are writing a Python command that ends up installing a breakpoint, it would >> be nice if you could directly pass what you received to the gdb.Breakpoint >> constructor and have it parse it (including explicit locations). For example, >> >> (gdb) special-break -file foo.c -line 17 >> >> But it would also be nice to have a keywords based API, for when the line/file/function >> information is already split. It would avoid having to build an explicit linespec >> string just to have GDB parse it after. >> >> In terms of API, I think the "spec" argument could be mutually exclusive with >> the function/file/line/etc keywork arguments, which would be added. An error >> would be thrown if you try to use both ways at the same time. >> >> About the line="+3" issue, because this is Python, the line keyword could >> probably accept integers and strings. And if it's a string, there could >> be some validation on the format. >> > > Simon, > > Thanks for the review. For the record I have no objection to the > keywords API in addition to the spec line. > > But I'm not sure what you mean about the line argument taking an > integer or a string. So line is a problem; it can be: > > - line=3 (at line three in the source code) > - line=+3 (plus three lines from current source location) > - line=-3 (minus three lines from current source location) > > I'm not sure how I could write a ParseTupleAndKeyword to accept that > in any form other than a string? The -3 will be a minus three, the +3 > will just be a 3, and the =3 will be a 3 too. The problem is the > relative "+" information gets lost. Did you have something else in > mind? I guess I could use the O& in the format string to invoke a > converter function? I'm not quite sure what you intend though? I think we could support all of these: line=3 line='3' line='+3' line='-3' I was thinking about using the O modifier, to get a plain PyObject*, and then check what type it really is (int or string). But I didn't know about O&, which looks like a good fit. The converter function could make use of linespec_parse_line_offset if the passed argument is a string. > For now, though, I'll add the keywords (as strings) in. This really > prompts me to think we should rewrite the gdb.Breakpoint constructor > to not use create_breakpoint and be more MI-like in the creation of > breakpoints. I'm not sure what you mean, MI uses create_breakpoint in mi_cmd_break_insert_1. Simon