Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/gdb/ChangeLog b/gdb/ChangeLog
- index 674817cc1b64..87f366c4b683 100644
- --- a/gdb/ChangeLog
- +++ b/gdb/ChangeLog
- @@ -1,3 +1,10 @@
- +2021-05-06 Tankut Baris Aktemur <[email protected]>
- +
- + * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Recognize the
- + '--force-condition' flag to force the condition in the
- + '-break-insert' and '-dprintf-insert' commands.
- + * NEWS: Mention the change.
- +
- 2021-05-04 Tom de Vries <[email protected]>
- PR guile/27806
- diff --git a/gdb/NEWS b/gdb/NEWS
- index 19cb444e7fe8..a814b41315dd 100644
- --- a/gdb/NEWS
- +++ b/gdb/NEWS
- @@ -31,6 +31,14 @@
- equivalent of the CLI's "break -qualified" and "dprintf
- -qualified".
- + ** '-break-insert --force-condition' and '-dprintf-insert --force-condition'
- +
- + The MI -break-insert and -dprintf-insert commands now support a
- + '--force-condition' flag to forcibly define a condition even when
- + the condition is invalid at all locations of the breakpoint. This
- + is equivalent to the '-force-condition' flag of the CLI's "break"
- + command.
- +
- * GDB now supports core file debugging for x86_64 Cygwin programs.
- * GDB will now look for the .gdbinit file in a config directory before
- diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
- index ec961d232d1c..85c09900185a 100644
- --- a/gdb/doc/ChangeLog
- +++ b/gdb/doc/ChangeLog
- @@ -1,3 +1,9 @@
- +2021-05-06 Tankut Baris Aktemur <[email protected]>
- +
- + * gdb.texinfo (GDB/MI Breakpoint Commands): Mention the
- + '--force-condition' flag of the '-break-insert' and
- + '-dprintf-insert' commands.
- +
- 2021-05-04 Simon Marchi <[email protected]>
- * python.texi (Types In Python): Re-organize Type.fields doc.
- diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
- index 802d0f9cfb64..b7667f7d11e7 100644
- --- a/gdb/doc/gdb.texinfo
- +++ b/gdb/doc/gdb.texinfo
- @@ -30704,7 +30704,7 @@ N.A.
- @smallexample
- -break-insert [ -t ] [ -h ] [ -f ] [ -d ] [ -a ] [ --qualified ]
- - [ -c @var{condition} ] [ -i @var{ignore-count} ]
- + [ -c @var{condition} ] [ --force-condition ] [ -i @var{ignore-count} ]
- [ -p @var{thread-id} ] [ @var{location} ]
- @end smallexample
- @@ -30760,6 +30760,9 @@ Create a tracepoint. @xref{Tracepoints}. When this parameter
- is used together with @samp{-h}, a fast tracepoint is created.
- @item -c @var{condition}
- Make the breakpoint conditional on @var{condition}.
- +@item --force-condition
- +Forcibly define the breakpoint even if the condition is invalid at
- +all of the breakpoint locations.
- @item -i @var{ignore-count}
- Initialize the @var{ignore-count}.
- @item -p @var{thread-id}
- @@ -30829,7 +30832,7 @@ times="0"@}]@}
- @smallexample
- -dprintf-insert [ -t ] [ -f ] [ -d ] [ --qualified ]
- - [ -c @var{condition} ] [ -i @var{ignore-count} ]
- + [ -c @var{condition} ] [--force-condition] [ -i @var{ignore-count} ]
- [ -p @var{thread-id} ] [ @var{location} ] [ @var{format} ]
- [ @var{argument} ]
- @end smallexample
- @@ -30854,6 +30857,9 @@ cannot be parsed.
- Create a disabled breakpoint.
- @item -c @var{condition}
- Make the breakpoint conditional on @var{condition}.
- +@item --force-condition
- +Forcibly define the breakpoint even if the condition is invalid at
- +all of the breakpoint locations.
- @item -i @var{ignore-count}
- Set the ignore count of the breakpoint (@pxref{Conditions, ignore count})
- to @var{ignore-count}.
- diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
- index 1b7eaf5e28ff..be7bd8f7810a 100644
- --- a/gdb/mi/mi-cmd-break.c
- +++ b/gdb/mi/mi-cmd-break.c
- @@ -184,33 +184,41 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
- int is_explicit = 0;
- struct explicit_location explicit_loc;
- std::string extra_string;
- + bool force_condition = false;
- enum opt
- - {
- - HARDWARE_OPT, TEMP_OPT, CONDITION_OPT,
- - IGNORE_COUNT_OPT, THREAD_OPT, PENDING_OPT, DISABLE_OPT,
- - TRACEPOINT_OPT,
- - QUALIFIED_OPT,
- - EXPLICIT_SOURCE_OPT, EXPLICIT_FUNC_OPT,
- - EXPLICIT_LABEL_OPT, EXPLICIT_LINE_OPT
- - };
- - static const struct mi_opt opts[] =
- {
- - {"h", HARDWARE_OPT, 0},
- - {"t", TEMP_OPT, 0},
- - {"c", CONDITION_OPT, 1},
- - {"i", IGNORE_COUNT_OPT, 1},
- - {"p", THREAD_OPT, 1},
- - {"f", PENDING_OPT, 0},
- - {"d", DISABLE_OPT, 0},
- - {"a", TRACEPOINT_OPT, 0},
- - {"-qualified", QUALIFIED_OPT, 0},
- - {"-source" , EXPLICIT_SOURCE_OPT, 1},
- - {"-function", EXPLICIT_FUNC_OPT, 1},
- - {"-label", EXPLICIT_LABEL_OPT, 1},
- - {"-line", EXPLICIT_LINE_OPT, 1},
- - { 0, 0, 0 }
- + HARDWARE_OPT,
- + TEMP_OPT,
- + CONDITION_OPT,
- + IGNORE_COUNT_OPT,
- + THREAD_OPT,
- + PENDING_OPT,
- + DISABLE_OPT,
- + TRACEPOINT_OPT,
- + FORCE_CONDITION_OPT,
- + QUALIFIED_OPT,
- + EXPLICIT_SOURCE_OPT,
- + EXPLICIT_FUNC_OPT,
- + EXPLICIT_LABEL_OPT,
- + EXPLICIT_LINE_OPT
- };
- + static const struct mi_opt opts[]
- + = { { "h", HARDWARE_OPT, 0 },
- + { "t", TEMP_OPT, 0 },
- + { "c", CONDITION_OPT, 1 },
- + { "i", IGNORE_COUNT_OPT, 1 },
- + { "p", THREAD_OPT, 1 },
- + { "f", PENDING_OPT, 0 },
- + { "d", DISABLE_OPT, 0 },
- + { "a", TRACEPOINT_OPT, 0 },
- + { "-force-condition", FORCE_CONDITION_OPT, 0 },
- + { "-qualified", QUALIFIED_OPT, 0 },
- + { "-source", EXPLICIT_SOURCE_OPT, 1 },
- + { "-function", EXPLICIT_FUNC_OPT, 1 },
- + { "-label", EXPLICIT_LABEL_OPT, 1 },
- + { "-line", EXPLICIT_LINE_OPT, 1 },
- + { 0, 0, 0 } };
- /* Parse arguments. It could be -r or -h or -t, <location> or ``--''
- to denote the end of the option list. */
- @@ -270,6 +278,9 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
- is_explicit = 1;
- explicit_loc.line_offset = linespec_parse_line_offset (oarg);
- break;
- + case FORCE_CONDITION_OPT:
- + force_condition = true;
- + break;
- }
- }
- @@ -353,13 +364,11 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
- }
- create_breakpoint (get_current_arch (), location.get (), condition, thread,
- - extra_string.c_str (),
- - false,
- - 0 /* condition and thread are valid. */,
- - temp_p, type_wanted,
- - ignore_count,
- - pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE,
- - ops, 0, enabled, 0, 0);
- + extra_string.c_str (), force_condition,
- + 0 /* condition and thread are valid. */, temp_p,
- + type_wanted, ignore_count,
- + pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE, ops, 0,
- + enabled, 0, 0);
- }
- /* Implements the -break-insert command.
- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
- index c84f1168cf57..7de5a0d49879 100644
- --- a/gdb/testsuite/ChangeLog
- +++ b/gdb/testsuite/ChangeLog
- @@ -1,3 +1,8 @@
- +2021-05-06 Tankut Baris Aktemur <[email protected]>
- +
- + * gdb.mi/mi-break.exp (test_forced_conditions): New proc that
- + is called by the test.
- +
- 2021-05-05 Tom de Vries <[email protected]>
- * gdb.threads/detach-step-over.exp: Do exp_continue when encountering
- diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
- index b2db2d41d1fc..3b264ecdebd2 100644
- --- a/gdb/testsuite/gdb.mi/mi-break.exp
- +++ b/gdb/testsuite/gdb.mi/mi-break.exp
- @@ -408,6 +408,24 @@ proc_with_prefix test_explicit_breakpoints {} {
- ".*Source filename requires function, label, or line offset.*"
- }
- +# Test forcing an invalid condition.
- +
- +proc_with_prefix test_forced_conditions {} {
- + set warning ".*warning: failed to validate condition .* disabling.*"
- +
- + set loc [mi_make_breakpoint_loc -enabled "N"]
- + set args [list -cond "bad" -locations "\\\[$loc\\\]"]
- + set bp [eval mi_make_breakpoint_multi $args]
- +
- + mi_gdb_test "-break-insert -c bad --force-condition callme" \
- + "${warning}\\^done,$bp" \
- + "breakpoint with forced condition"
- +
- + mi_gdb_test "-dprintf-insert -c bad --force-condition callme \"Hello\"" \
- + "${warning}\\^done,$bp" \
- + "dprintf with forced condition"
- +}
- +
- proc test_break {mi_mode} {
- global srcdir subdir binfile
- @@ -440,6 +458,8 @@ proc test_break {mi_mode} {
- test_abreak_creation
- test_explicit_breakpoints
- +
- + test_forced_conditions
- }
- if [gdb_debug_enabled] {
- --
- 2.30.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement