From: Hui Zhu <teawater@gmail.com>
To: Keith Seitz <keiths@redhat.com>
Cc: Hui Zhu <hui_zhu@mentor.com>, Tom Tromey <tromey@redhat.com>,
gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix create pending breakpoint handle extra_string issue if not parse_condition_and_thread
Date: Tue, 26 Mar 2013 11:16:00 -0000 [thread overview]
Message-ID: <CANFwon3shfEZpAiMRL8fDNEbHTm=ty=xXKCE1xBzX_BpGudyOw@mail.gmail.com> (raw)
In-Reply-To: <515092F2.2000307@redhat.com>
On Tue, Mar 26, 2013 at 2:09 AM, Keith Seitz <keiths@redhat.com> wrote:
> On 03/25/2013 10:14 AM, Tom Tromey wrote:
>>>>>>>
>>>>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes:
>>
>>
>> Hui> I am sorry that what you care about is the issue that affect the mi.
>> Hui> But my patch is for the issue inside the function create_breakpoint.
>
>
> Actually I /was/ talking about create_breakpoint. As you stated, the only
> way to demonstrate the problem is via MI, so that's what I used to
> demonstrate how I think the situation should be handled.
>
> Here's a patch which does exactly what I consider the "right" way to react
> to having both cond_string and a condition inside arg:
This function have parse_condition_and_thread. It already choice
which part it will get the cond_string from, why we still need this
check?
Also it didn't handle this pending breakpoints.
>
> Index: breakpoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/breakpoint.c,v
> retrieving revision 1.747
> diff -u -p -r1.747 breakpoint.c
> --- breakpoint.c 20 Mar 2013 22:17:18 -0000 1.747
> +++ breakpoint.c 25 Mar 2013 17:59:36 -0000
> @@ -9659,6 +9659,11 @@ create_breakpoint (struct gdbarch *gdbar
> extra_string = xstrdup (extra_string);
> make_cleanup (xfree, extra_string);
> }
> + else if (*arg != '\000')
> + {
> + extra_string = xstrdup (arg);
>
> + make_cleanup (xfree, extra_string);
> + }
> }
>
> ops->create_breakpoints_sal (gdbarch, &canonical, lsal,
>
>
>> In this case, it seems to me that the API must be a bad one.
>
>
> Yes, that API extension was a horribly implemented (quick and dirty), but
> create_breakpoint is a bit of a mess, since it not only has to deal with
> setting breakpoints (of various varieties), it also has to deal with parsing
> user input. I'm not a fan of this (too common) paradigm.
>
And if we want add comments on this function to let people don't do
that. We need also tell they, the pending breakpoints's extra_string
will be dropped.
>
>> Can't we just tell callers, "don't do that"?
>> To me it seems like a pathological case.
>
>
> We can certainly enforce this, as my patchlet above demonstrates:
>
>
> -break-insert -c "argc > 1" "main if argc > 2"
> ^error,msg="Garbage 'if argc > 2' at end of command"
>
> Keith
next prev parent reply other threads:[~2013-03-26 1:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-24 12:05 Hui Zhu
2013-03-25 0:53 ` Keith Seitz
2013-03-25 7:54 ` Hui Zhu
2013-03-25 16:14 ` Yao Qi
2013-03-25 16:27 ` Hui Zhu
2013-03-25 19:32 ` Tom Tromey
2013-03-25 19:58 ` Keith Seitz
2013-03-26 11:16 ` Hui Zhu [this message]
2013-04-05 19:18 ` Pedro Alves
2013-04-08 7:56 ` Keith Seitz
2013-04-08 17:54 ` Pedro Alves
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='CANFwon3shfEZpAiMRL8fDNEbHTm=ty=xXKCE1xBzX_BpGudyOw@mail.gmail.com' \
--to=teawater@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=hui_zhu@mentor.com \
--cc=keiths@redhat.com \
--cc=tromey@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