From: Antoine Tremblay <antoine.tremblay@ericsson.com>
To: Keith Seitz <keiths@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix MI dprintf-insert not printing when a location is pending.
Date: Fri, 27 Mar 2015 12:34:00 -0000 [thread overview]
Message-ID: <55154E63.5040603@ericsson.com> (raw)
In-Reply-To: <551459BF.9090406@redhat.com>
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>\",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
>> <http://www.gnu.org/licenses/>. */
>> +
>> +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
next prev parent reply other threads:[~2015-03-27 12:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-26 16:47 Antoine Tremblay
2015-03-26 19:11 ` Keith Seitz
2015-03-27 12:34 ` Antoine Tremblay [this message]
2015-03-27 12:37 ` Antoine Tremblay
2015-03-27 16:52 ` Keith Seitz
2015-03-27 17:13 ` Antoine Tremblay
2015-03-27 17:34 ` Keith Seitz
2015-04-20 12:14 ` Antoine Tremblay
2015-06-12 12:27 ` [PATCH v3] Fix MI dprintf-insert not printing on a resolved pending location Antoine Tremblay
2015-06-12 12:33 ` Pedro Alves
2015-03-27 16:46 ` [PATCH] Fix MI dprintf-insert not printing when a location is pending Keith Seitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55154E63.5040603@ericsson.com \
--to=antoine.tremblay@ericsson.com \
--cc=gdb-patches@sourceware.org \
--cc=keiths@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).