From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77647 invoked by alias); 27 Mar 2015 12:34:49 -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 77636 invoked by uid 89); 27 Mar 2015 12:34:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 27 Mar 2015 12:34:46 +0000 Received: from EUSAAHC008.ericsson.se (Unknown_Domain [147.117.188.96]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id 4F.DB.17241.95CE4155; Fri, 27 Mar 2015 06:36:26 +0100 (CET) Received: from [142.133.110.95] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.98) with Microsoft SMTP Server id 14.3.210.2; Fri, 27 Mar 2015 08:34:43 -0400 Message-ID: <55154E63.5040603@ericsson.com> Date: Fri, 27 Mar 2015 12:34:00 -0000 From: Antoine Tremblay User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Keith Seitz , Subject: Re: [PATCH] Fix MI dprintf-insert not printing when a location is pending. References: <1427388426-26548-1-git-send-email-antoine.tremblay@ericsson.com> <551459BF.9090406@redhat.com> In-Reply-To: <551459BF.9090406@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00899.txt.bz2 On 03/26/2015 03:10 PM, Keith Seitz wrote: > On 03/26/2015 09:47 AM, Antoine Tremblay wrote: >> gdb/ChangeLog: >> >> PR breakpoints/16465 >> * breakpoint.c (create_breakpoint): Fix missing extra_string. > > This is a real nit, so please don't go making any changes here unless a > maintainer requests it, but this changelog entry doesn't really explain > the change you've made. ["Save `extra_string' for pending breakpoints." > is much more descriptive/helpful.] > Indeed why not :) >> @@ -9783,10 +9786,16 @@ create_breakpoint (struct gdbarch *gdbarch, >> cond_string = xstrdup (cond_string); >> make_cleanup (xfree, cond_string); >> } >> + /* Create a private copy of any extra string. */ >> + if (extra_string) > > We explicitly test against NULL for pointers. [I know there are quite a > few violations of this in this function. All are awaiting an > easy/obvious separate cleanup. :-)] > Yes, it will look weird to just change the one I added though... That's what I did anyway so that the others can be part of a cleanup patch. >> + { >> + extra_string = xstrdup (extra_string); >> + make_cleanup (xfree, extra_string); >> + } >> b->cond_string = cond_string; >> + b->extra_string = extra_string; >> b->thread = thread; >> } >> - b->extra_string = NULL; >> b->ignore_count = ignore_count; >> b->disposition = tempflag ? disp_del : disp_donttouch; >> b->condition_not_parsed = 1; > > FWIW, I have pretty much an identical change in my locations API > refactor, where I ran across this problem (and more) during testing. :) Glad it can remove unrelated stuff from your patch > >> diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp >> b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp >> new file mode 100644 >> index 0000000..6832f1d >> --- /dev/null >> +++ b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp >> @@ -0,0 +1,77 @@ >> +if {[skip_shlib_tests]} { >> +if [get_compiler_info] { >> +if { [gdb_compile_shlib $libsrc1 $lib_sl1 $lib_opts] != "" } { >> +if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable >> $exec_opts] != ""} { > > This is a /big/ nitpick, but it's something that consistently irritates > me: compare the coding style of the four statements above. While there > is no "rule" governing which is most correct/desired, I always use the > first. I would ask you to choose one style and be consistent, but I am > not asking you to make any changes right now. Just please keep this in > mind in future patches. > I really had not noticed that, thanks for making me notice! I must confess I do a lot of copy & paste when writing a test. The if {[func]} seems indeed the one used in all the tcl docs so I'll use that. >> +# Set pending dprintf via MI. >> +mi_gdb_test "-dprintf-insert -f pendfunc1 \"hello\"" \ >> + >> ".*\\^done,bkpt={number=\"1\",type=\"dprintf\",disp=\"keep\",enabled=\"y\",addr=\"\",pending=\"pendfunc1\",times=\"0\",original-location=\"pendfunc1\"}" >> \ >> + "mi set dprintf" >> + >> +mi_gdb_test "-break-insert $bp_location1" ".*" "mi insert breakpoint >> bp_location1" > > Is it possible to use mi_make_breakpoint for these tests? Unfortunately for the dprintf one mi_make_breakpoint doesn't support pending breakpoints, it creates something like : bkpt={number="2",type=".*",disp=".*",enabled=".*",addr=".*",func=".*", file=".*/myfile.c",fullname=".*",line="3",thread-groups=\[.*\], times="0".*original-location=".*"} But with pending funcs it should be pending= ... It could be the subject of another patch to add that support. I used mi_create_breakpoint for the other breakpoint now > >> + >> +mi_run_cmd >> + >> +set msg "mi dprintf" >> +gdb_expect { >> + -re ".*~\"hello\"" { >> + pass $msg >> + } >> + -re ".*$mi_gdb_prompt$" { >> + fail $msg >> + } >> + timeout { >> + fail $msg >> + } >> +} > > This a pretty common test suite idiom, I think. Can mi_gdb_test be used > instead of gdb_expect? That I can't since mi_gdb_test requires a command and in this case I'm just doing expect on that comes after mi_run_cmd, there's no command associated with it.. > >> +mi_expect_stop ".*" ".*" ".*" ".*" ".*" "" "$msg stop" >> diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-pendshr.c >> b/gdb/testsuite/gdb.mi/mi-dprintf-pendshr.c >> new file mode 100644 >> index 0000000..fe49a8d >> --- /dev/null >> +++ b/gdb/testsuite/gdb.mi/mi-dprintf-pendshr.c >> @@ -0,0 +1,27 @@ >> +/* This testcase is part of GDB, the GNU debugger. >> + >> + Copyright 2015 Free Software Foundation, Inc. >> + >> + This program is free software; you can redistribute it and/or modify >> + it under the terms of the GNU General Public License as published by >> + the Free Software Foundation; either version 3 of the License, or >> + (at your option) any later version. >> + >> + This program is distributed in the hope that it will be useful, >> + but WITHOUT ANY WARRANTY; without even the implied warranty of >> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> + GNU General Public License for more details. >> + >> + You should have received a copy of the GNU General Public License >> + along with this program. If not, see >> . */ >> + >> +void >> +pendfunc1 () >> +{ >> +} >> + >> +void >> +pendfunc () >> +{ >> + pendfunc1(); >> +} >> > > IIRC, we are now requiring test case conformance to the coding standard. > [At least, that's what I've been told in the past.] So, "(void)" in the > function decls and spaces between function names and '('. [I don't think > we're requiring function comments for trivial stuff like this, though.] > Indeed that's really my old habits dying hard... fixed sorry about that. Thanks for the review ! , Patch v2 is coming up in a minute as a separate email... Antoine