From: Enze Li <lienze2010@hotmail.com>
To: Pedro Alves <pedro@palves.net>, tom@tromey.com
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v3] gdb: fix using clear command to delete non-user breakpoints(PR cli/7161)
Date: Tue, 19 Apr 2022 22:07:03 +0800 [thread overview]
Message-ID: <MEAP282MB029307AD5CC6CF2093437D00DDF29@MEAP282MB0293.AUSP282.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <2350d4f9-0f69-48a2-4291-dee5743e6614@palves.net>
Hi Pedro,
Thank you for the review.
On Mon, 2022-04-18 at 17:04 +0100, Pedro Alves wrote:
> On 2022-04-16 04:42, Enze Li via Gdb-patches wrote:
>
>
<snip>
> > +proc get_maint_info_bp { var } {
> > + global expect_out
> > + global gdb_prompt
> > +
> > + gdb_test_multiple "maint info break -1" "find address of
> > internal bp $var" {
> > + -re ".*(0x\[0-9a-f\]+).*$gdb_prompt $" {
> > + return $expect_out(1,string)
> > + }
> > + timeout {
> > + perror "couldn't find address of $var"
> > + return ""
> > + }
>
> You shouldn't need a timeout match, gdb_test_multiple already has one
> internally.
Fixed.
>
> > + }
> > + return ""
> > +}
> > +
> > +standard_testfile .c
> > +
> > +# this testcase just needs a "Hello world" source file, reuse
>
> Uppercase "this" -> "This".
>
Fixed.
> > +# gdb.server/sysroot.c instead of adding a new one.
> > +if { [gdb_compile "${srcdir}/gdb.server/sysroot.c" "${binfile}"
> > executable {debug}] != "" } {
> > + untested "failed to compile"
> > + return -1
> > +}
> > +
> > +# Start with a fresh gdb.
> > +clean_restart ${binfile}
> > +
> > +if ![runto_main] then {
> > + return 0
> > +}
> > +
> > +gdb_test "break sysroot.c:23" \
> > + ".*Breakpoint.* at .*" \
> > + "set breakpoint"
> > +
> > +set bp_addr [get_maint_info_bp "-1"]
> > +
>
> It's not portable to assume that breakpoint -1 is the shlib_events
> breakpoint.
> Some targets don't even use such a breakpoint. E.g., Windows. It
> would be
> better to instead make get_maint_info_bp look for the first internal
> breakpoint and
> return its number.
>
Thanks, this helps me a lot.
> > +gdb_test "maint info break -1" \
> > + "-1.*shlib events.*keep y.*$bp_addr.*" \
> > + "maint info breakpoint -1 error"
>
> Why is this test called "... error" ?
Drop the word "error"? Done.
> > +
> > +gdb_test "clear *$bp_addr" \
> > + "No breakpoint at \\*$bp_addr." \
> > + "clear internal breakpoint error"
> > +
>
> It would be good to issue the "maint info break" command again after
> the clear,
> to make sure that GDB really didn't delete the breakpoint, even if
> the clear command
> errored out.
Fixed.
>
> Not a strong requirement, but it would be great if we also had a test
> trying to clear an internal
> python breakpoint. Did you look into adding that? If it's too
> complicated to add it here or to
> a new file, maybe add a "clear" test to gdb.python/py-breakpoint.exp
> ?
If this is a requirement, I'd like to implement it. Is this something
that can be done later?
I've sent a fix patch to the gdb-patch@list and I posted it here:
https://sourceware.org/pipermail/gdb-patches/2022-April/188044.html
Thanks,
Enze
next prev parent reply other threads:[~2022-04-19 14:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220314122406.24889-1-lienze2010@hotmail.com>
2022-03-17 14:24 ` [PATCH v2] " Enze Li
2022-03-23 14:25 ` Enze Li
2022-04-14 5:58 ` [PING^2][PATCH " Enze Li
2022-04-15 16:41 ` [PATCH " Tom Tromey
2022-04-16 3:42 ` [PATCH v3] " Enze Li
2022-04-17 21:26 ` Tom Tromey
2022-04-18 16:04 ` Pedro Alves
2022-04-19 14:07 ` Enze Li [this message]
2022-04-22 15:01 ` Pedro Alves
2022-04-18 16:12 ` Tom Tromey
2022-04-19 2:10 ` Enze Li
2022-04-19 3:26 ` Tom Tromey
2022-04-18 23:49 ` Simon Marchi
2022-04-19 3:37 ` Simon Marchi
2022-04-19 13:32 ` Enze Li
2022-04-17 7:18 ` [PATCH RESEND " Enze Li
2022-04-17 22:29 ` Lancelot SIX
2022-04-21 14:29 ` Enze Li
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=MEAP282MB029307AD5CC6CF2093437D00DDF29@MEAP282MB0293.AUSP282.PROD.OUTLOOK.COM \
--to=lienze2010@hotmail.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@palves.net \
--cc=tom@tromey.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).