Advertisement
Guest User

Untitled

a guest
May 10th, 2021
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 8.15 KB | None | 0 0
  1. diff --git a/gdb/ChangeLog b/gdb/ChangeLog
  2. index 674817cc1b64..87f366c4b683 100644
  3. --- a/gdb/ChangeLog
  4. +++ b/gdb/ChangeLog
  5. @@ -1,3 +1,10 @@
  6. +2021-05-06  Tankut Baris Aktemur  <[email protected]>
  7. +
  8. +   * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Recognize the
  9. +   '--force-condition' flag to force the condition in the
  10. +   '-break-insert' and '-dprintf-insert' commands.
  11. +   * NEWS: Mention the change.
  12. +
  13.  2021-05-04  Tom de Vries  <[email protected]>
  14.  
  15.     PR guile/27806
  16. diff --git a/gdb/NEWS b/gdb/NEWS
  17. index 19cb444e7fe8..a814b41315dd 100644
  18. --- a/gdb/NEWS
  19. +++ b/gdb/NEWS
  20. @@ -31,6 +31,14 @@
  21.      equivalent of the CLI's "break -qualified" and "dprintf
  22.      -qualified".
  23.  
  24. + ** '-break-insert --force-condition' and '-dprintf-insert --force-condition'
  25. +
  26. +    The MI -break-insert and -dprintf-insert commands now support a
  27. +    '--force-condition' flag to forcibly define a condition even when
  28. +    the condition is invalid at all locations of the breakpoint.  This
  29. +    is equivalent to the '-force-condition' flag of the CLI's "break"
  30. +    command.
  31. +
  32.  * GDB now supports core file debugging for x86_64 Cygwin programs.
  33.  
  34.  * GDB will now look for the .gdbinit file in a config directory before
  35. diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
  36. index ec961d232d1c..85c09900185a 100644
  37. --- a/gdb/doc/ChangeLog
  38. +++ b/gdb/doc/ChangeLog
  39. @@ -1,3 +1,9 @@
  40. +2021-05-06  Tankut Baris Aktemur  <[email protected]>
  41. +
  42. +   * gdb.texinfo (GDB/MI Breakpoint Commands): Mention the
  43. +   '--force-condition' flag of the '-break-insert' and
  44. +   '-dprintf-insert' commands.
  45. +
  46.  2021-05-04  Simon Marchi  <[email protected]>
  47.  
  48.     * python.texi (Types In Python): Re-organize Type.fields doc.
  49. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
  50. index 802d0f9cfb64..b7667f7d11e7 100644
  51. --- a/gdb/doc/gdb.texinfo
  52. +++ b/gdb/doc/gdb.texinfo
  53. @@ -30704,7 +30704,7 @@ N.A.
  54.  
  55.  @smallexample
  56.   -break-insert [ -t ] [ -h ] [ -f ] [ -d ] [ -a ] [ --qualified ]
  57. -    [ -c @var{condition} ] [ -i @var{ignore-count} ]
  58. +    [ -c @var{condition} ] [ --force-condition ] [ -i @var{ignore-count} ]
  59.      [ -p @var{thread-id} ] [ @var{location} ]
  60.  @end smallexample
  61.  
  62. @@ -30760,6 +30760,9 @@ Create a tracepoint.  @xref{Tracepoints}.  When this parameter
  63.  is used together with @samp{-h}, a fast tracepoint is created.
  64.  @item -c @var{condition}
  65.  Make the breakpoint conditional on @var{condition}.
  66. +@item --force-condition
  67. +Forcibly define the breakpoint even if the condition is invalid at
  68. +all of the breakpoint locations.
  69.  @item -i @var{ignore-count}
  70.  Initialize the @var{ignore-count}.
  71.  @item -p @var{thread-id}
  72. @@ -30829,7 +30832,7 @@ times="0"@}]@}
  73.  
  74.  @smallexample
  75.   -dprintf-insert [ -t ] [ -f ] [ -d ] [ --qualified ]
  76. -    [ -c @var{condition} ] [ -i @var{ignore-count} ]
  77. +    [ -c @var{condition} ] [--force-condition] [ -i @var{ignore-count} ]
  78.      [ -p @var{thread-id} ] [ @var{location} ] [ @var{format} ]
  79.      [ @var{argument} ]
  80.  @end smallexample
  81. @@ -30854,6 +30857,9 @@ cannot be parsed.
  82.  Create a disabled breakpoint.
  83.  @item -c @var{condition}
  84.  Make the breakpoint conditional on @var{condition}.
  85. +@item --force-condition
  86. +Forcibly define the breakpoint even if the condition is invalid at
  87. +all of the breakpoint locations.
  88.  @item -i @var{ignore-count}
  89.  Set the ignore count of the breakpoint (@pxref{Conditions, ignore count})
  90.  to @var{ignore-count}.
  91. diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
  92. index 1b7eaf5e28ff..be7bd8f7810a 100644
  93. --- a/gdb/mi/mi-cmd-break.c
  94. +++ b/gdb/mi/mi-cmd-break.c
  95. @@ -184,33 +184,41 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
  96.    int is_explicit = 0;
  97.    struct explicit_location explicit_loc;
  98.    std::string extra_string;
  99. +  bool force_condition = false;
  100.  
  101.    enum opt
  102. -    {
  103. -      HARDWARE_OPT, TEMP_OPT, CONDITION_OPT,
  104. -      IGNORE_COUNT_OPT, THREAD_OPT, PENDING_OPT, DISABLE_OPT,
  105. -      TRACEPOINT_OPT,
  106. -      QUALIFIED_OPT,
  107. -      EXPLICIT_SOURCE_OPT, EXPLICIT_FUNC_OPT,
  108. -      EXPLICIT_LABEL_OPT, EXPLICIT_LINE_OPT
  109. -    };
  110. -  static const struct mi_opt opts[] =
  111.    {
  112. -    {"h", HARDWARE_OPT, 0},
  113. -    {"t", TEMP_OPT, 0},
  114. -    {"c", CONDITION_OPT, 1},
  115. -    {"i", IGNORE_COUNT_OPT, 1},
  116. -    {"p", THREAD_OPT, 1},
  117. -    {"f", PENDING_OPT, 0},
  118. -    {"d", DISABLE_OPT, 0},
  119. -    {"a", TRACEPOINT_OPT, 0},
  120. -    {"-qualified", QUALIFIED_OPT, 0},
  121. -    {"-source" , EXPLICIT_SOURCE_OPT, 1},
  122. -    {"-function", EXPLICIT_FUNC_OPT, 1},
  123. -    {"-label", EXPLICIT_LABEL_OPT, 1},
  124. -    {"-line", EXPLICIT_LINE_OPT, 1},
  125. -    { 0, 0, 0 }
  126. +    HARDWARE_OPT,
  127. +    TEMP_OPT,
  128. +    CONDITION_OPT,
  129. +    IGNORE_COUNT_OPT,
  130. +    THREAD_OPT,
  131. +    PENDING_OPT,
  132. +    DISABLE_OPT,
  133. +    TRACEPOINT_OPT,
  134. +    FORCE_CONDITION_OPT,
  135. +    QUALIFIED_OPT,
  136. +    EXPLICIT_SOURCE_OPT,
  137. +    EXPLICIT_FUNC_OPT,
  138. +    EXPLICIT_LABEL_OPT,
  139. +    EXPLICIT_LINE_OPT
  140.    };
  141. +  static const struct mi_opt opts[]
  142. +    = { { "h", HARDWARE_OPT, 0 },
  143. +   { "t", TEMP_OPT, 0 },
  144. +   { "c", CONDITION_OPT, 1 },
  145. +   { "i", IGNORE_COUNT_OPT, 1 },
  146. +   { "p", THREAD_OPT, 1 },
  147. +   { "f", PENDING_OPT, 0 },
  148. +   { "d", DISABLE_OPT, 0 },
  149. +   { "a", TRACEPOINT_OPT, 0 },
  150. +   { "-force-condition", FORCE_CONDITION_OPT, 0 },
  151. +   { "-qualified", QUALIFIED_OPT, 0 },
  152. +   { "-source", EXPLICIT_SOURCE_OPT, 1 },
  153. +   { "-function", EXPLICIT_FUNC_OPT, 1 },
  154. +   { "-label", EXPLICIT_LABEL_OPT, 1 },
  155. +   { "-line", EXPLICIT_LINE_OPT, 1 },
  156. +   { 0, 0, 0 } };
  157.  
  158.    /* Parse arguments. It could be -r or -h or -t, <location> or ``--''
  159.       to denote the end of the option list. */
  160. @@ -270,6 +278,9 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
  161.       is_explicit = 1;
  162.       explicit_loc.line_offset = linespec_parse_line_offset (oarg);
  163.       break;
  164. +   case FORCE_CONDITION_OPT:
  165. +     force_condition = true;
  166. +     break;
  167.     }
  168.      }
  169.  
  170. @@ -353,13 +364,11 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
  171.      }
  172.  
  173.    create_breakpoint (get_current_arch (), location.get (), condition, thread,
  174. -            extra_string.c_str (),
  175. -            false,
  176. -            0 /* condition and thread are valid.  */,
  177. -            temp_p, type_wanted,
  178. -            ignore_count,
  179. -            pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE,
  180. -            ops, 0, enabled, 0, 0);
  181. +            extra_string.c_str (), force_condition,
  182. +            0 /* condition and thread are valid.  */, temp_p,
  183. +            type_wanted, ignore_count,
  184. +            pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE, ops, 0,
  185. +            enabled, 0, 0);
  186.  }
  187.  
  188.  /* Implements the -break-insert command.
  189. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
  190. index c84f1168cf57..7de5a0d49879 100644
  191. --- a/gdb/testsuite/ChangeLog
  192. +++ b/gdb/testsuite/ChangeLog
  193. @@ -1,3 +1,8 @@
  194. +2021-05-06  Tankut Baris Aktemur  <[email protected]>
  195. +
  196. +   * gdb.mi/mi-break.exp (test_forced_conditions): New proc that
  197. +   is called by the test.
  198. +
  199.  2021-05-05  Tom de Vries  <[email protected]>
  200.  
  201.     * gdb.threads/detach-step-over.exp: Do exp_continue when encountering
  202. diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
  203. index b2db2d41d1fc..3b264ecdebd2 100644
  204. --- a/gdb/testsuite/gdb.mi/mi-break.exp
  205. +++ b/gdb/testsuite/gdb.mi/mi-break.exp
  206. @@ -408,6 +408,24 @@ proc_with_prefix test_explicit_breakpoints {} {
  207.     ".*Source filename requires function, label, or line offset.*"
  208.  }
  209.  
  210. +# Test forcing an invalid condition.
  211. +
  212. +proc_with_prefix test_forced_conditions {} {
  213. +    set warning ".*warning: failed to validate condition .* disabling.*"
  214. +
  215. +    set loc [mi_make_breakpoint_loc -enabled "N"]
  216. +    set args [list -cond "bad" -locations "\\\[$loc\\\]"]
  217. +    set bp [eval mi_make_breakpoint_multi $args]
  218. +
  219. +    mi_gdb_test "-break-insert -c bad --force-condition callme" \
  220. +   "${warning}\\^done,$bp" \
  221. +   "breakpoint with forced condition"
  222. +
  223. +    mi_gdb_test "-dprintf-insert -c bad --force-condition callme \"Hello\"" \
  224. +        "${warning}\\^done,$bp" \
  225. +        "dprintf with forced condition"
  226. +}
  227. +
  228.  proc test_break {mi_mode} {
  229.      global srcdir subdir binfile
  230.  
  231. @@ -440,6 +458,8 @@ proc test_break {mi_mode} {
  232.      test_abreak_creation
  233.  
  234.      test_explicit_breakpoints
  235. +
  236. +    test_forced_conditions
  237.  }
  238.  
  239.  if [gdb_debug_enabled] {
  240. --
  241. 2.30.1
  242.  
  243.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement