From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93175 invoked by alias); 24 Nov 2017 14:07:07 -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 93156 invoked by uid 89); 24 Nov 2017 14:07:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=H*r:2a02 X-HELO: mail-wm0-f43.google.com Received: from mail-wm0-f43.google.com (HELO mail-wm0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 Nov 2017 14:07:03 +0000 Received: by mail-wm0-f43.google.com with SMTP id x63so22763617wmf.4 for ; Fri, 24 Nov 2017 06:07:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6Ro/SwZZZLBYrHY61KHihOMTPmBWfvLBjyLszRyzpEA=; b=JBzGWGnNWkm7/ps8eJdZmNUexD3w5yUyLgnMBCwLBtYKrr/Mv1NUbdDNIjvlaxlr7f Efc9QiIAvepkoDpu324njQoKSCbawVmrigoF/+ubEg6sRlE/kKORVj4eWvNdIINfLCsB MM2Puwhywu4iG6YvaeMI0fRwvrZNb535GolPKoHS/LHeKqs5a8NS5G45ezJ4tIfPEVu5 Y4KYvGpEoZvV2q4mcSlKDj5i/zPOAGnaNZY4zpaC32+XnCARQ+if9GSEq7VlwWB8BBjQ DVEuRiVCtyp9G9iENb0IMG3+vm49t/jMhZjE0P1N7VFgcagPWcCxqLYLbXf4Y65sMNFu FJNQ== X-Gm-Message-State: AJaThX5lexWkBy2pZfraNc3FuOcX3ZIfPWBZGhIWl9pt3PJ6fnApcksZ HZDHx7IhkWgkMb/mTctRXg2ezjbueIE= X-Google-Smtp-Source: AGs4zMbMTwJlwKtcEgfnrV1lOtq6YxJM6ctMWO6NSnm30dIdP+cxkAblBi/sAU8ohbhmjIrk9CMrQQ== X-Received: by 10.80.158.194 with SMTP id a60mr38392223edf.228.1511532421112; Fri, 24 Nov 2017 06:07:01 -0800 (PST) Received: from ?IPv6:2a02:c7f:ae6a:ed00:4685:ff:fe66:9f4? ([2a02:c7f:ae6a:ed00:4685:ff:fe66:9f4]) by smtp.gmail.com with ESMTPSA id a52sm14528450eda.92.2017.11.24.06.06.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Nov 2017 06:07:00 -0800 (PST) Subject: Re: [python] Allow explicit locations in breakpoints. To: Simon Marchi , Keith Seitz , eliz@gnu.org, "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> <81f2b22a-ba79-cc7c-ee85-95d2d433a90e@ericsson.com> <1765bb88-8ab0-bdcd-8551-69f8dff3bcb9@redhat.com> <31ad8fb7-0e20-13a5-45d1-c9fa67b76e27@ericsson.com> <9e817c74-170d-b7ee-e49b-0287215eab26@ericsson.com> From: Phil Muldoon Message-ID: <688b8b82-b747-389a-50a8-8d45d0fc27eb@redhat.com> Date: Fri, 24 Nov 2017 14:07:00 -0000 MIME-Version: 1.0 In-Reply-To: <9e817c74-170d-b7ee-e49b-0287215eab26@ericsson.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg00602.txt.bz2 On 23/11/17 22:17, Simon Marchi wrote: > On 2017-11-17 06:02 AM, Phil Muldoon wrote: > > I would suggest putting the argument validation code in its own function (e.g. > bppy_init_validate_args), to keep bppy_init of a reasonnable size. Okay, will do. > For convenience, I think it would be nice to accept integers for line. So perhaps > something like this: > > From d0e3122bca8b4fcb2d6f303bdc66f68929bdc14f Mon Sep 17 00:00:00 2001 > From: Simon Marchi > Date: Thu, 23 Nov 2017 16:58:35 -0500 > Subject: [PATCH] suggestion Yeah good idea. I remember we talked about this, but I must have forgotten about it. I'll add your patch in. >> diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp >> index bd138ac3d2..d91e5deb50 100644 >> --- a/gdb/testsuite/gdb.python/py-breakpoint.exp >> +++ b/gdb/testsuite/gdb.python/py-breakpoint.exp >> @@ -547,6 +547,74 @@ proc test_bkpt_events {} { >> check_last_event breakpoint_deleted >> } >> >> +proc test_bkpt_explicit_loc {} { >> + global srcfile testfile >> + >> + with_test_prefix test_bkpt_invisible { >> + # Start with a fresh gdb. >> + clean_restart ${testfile} >> + >> + if ![runto_main] then { >> + fail "cannot run to main." >> + return 0 >> + } >> + >> + delete_breakpoints >> + >> + set bp_location1 [gdb_get_line_number "Break at multiply."] >> + set bp_location2 [gdb_get_line_number "Break at add."] >> + >> + gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (line=\"$bp_location1\")" \ >> + "set explicit breakpoint by line" 0 >> + gdb_continue_to_breakpoint "Break at multiply" \ >> + ".*Break at multiply.*" >> + >> + gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (line=\"+1\")" \ >> + "set explicit breakpoint by relative line" 0 >> + gdb_continue_to_breakpoint "Break at add" \ >> + ".*Break at add.*" >> + >> + delete_breakpoints >> + gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (line=\"-1\")" \ >> + "set explicit breakpoint by relative negative line" 0 >> + gdb_continue_to_breakpoint "Break at multiply" \ >> + ".*Break at multiply.*" >> + >> + delete_breakpoints >> + gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (function=\"add\")" \ >> + "set explicit breakpoint by function" 0 >> + gdb_continue_to_breakpoint "Break at function add" \ >> + ".*Break at function add.*" >> + >> + delete_breakpoints >> + gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (source=\"$srcfile\", function=\"add\")" \ >> + "set explicit breakpoint by source file and function" 0 >> + gdb_continue_to_breakpoint "Break at function add" \ >> + ".*Break at function add.*" >> + >> + delete_breakpoints >> + gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (source=\"$srcfile\", line=\"$bp_location2\")" \ >> + "set explicit breakpoint by source file and line number" 0 >> + gdb_continue_to_breakpoint "Break at add" \ >> + ".*Break at add.*" >> + >> + delete_breakpoints >> + gdb_test "python bp1 = gdb.Breakpoint (source=\"$srcfile\")" \ >> + "RuntimeError: Specifying a source must also include a line, label or function.*" \ >> + "set invalid explicit breakpoint by source only" >> + >> + gdb_test "python bp1 = gdb.Breakpoint (source=\"foo.c\", line=\"5\")" \ >> + "No source file named foo.*" \ >> + "set invalid explicit breakpoint by missing source and line" >> + gdb_test "python bp1 = gdb.Breakpoint (source=\"$srcfile\", line=\"900\")" \ >> + "No line 900 in file \"$srcfile\".*" \ >> + "set invalid explicit breakpoint by source and invalid line" >> + gdb_test "python bp1 = gdb.Breakpoint (function=\"blah\")" \ >> + "Function \"blah\" not defined.*" \ >> + "set invalid explicit breakpoint by missing function" >> + } > > The test names should start with a lower case letter: > > https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Follow_the_test_name_convention > > Also make sure that test names are not duplicated. You can use this command to quickly > find duplicated names in gdb.sum: > > $ cat testsuite/gdb.sum | grep -e PASS -e FAIL | sort | uniq -c | sort -n I thought they all were. Regardless, I'll check again before resubmitting. > Would it be good to test that explicit breakpoint locations through the spec > argument work as well? Things like > > gdb.Breakpoint('-line 5') Yeah, good idea. They all originally were but I converted them to the keywords without thinking of the spec case Cheers Phil