RE: [PATCH 3/4] gdb/breakpoint: add a 'force_condition' parameter to 'create_breakpoint'

Aktemur, Tankut Baris via Gdb-patches
2021-04-08T07:45:11Z

On Thursday, April 8, 2021 12:09 AM, Simon Marchi wrote:
> On 2021-04-07 10:55 a.m., Tankut Baris Aktemur via Gdb-patches wrote:
> > diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
> > index 9d3d7ade6dc..ac13e4d1e09 100644
> > --- a/gdb/testsuite/gdb.mi/mi-break.exp
> > +++ b/gdb/testsuite/gdb.mi/mi-break.exp
> > @@ -224,6 +224,19 @@ proc test_error {} {
> > mi_gdb_test "-break-insert -c i==4 \"callme if i < 4\"" \
> > ".*\\^error,msg=\"Garbage 'if i < 4' at end of location\"" \
> > "conditional breakpoint with garbage after location"
> > +
> > + # Try using an invalid condition.
> > + mi_gdb_test "-break-insert -c bad callme" \
> > + ".*\\^error,msg=\"No symbol \\\\\"bad\\\\\" in current context.\"" \
> > + "breakpoint with bad condition"
> > +
> > + mi_gdb_test "-dprintf-insert -c bad callme 123" \
> > + ".*\\^error,msg=\"No symbol \\\\\"bad\\\\\" in current context.\"" \
> > + "dprintf with bad condition"
> > +
> > + mi_gdb_test "-break-condition 5 bad" \
> > + ".*\\^error,msg=\"No symbol \\\\\"bad\\\\\" in current context.\"" \
> > + "invalid condition"
>
> Here, does the 5 refer to an existing breakpoint number created by
> another test function? It's a bit annoying when test functions rely on
> the state left by other test functions, that makes them harder to debug
> in isolation. In my ideal world, each test_* function in this file
> (except test_break, which is just the driver) would spawn a fresh GDB,
> such that if you need to debug one of them, you can comment out all the
> other ones.

Ack. The other test functions also refer to hardcoded breakpoint numbers.
Fiddling with the breakpoint list by deleting/adding new breakpoints
caused the other tests to fail, and thus I simply opted for the easier
solution of hardcoding.

> The patch is still OK though, and thanks for taking the time to write a
> test.
>
> Simon

Thanks.
-Baris

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928