testsuite, threads: fix LD_LIBRARY_PATH in 'tls-sepdebug.exp'
[binutils-gdb.git] / gdb / breakpoint.h
blobcef1d727ed256eed919914646e40a2fa06715ec8
1 /* Data structures associated with breakpoints in GDB.
2 Copyright (C) 1992-2024 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #if !defined (BREAKPOINT_H)
20 #define BREAKPOINT_H 1
22 #include "frame.h"
23 #include "value.h"
24 #include "ax.h"
25 #include "command.h"
26 #include "gdbsupport/break-common.h"
27 #include "probe.h"
28 #include "location.h"
29 #include <vector>
30 #include "gdbsupport/array-view.h"
31 #include "gdbsupport/filtered-iterator.h"
32 #include "gdbsupport/iterator-range.h"
33 #include "gdbsupport/refcounted-object.h"
34 #include "gdbsupport/safe-iterator.h"
35 #include "cli/cli-script.h"
36 #include "target/waitstatus.h"
38 struct block;
39 struct gdbpy_breakpoint_object;
40 struct gdbscm_breakpoint_object;
41 struct number_or_range_parser;
42 struct thread_info;
43 struct bpstat;
44 struct bp_location;
45 struct linespec_result;
46 struct linespec_sals;
47 struct inferior;
49 /* True if breakpoint debug output is enabled. */
50 extern bool debug_breakpoint;
52 /* Print a "breakpoint" debug statement. */
53 #define breakpoint_debug_printf(fmt, ...) \
54 debug_prefixed_printf_cond (debug_breakpoint, "breakpoint", fmt, \
55 ##__VA_ARGS__)
57 /* Enum for exception-handling support in 'catch throw', 'catch rethrow',
58 'catch catch' and the MI equivalent. */
60 enum exception_event_kind
62 EX_EVENT_THROW,
63 EX_EVENT_RETHROW,
64 EX_EVENT_CATCH
67 /* Why are we removing the breakpoint from the target? */
69 enum remove_bp_reason
71 /* A regular remove. Remove the breakpoint and forget everything
72 about it. */
73 REMOVE_BREAKPOINT,
75 /* Detach the breakpoints from a fork child. */
76 DETACH_BREAKPOINT,
79 /* This is the maximum number of bytes a breakpoint instruction can
80 take. Feel free to increase it. It's just used in a few places to
81 size arrays that should be independent of the target
82 architecture. */
84 #define BREAKPOINT_MAX 16
87 /* Type of breakpoint. */
89 enum bptype
91 bp_none = 0, /* Eventpoint has been deleted */
92 bp_breakpoint, /* Normal breakpoint */
93 bp_hardware_breakpoint, /* Hardware assisted breakpoint */
94 bp_single_step, /* Software single-step */
95 bp_until, /* used by until command */
96 bp_finish, /* used by finish command */
97 bp_watchpoint, /* Watchpoint */
98 bp_hardware_watchpoint, /* Hardware assisted watchpoint */
99 bp_read_watchpoint, /* read watchpoint, (hardware assisted) */
100 bp_access_watchpoint, /* access watchpoint, (hardware assisted) */
101 bp_longjmp, /* secret breakpoint to find longjmp() */
102 bp_longjmp_resume, /* secret breakpoint to escape longjmp() */
104 /* Breakpoint placed to the same location(s) like bp_longjmp but used to
105 protect against stale DUMMY_FRAME. Multiple bp_longjmp_call_dummy and
106 one bp_call_dummy are chained together by related_breakpoint for each
107 DUMMY_FRAME. */
108 bp_longjmp_call_dummy,
110 /* An internal breakpoint that is installed on the unwinder's
111 debug hook. */
112 bp_exception,
113 /* An internal breakpoint that is set at the point where an
114 exception will land. */
115 bp_exception_resume,
117 /* Used by wait_for_inferior for stepping over subroutine calls,
118 and for skipping prologues. */
119 bp_step_resume,
121 /* Used by wait_for_inferior for stepping over signal
122 handlers. */
123 bp_hp_step_resume,
125 /* Used to detect when a watchpoint expression has gone out of
126 scope. These breakpoints are usually not visible to the user.
128 This breakpoint has some interesting properties:
130 1) There's always a 1:1 mapping between watchpoints
131 on local variables and watchpoint_scope breakpoints.
133 2) It automatically deletes itself and the watchpoint it's
134 associated with when hit.
136 3) It can never be disabled. */
137 bp_watchpoint_scope,
139 /* The breakpoint at the end of a call dummy. See bp_longjmp_call_dummy it
140 is chained with by related_breakpoint. */
141 bp_call_dummy,
143 /* A breakpoint set on std::terminate, that is used to catch
144 otherwise uncaught exceptions thrown during an inferior call. */
145 bp_std_terminate,
147 /* Some dynamic linkers (HP, maybe Solaris) can arrange for special
148 code in the inferior to run when significant events occur in the
149 dynamic linker (for example a library is loaded or unloaded).
151 By placing a breakpoint in this magic code GDB will get control
152 when these significant events occur. GDB can then re-examine
153 the dynamic linker's data structures to discover any newly loaded
154 dynamic libraries. */
155 bp_shlib_event,
157 /* Some multi-threaded systems can arrange for a location in the
158 inferior to be executed when certain thread-related events occur
159 (such as thread creation or thread death).
161 By placing a breakpoint at one of these locations, GDB will get
162 control when these events occur. GDB can then update its thread
163 lists etc. */
165 bp_thread_event,
167 /* On the same principal, an overlay manager can arrange to call a
168 magic location in the inferior whenever there is an interesting
169 change in overlay status. GDB can update its overlay tables
170 and fiddle with breakpoints in overlays when this breakpoint
171 is hit. */
173 bp_overlay_event,
175 /* Master copies of longjmp breakpoints. These are always installed
176 as soon as an objfile containing longjmp is loaded, but they are
177 always disabled. While necessary, temporary clones of bp_longjmp
178 type will be created and enabled. */
180 bp_longjmp_master,
182 /* Master copies of std::terminate breakpoints. */
183 bp_std_terminate_master,
185 /* Like bp_longjmp_master, but for exceptions. */
186 bp_exception_master,
188 bp_catchpoint,
190 bp_tracepoint,
191 bp_fast_tracepoint,
192 bp_static_tracepoint,
193 /* Like bp_static_tracepoint but for static markers. */
194 bp_static_marker_tracepoint,
196 /* A dynamic printf stops at the given location, does a formatted
197 print, then automatically continues. (Although this is sort of
198 like a macro packaging up standard breakpoint functionality,
199 GDB doesn't have a way to construct types of breakpoint from
200 elements of behavior.) */
201 bp_dprintf,
203 /* Event for JIT compiled code generation or deletion. */
204 bp_jit_event,
206 /* Breakpoint is placed at the STT_GNU_IFUNC resolver. When hit GDB
207 inserts new bp_gnu_ifunc_resolver_return at the caller.
208 bp_gnu_ifunc_resolver is still being kept here as a different thread
209 may still hit it before bp_gnu_ifunc_resolver_return is hit by the
210 original thread. */
211 bp_gnu_ifunc_resolver,
213 /* On its hit GDB now know the resolved address of the target
214 STT_GNU_IFUNC function. Associated bp_gnu_ifunc_resolver can be
215 deleted now and the breakpoint moved to the target function entry
216 point. */
217 bp_gnu_ifunc_resolver_return,
220 /* States of enablement of breakpoint. */
222 enum enable_state
224 bp_disabled, /* The eventpoint is inactive, and cannot
225 trigger. */
226 bp_enabled, /* The eventpoint is active, and can
227 trigger. */
228 bp_call_disabled, /* The eventpoint has been disabled while a
229 call into the inferior is "in flight",
230 because some eventpoints interfere with
231 the implementation of a call on some
232 targets. The eventpoint will be
233 automatically enabled and reset when the
234 call "lands" (either completes, or stops
235 at another eventpoint). */
239 /* Disposition of breakpoint. Ie: what to do after hitting it. */
241 enum bpdisp
243 disp_del, /* Delete it */
244 disp_del_at_next_stop, /* Delete at next stop,
245 whether hit or not */
246 disp_disable, /* Disable it */
247 disp_donttouch /* Leave it alone */
250 /* Status of breakpoint conditions used when synchronizing
251 conditions with the target. */
253 enum condition_status
255 condition_unchanged = 0,
256 condition_modified,
257 condition_updated
260 /* Information used by targets to insert and remove breakpoints. */
262 struct bp_target_info
264 /* Address space at which the breakpoint was placed. */
265 struct address_space *placed_address_space;
267 /* Address at which the breakpoint was placed. This is normally
268 the same as REQUESTED_ADDRESS, except when adjustment happens in
269 gdbarch_breakpoint_from_pc. The most common form of adjustment
270 is stripping an alternate ISA marker from the PC which is used
271 to determine the type of breakpoint to insert. */
272 CORE_ADDR placed_address;
274 /* Address at which the breakpoint was requested. */
275 CORE_ADDR reqstd_address;
277 /* If this is a ranged breakpoint, then this field contains the
278 length of the range that will be watched for execution. */
279 int length;
281 /* If the breakpoint lives in memory and reading that memory would
282 give back the breakpoint, instead of the original contents, then
283 the original contents are cached here. Only SHADOW_LEN bytes of
284 this buffer are valid, and only when the breakpoint is inserted. */
285 gdb_byte shadow_contents[BREAKPOINT_MAX];
287 /* The length of the data cached in SHADOW_CONTENTS. */
288 int shadow_len;
290 /* The breakpoint's kind. It is used in 'kind' parameter in Z
291 packets. */
292 int kind;
294 /* Conditions the target should evaluate if it supports target-side
295 breakpoint conditions. These are non-owning pointers. */
296 std::vector<agent_expr *> conditions;
298 /* Commands the target should evaluate if it supports target-side
299 breakpoint commands. These are non-owning pointers. */
300 std::vector<agent_expr *> tcommands;
302 /* Flag that is true if the breakpoint should be left in place even
303 when GDB is not connected. */
304 int persist;
307 /* GDB maintains two types of information about each breakpoint (or
308 watchpoint, or other related event). The first type corresponds
309 to struct breakpoint; this is a relatively high-level structure
310 which contains the source location(s), stopping conditions, user
311 commands to execute when the breakpoint is hit, and so forth.
313 The second type of information corresponds to struct bp_location.
314 Each breakpoint has one or (eventually) more locations associated
315 with it, which represent target-specific and machine-specific
316 mechanisms for stopping the program. For instance, a watchpoint
317 expression may require multiple hardware watchpoints in order to
318 catch all changes in the value of the expression being watched. */
320 enum bp_loc_type
322 bp_loc_software_breakpoint,
323 bp_loc_hardware_breakpoint,
324 bp_loc_software_watchpoint,
325 bp_loc_hardware_watchpoint,
326 bp_loc_tracepoint,
327 bp_loc_other /* Miscellaneous... */
330 class bp_location : public refcounted_object, public intrusive_list_node<bp_location>
332 public:
333 /* Construct a bp_location with the type inferred from OWNER's
334 type. */
335 explicit bp_location (breakpoint *owner);
337 /* Construct a bp_location with type TYPE. */
338 bp_location (breakpoint *owner, bp_loc_type type);
340 virtual ~bp_location () = default;
342 /* Type of this breakpoint location. */
343 bp_loc_type loc_type {};
345 /* Each breakpoint location must belong to exactly one higher-level
346 breakpoint. This pointer is NULL iff this bp_location is no
347 longer attached to a breakpoint. For example, when a breakpoint
348 is deleted, its locations may still be found in the
349 moribund_locations list, or if we had stopped for it, in
350 bpstats. */
351 breakpoint *owner = NULL;
353 /* Conditional. Break only if this expression's value is nonzero.
354 Unlike string form of condition, which is associated with
355 breakpoint, this is associated with location, since if breakpoint
356 has several locations, the evaluation of expression can be
357 different for different locations. Only valid for real
358 breakpoints; a watchpoint's conditional expression is stored in
359 the owner breakpoint object. */
360 expression_up cond;
362 /* Conditional expression in agent expression
363 bytecode form. This is used for stub-side breakpoint
364 condition evaluation. */
365 agent_expr_up cond_bytecode;
367 /* Signals that the condition has changed since the last time
368 we updated the global location list. This means the condition
369 needs to be sent to the target again. This is used together
370 with target-side breakpoint conditions.
372 condition_unchanged: It means there has been no condition changes.
374 condition_modified: It means this location had its condition modified.
376 condition_updated: It means we already marked all the locations that are
377 duplicates of this location and thus we don't need to call
378 force_breakpoint_reinsertion (...) for this location. */
380 condition_status condition_changed {};
382 agent_expr_up cmd_bytecode;
384 /* Signals that breakpoint conditions and/or commands need to be
385 re-synced with the target. This has no use other than
386 target-side breakpoints. */
387 bool needs_update = false;
389 /* This location's address is in an unloaded solib, and so this
390 location should not be inserted. It will be automatically
391 enabled when that solib is loaded. */
392 bool shlib_disabled = false;
394 /* Is this particular location enabled. */
395 bool enabled = false;
397 /* Is this particular location disabled because the condition
398 expression is invalid at this location. For a location to be
399 reported as enabled, the ENABLED field above has to be true *and*
400 the DISABLED_BY_COND field has to be false. */
401 bool disabled_by_cond = false;
403 /* True if this breakpoint is now inserted. */
404 bool inserted = false;
406 /* True if this is a permanent breakpoint. There is a breakpoint
407 instruction hard-wired into the target's code. Don't try to
408 write another breakpoint instruction on top of it, or restore its
409 value. Step over it using the architecture's
410 gdbarch_skip_permanent_breakpoint method. */
411 bool permanent = false;
413 /* True if this is not the first breakpoint in the list
414 for the given address. location of tracepoint can _never_
415 be duplicated with other locations of tracepoints and other
416 kinds of breakpoints, because two locations at the same
417 address may have different actions, so both of these locations
418 should be downloaded and so that `tfind N' always works. */
419 bool duplicate = false;
421 /* If we someday support real thread-specific breakpoints, then
422 the breakpoint location will need a thread identifier. */
424 /* Data for specific breakpoint types. These could be a union, but
425 simplicity is more important than memory usage for breakpoints. */
427 /* Architecture associated with this location's address. May be
428 different from the breakpoint architecture. */
429 struct gdbarch *gdbarch = NULL;
431 /* The program space associated with this breakpoint location
432 address. Note that an address space may be represented in more
433 than one program space (e.g. each uClinux program will be given
434 its own program space, but there will only be one address space
435 for all of them), but we must not insert more than one location
436 at the same address in the same address space. */
437 program_space *pspace = NULL;
439 /* Note that zero is a perfectly valid code address on some platforms
440 (for example, the mn10200 (OBSOLETE) and mn10300 simulators). NULL
441 is not a special value for this field. Valid for all types except
442 bp_loc_other. */
443 CORE_ADDR address = 0;
445 /* For hardware watchpoints, the size of the memory region being
446 watched. For hardware ranged breakpoints, the size of the
447 breakpoint range. */
448 int length = 0;
450 /* Type of hardware watchpoint. */
451 target_hw_bp_type watchpoint_type {};
453 /* For any breakpoint type with an address, this is the section
454 associated with the address. Used primarily for overlay
455 debugging. */
456 obj_section *section = NULL;
458 /* Address at which breakpoint was requested, either by the user or
459 by GDB for internal breakpoints. This will usually be the same
460 as ``address'' (above) except for cases in which
461 ADJUST_BREAKPOINT_ADDRESS has computed a different address at
462 which to place the breakpoint in order to comply with a
463 processor's architectural constraints. */
464 CORE_ADDR requested_address = 0;
466 /* An additional address assigned with this location. This is currently
467 only used by STT_GNU_IFUNC resolver breakpoints to hold the address
468 of the resolver function. */
469 CORE_ADDR related_address = 0;
471 /* If the location comes from a probe point, this is the probe associated
472 with it. */
473 bound_probe probe {};
475 gdb::unique_xmalloc_ptr<char> function_name;
477 /* Details of the placed breakpoint, when inserted. */
478 bp_target_info target_info {};
480 /* Similarly, for the breakpoint at an overlay's LMA, if necessary. */
481 bp_target_info overlay_target_info {};
483 /* In a non-stop mode, it's possible that we delete a breakpoint,
484 but as we do that, some still running thread hits that breakpoint.
485 For that reason, we need to keep locations belonging to deleted
486 breakpoints for a bit, so that don't report unexpected SIGTRAP.
487 We can't keep such locations forever, so we use a heuristic --
488 after we process certain number of inferior events since
489 breakpoint was deleted, we retire all locations of that breakpoint.
490 This variable keeps a number of events still to go, when
491 it becomes 0 this location is retired. */
492 int events_till_retirement = 0;
494 /* Line number which was used to place this location.
496 Breakpoint placed into a comment keeps it's user specified line number
497 despite ADDRESS resolves into a different line number. */
499 int line_number = 0;
501 /* Symtab which was used to place this location. This is used
502 to find the corresponding source file name. */
504 struct symtab *symtab = NULL;
506 /* The symbol found by the location parser, if any. This may be used to
507 ascertain when a location spec was set at a different location than
508 the one originally selected by parsing, e.g., inlined symbols. */
509 const struct symbol *symbol = NULL;
511 /* Similarly, the minimal symbol found by the location parser, if
512 any. This may be used to ascertain if the location was
513 originally set on a GNU ifunc symbol. */
514 const minimal_symbol *msymbol = NULL;
516 /* The objfile the symbol or minimal symbol were found in. */
517 const struct objfile *objfile = NULL;
519 /* Return a string representation of the bp_location.
520 This is only meant to be used in debug messages. */
521 std::string to_string () const;
524 /* A policy class for bp_location reference counting. */
525 struct bp_location_ref_policy
527 static void incref (bp_location *loc)
529 loc->incref ();
532 static void decref (bp_location *loc)
534 gdb_assert (loc->refcount () > 0);
535 loc->decref ();
536 if (loc->refcount () == 0)
537 delete loc;
541 /* A gdb::ref_ptr that has been specialized for bp_location. */
542 typedef gdb::ref_ptr<bp_location, bp_location_ref_policy>
543 bp_location_ref_ptr;
545 /* The possible return values for print_bpstat, print_it_normal,
546 print_it_done, print_it_noop. */
547 enum print_stop_action
549 /* We printed nothing or we need to do some more analysis. */
550 PRINT_UNKNOWN = -1,
552 /* We printed something, and we *do* desire that something to be
553 followed by a location. */
554 PRINT_SRC_AND_LOC,
556 /* We printed something, and we do *not* desire that something to be
557 followed by a location. */
558 PRINT_SRC_ONLY,
560 /* We already printed all we needed to print, don't print anything
561 else. */
562 PRINT_NOTHING
565 /* This structure is a collection of function pointers that, if available,
566 will be called instead of the performing the default action for this
567 bptype. */
569 struct breakpoint_ops
571 /* Create SALs from LOCSPEC, storing the result in linespec_result
572 CANONICAL. If SEARCH_PSPACE is not nullptr then only results in the
573 corresponding program space are returned. If SEARCH_PSPACE is nullptr
574 then results for all program spaces are returned.
576 This function is called inside `create_breakpoint'. */
577 void (*create_sals_from_location_spec) (location_spec *locspec,
578 linespec_result *canonical,
579 program_space *search_pspace);
581 /* This method will be responsible for creating a breakpoint given its SALs.
582 Usually, it just calls `create_breakpoints_sal' (for ordinary
583 breakpoints). However, there may be some special cases where we might
584 need to do some tweaks, e.g., see
585 `strace_marker_create_breakpoints_sal'.
587 This function is called inside `create_breakpoint'. */
588 void (*create_breakpoints_sal) (struct gdbarch *,
589 struct linespec_result *,
590 gdb::unique_xmalloc_ptr<char>,
591 gdb::unique_xmalloc_ptr<char>,
592 enum bptype, enum bpdisp, int, int, int,
593 int, int, int, int, unsigned);
596 enum watchpoint_triggered
598 /* This watchpoint definitely did not trigger. */
599 watch_triggered_no = 0,
601 /* Some hardware watchpoint triggered, and it might have been this
602 one, but we do not know which it was. */
603 watch_triggered_unknown,
605 /* This hardware watchpoint definitely did trigger. */
606 watch_triggered_yes
609 /* Some targets (e.g., embedded PowerPC) need two debug registers to set
610 a watchpoint over a memory region. If this flag is true, GDB will use
611 only one register per watchpoint, thus assuming that all accesses that
612 modify a memory location happen at its starting address. */
614 extern bool target_exact_watchpoints;
616 using bp_location_list = intrusive_list<bp_location>;
617 using bp_location_iterator = bp_location_list::iterator;
618 using bp_location_range = iterator_range<bp_location_iterator>;
620 /* Note that the ->silent field is not currently used by any commands
621 (though the code is in there if it was to be, and set_raw_breakpoint
622 does set it to 0). I implemented it because I thought it would be
623 useful for a hack I had to put in; I'm going to leave it in because
624 I can see how there might be times when it would indeed be useful */
626 /* Abstract base class representing all kinds of breakpoints. */
628 struct breakpoint : public intrusive_list_node<breakpoint>
630 breakpoint (struct gdbarch *gdbarch_, enum bptype bptype,
631 bool temp = true, const char *cond_string = nullptr);
633 DISABLE_COPY_AND_ASSIGN (breakpoint);
635 virtual ~breakpoint () = 0;
637 /* Allocate a location for this breakpoint. */
638 virtual struct bp_location *allocate_location ();
640 /* Return a range of this breakpoint's locations. */
641 bp_location_range locations () const;
643 /* Add LOC to the location list of this breakpoint, sorted by address
644 (using LOC.ADDRESS).
646 LOC must have this breakpoint as its owner. LOC must not already be linked
647 in a location list. */
648 void add_location (bp_location &loc);
650 /* Remove LOC from this breakpoint's location list. The name is a bit funny
651 because remove_location is already taken, and means something else.
653 LOC must be have this breakpoints as its owner. LOC must be linked in this
654 breakpoint's location list. */
655 void unadd_location (bp_location &loc);
657 /* Clear the location list of this breakpoint. */
658 void clear_locations ()
659 { m_locations.clear (); }
661 /* Split all locations of this breakpoint that are bound to PSPACE out of its
662 location list to a separate list and return that list. If
663 PSPACE is nullptr, hoist out all locations. */
664 bp_location_list steal_locations (program_space *pspace);
666 /* Return true if this breakpoint has a least one location. */
667 bool has_locations () const
668 { return !m_locations.empty (); }
670 /* Return true if this breakpoint has a single location. */
671 bool has_single_location () const
673 if (!this->has_locations ())
674 return false;
676 return std::next (m_locations.begin ()) == m_locations.end ();
679 /* Return true if this breakpoint has multiple locations. */
680 bool has_multiple_locations () const
682 if (!this->has_locations ())
683 return false;
685 return std::next (m_locations.begin ()) != m_locations.end ();
688 /* Return a reference to the first location of this breakpoint. */
689 bp_location &first_loc ()
691 gdb_assert (this->has_locations ());
692 return m_locations.front ();
695 /* Return a reference to the first location of this breakpoint. */
696 const bp_location &first_loc () const
698 gdb_assert (this->has_locations ());
699 return m_locations.front ();
702 /* Return a reference to the last location of this breakpoint. */
703 const bp_location &last_loc () const
705 gdb_assert (this->has_locations ());
706 return m_locations.back ();
709 /* Reevaluate a breakpoint. This is necessary after symbols change
710 (e.g., an executable or DSO was loaded, or the inferior just
711 started).
713 If not nullptr, then FILTER_PSPACE is the program space in which
714 symbols may have changed, we only need to add new locations in
715 FILTER_PSPACE.
717 If FILTER_PSPACE is nullptr then all program spaces may have changed,
718 new locations need to be searched for in every program space.
720 This is pure virtual as, at a minimum, each sub-class must recompute
721 any cached condition expressions based off of the cond_string member
722 variable. */
723 virtual void re_set (program_space *filter_pspace) = 0;
725 /* Insert the breakpoint or watchpoint or activate the catchpoint.
726 Return 0 for success, 1 if the breakpoint, watchpoint or
727 catchpoint type is not supported, -1 for failure. */
728 virtual int insert_location (struct bp_location *);
730 /* Remove the breakpoint/catchpoint that was previously inserted
731 with the "insert" method above. Return 0 for success, 1 if the
732 breakpoint, watchpoint or catchpoint type is not supported,
733 -1 for failure. */
734 virtual int remove_location (struct bp_location *,
735 enum remove_bp_reason reason);
737 /* Return true if it the target has stopped due to hitting
738 breakpoint location BL. This function does not check if we
739 should stop, only if BL explains the stop. ASPACE is the address
740 space in which the event occurred, BP_ADDR is the address at
741 which the inferior stopped, and WS is the target_waitstatus
742 describing the event. */
743 virtual int breakpoint_hit (const struct bp_location *bl,
744 const address_space *aspace,
745 CORE_ADDR bp_addr,
746 const target_waitstatus &ws);
748 /* Check internal conditions of the breakpoint referred to by BS.
749 If we should not stop for this breakpoint, set BS->stop to
750 false. */
751 virtual void check_status (struct bpstat *bs)
753 /* Always stop. */
756 /* Tell how many hardware resources (debug registers) are needed
757 for this breakpoint. If this function is not provided, then
758 the breakpoint or watchpoint needs one debug register. */
759 virtual int resources_needed (const struct bp_location *);
761 /* The normal print routine for this breakpoint, called when we
762 hit it. */
763 virtual enum print_stop_action print_it (const bpstat *bs) const;
765 /* Display information about this breakpoint, for "info
766 breakpoints". Returns false if this method should use the
767 default behavior. */
768 virtual bool print_one (const bp_location **) const
770 return false;
773 /* Display extra information about this breakpoint, below the normal
774 breakpoint description in "info breakpoints".
776 In the example below, the "address range" line was printed
777 by ranged_breakpoint::print_one_detail.
779 (gdb) info breakpoints
780 Num Type Disp Enb Address What
781 2 hw breakpoint keep y in main at test-watch.c:70
782 address range: [0x10000458, 0x100004c7]
785 virtual void print_one_detail (struct ui_out *) const
787 /* Nothing. */
790 /* Display information about this breakpoint after setting it
791 (roughly speaking; this is called from "mention"). */
792 virtual void print_mention () const;
794 /* Print to FP the CLI command that recreates this breakpoint. */
795 virtual void print_recreate (struct ui_file *fp) const;
797 /* Return true if this breakpoint explains a signal. See
798 bpstat_explains_signal. */
799 virtual bool explains_signal (enum gdb_signal)
801 return true;
804 /* Called after evaluating the breakpoint's condition,
805 and only if it evaluated true. */
806 virtual void after_condition_true (struct bpstat *bs)
808 /* Nothing to do. */
811 /* Type of breakpoint. */
812 bptype type = bp_none;
813 /* Zero means disabled; remember the info but don't break here. */
814 enum enable_state enable_state = bp_enabled;
815 /* What to do with this breakpoint after we hit it. */
816 bpdisp disposition = disp_del;
817 /* Number assigned to distinguish breakpoints. */
818 int number = 0;
820 /* True means a silent breakpoint (don't print frame info if we stop
821 here). */
822 bool silent = false;
823 /* True means display ADDR_STRING to the user verbatim. */
824 bool display_canonical = false;
825 /* Number of stops at this breakpoint that should be continued
826 automatically before really stopping. */
827 int ignore_count = 0;
829 /* Number of stops at this breakpoint before it will be
830 disabled. */
831 int enable_count = 0;
833 /* Chain of command lines to execute when this breakpoint is
834 hit. */
835 counted_command_line commands;
836 /* Stack depth (address of frame). If nonzero, break only if fp
837 equals this. */
838 struct frame_id frame_id = null_frame_id;
840 /* The program space used to set the breakpoint. This is only set for
841 breakpoints that are not type bp_breakpoint or bp_hardware_breakpoint.
842 For thread or inferior specific breakpoints, the breakpoints are
843 managed via the thread and inferior member variables. */
845 /* If not nullptr then this is the program space for which this
846 breakpoint was created. All watchpoint and catchpoint sub-types set
847 this field, but not all of the code_breakpoint sub-types do;
848 generally, user created breakpoint types don't set this field, though
849 things might be more consistent if they did.
851 When this variable is nullptr then a breakpoint might be associated
852 with multiple program spaces, though you need to check the thread,
853 inferior and task variables to see if a breakpoint was created for a
854 specific thread, inferior, or Ada task respectively. */
855 program_space *pspace = NULL;
857 /* The location specification we used to set the breakpoint. */
858 location_spec_up locspec;
860 /* The filter that should be passed to decode_line_full when
861 re-setting this breakpoint. This may be NULL. */
862 gdb::unique_xmalloc_ptr<char> filter;
864 /* For a ranged breakpoint, the location specification we used to
865 find the end of the range. */
866 location_spec_up locspec_range_end;
868 /* Architecture we used to set the breakpoint. */
869 struct gdbarch *gdbarch;
870 /* Language we used to set the breakpoint. */
871 enum language language;
872 /* Input radix we used to set the breakpoint. */
873 int input_radix;
874 /* String form of the breakpoint condition (malloc'd), or NULL if
875 there is no condition. */
876 gdb::unique_xmalloc_ptr<char> cond_string;
878 /* String form of extra parameters, or NULL if there are none.
879 Malloc'd. */
880 gdb::unique_xmalloc_ptr<char> extra_string;
882 /* Holds the address of the related watchpoint_scope breakpoint when
883 using watchpoints on local variables (might the concept of a
884 related breakpoint be useful elsewhere, if not just call it the
885 watchpoint_scope breakpoint or something like that. FIXME). */
886 breakpoint *related_breakpoint;
888 /* Thread number for thread-specific breakpoint, or -1 if don't
889 care. */
890 int thread = -1;
892 /* Inferior number for inferior-specific breakpoint, or -1 if this
893 breakpoint is for all inferiors. */
894 int inferior = -1;
896 /* Ada task number for task-specific breakpoint, or -1 if don't
897 care. */
898 int task = -1;
900 /* Count of the number of times this breakpoint was taken, dumped
901 with the info, but not used for anything else. Useful for seeing
902 how many times you hit a break prior to the program aborting, so
903 you can back up to just before the abort. */
904 int hit_count = 0;
906 /* Is breakpoint's condition not yet parsed because we found no
907 location initially so had no context to parse the condition
908 in. */
909 int condition_not_parsed = 0;
911 /* With a Python scripting enabled GDB, store a reference to the
912 Python object that has been associated with this breakpoint.
913 This is always NULL for a GDB that is not script enabled. It can
914 sometimes be NULL for enabled GDBs as not all breakpoint types
915 are tracked by the scripting language API. */
916 gdbpy_breakpoint_object *py_bp_object = NULL;
918 /* Same as py_bp_object, but for Scheme. */
919 gdbscm_breakpoint_object *scm_bp_object = NULL;
921 protected:
923 /* Helper for breakpoint_ops->print_recreate implementations. Prints
924 the "thread" or "task" condition of B, and then a newline.
926 Necessary because most breakpoint implementations accept
927 thread/task conditions at the end of the spec line, like "break foo
928 thread 1", which needs outputting before any breakpoint-type
929 specific extra command necessary for B's recreation. */
930 void print_recreate_thread (struct ui_file *fp) const;
932 /* Location(s) associated with this high-level breakpoint. */
933 bp_location_list m_locations;
936 /* Abstract base class representing code breakpoints. User "break"
937 breakpoints, internal and momentary breakpoints, etc. IOW, any
938 kind of breakpoint whose locations are created from SALs. */
939 struct code_breakpoint : public breakpoint
941 using breakpoint::breakpoint;
943 /* Create a breakpoint with SALS as locations. Use LOCATION as a
944 description of the location, and COND_STRING as condition
945 expression. If LOCATION is NULL then create an "address
946 location" from the address in the SAL. */
947 code_breakpoint (struct gdbarch *gdbarch, bptype type,
948 gdb::array_view<const symtab_and_line> sals,
949 location_spec_up &&locspec,
950 gdb::unique_xmalloc_ptr<char> filter,
951 gdb::unique_xmalloc_ptr<char> cond_string,
952 gdb::unique_xmalloc_ptr<char> extra_string,
953 enum bpdisp disposition,
954 int thread, int task, int inferior, int ignore_count,
955 int from_tty,
956 int enabled, unsigned flags,
957 int display_canonical);
959 ~code_breakpoint () override = 0;
961 /* Add a location for SAL to this breakpoint. */
962 bp_location *add_location (const symtab_and_line &sal);
964 void re_set (program_space *pspace) override;
965 int insert_location (struct bp_location *) override;
966 int remove_location (struct bp_location *,
967 enum remove_bp_reason reason) override;
968 int breakpoint_hit (const struct bp_location *bl,
969 const address_space *aspace,
970 CORE_ADDR bp_addr,
971 const target_waitstatus &ws) override;
973 protected:
975 /* Given the location spec, this method decodes it and returns the
976 SAL locations related to it. For ordinary breakpoints, it calls
977 `decode_line_full'. If SEARCH_PSPACE is not NULL, symbol search
978 is restricted to just that program space.
980 This function is called inside `location_spec_to_sals'. */
981 virtual std::vector<symtab_and_line> decode_location_spec
982 (location_spec *locspec,
983 struct program_space *search_pspace);
985 /* Helper method that does the basic work of re_set. */
986 void re_set_default (program_space *pspace);
988 /* Find the SaL locations corresponding to the given LOCATION.
989 On return, FOUND will be 1 if any SaL was found, zero otherwise. */
991 std::vector<symtab_and_line> location_spec_to_sals
992 (location_spec *locspec,
993 struct program_space *search_pspace,
994 int *found);
996 /* Helper for breakpoint and tracepoint breakpoint->mention
997 callbacks. */
998 void say_where () const;
1001 /* An instance of this type is used to represent a watchpoint,
1002 a.k.a. a data breakpoint. */
1004 struct watchpoint : public breakpoint
1006 using breakpoint::breakpoint;
1008 void re_set (program_space *pspace) override;
1009 int insert_location (struct bp_location *) override;
1010 int remove_location (struct bp_location *,
1011 enum remove_bp_reason reason) override;
1012 int breakpoint_hit (const struct bp_location *bl,
1013 const address_space *aspace,
1014 CORE_ADDR bp_addr,
1015 const target_waitstatus &ws) override;
1016 void check_status (struct bpstat *bs) override;
1017 int resources_needed (const struct bp_location *) override;
1019 /* Tell whether we can downgrade from a hardware watchpoint to a software
1020 one. If not, the user will not be able to enable the watchpoint when
1021 there are not enough hardware resources available. */
1022 virtual bool works_in_software_mode () const;
1024 enum print_stop_action print_it (const bpstat *bs) const override;
1025 void print_mention () const override;
1026 void print_recreate (struct ui_file *fp) const override;
1027 bool explains_signal (enum gdb_signal) override;
1029 /* Destructor for WATCHPOINT. */
1030 ~watchpoint ();
1032 /* String form of exp to use for displaying to the user (malloc'd),
1033 or NULL if none. */
1034 gdb::unique_xmalloc_ptr<char> exp_string;
1035 /* String form to use for reparsing of EXP (malloc'd) or NULL. */
1036 gdb::unique_xmalloc_ptr<char> exp_string_reparse;
1038 /* The expression we are watching, or NULL if not a watchpoint. */
1039 expression_up exp;
1040 /* The largest block within which it is valid, or NULL if it is
1041 valid anywhere (e.g. consists just of global symbols). */
1042 const struct block *exp_valid_block;
1043 /* The conditional expression if any. */
1044 expression_up cond_exp;
1045 /* The largest block within which it is valid, or NULL if it is
1046 valid anywhere (e.g. consists just of global symbols). */
1047 const struct block *cond_exp_valid_block;
1048 /* Value of the watchpoint the last time we checked it, or NULL when
1049 we do not know the value yet or the value was not readable. VAL
1050 is never lazy. */
1051 value_ref_ptr val;
1053 /* True if VAL is valid. If VAL_VALID is set but VAL is NULL,
1054 then an error occurred reading the value. */
1055 bool val_valid;
1057 /* When watching the location of a bitfield, contains the offset and size of
1058 the bitfield. Otherwise contains 0. */
1059 int val_bitpos;
1060 int val_bitsize;
1062 /* Holds the frame address which identifies the frame this
1063 watchpoint should be evaluated in, or `null' if the watchpoint
1064 should be evaluated on the outermost frame. */
1065 struct frame_id watchpoint_frame;
1067 /* Holds the thread which identifies the frame this watchpoint
1068 should be considered in scope for, or `null_ptid' if the
1069 watchpoint should be evaluated in all threads. */
1070 ptid_t watchpoint_thread;
1072 /* For hardware watchpoints, the triggered status according to the
1073 hardware. */
1074 enum watchpoint_triggered watchpoint_triggered;
1076 /* Whether this watchpoint is exact (see
1077 target_exact_watchpoints). */
1078 int exact;
1080 /* The mask address for a masked hardware watchpoint. */
1081 CORE_ADDR hw_wp_mask;
1084 /* Return true if BPT is either a software breakpoint or a hardware
1085 breakpoint. */
1087 extern bool is_breakpoint (const struct breakpoint *bpt);
1089 /* Return true if BPT is of any watchpoint kind, hardware or
1090 software. */
1092 extern bool is_watchpoint (const struct breakpoint *bpt);
1094 /* Return true if BPT is a C++ exception catchpoint (catch
1095 catch/throw/rethrow). */
1097 extern bool is_exception_catchpoint (breakpoint *bp);
1099 /* An instance of this type is used to represent all kinds of
1100 tracepoints. */
1102 struct tracepoint : public code_breakpoint
1104 using code_breakpoint::code_breakpoint;
1106 int breakpoint_hit (const struct bp_location *bl,
1107 const address_space *aspace, CORE_ADDR bp_addr,
1108 const target_waitstatus &ws) override;
1109 void print_one_detail (struct ui_out *uiout) const override;
1110 void print_mention () const override;
1111 void print_recreate (struct ui_file *fp) const override;
1113 /* Number of times this tracepoint should single-step and collect
1114 additional data. */
1115 long step_count = 0;
1117 /* Number of times this tracepoint should be hit before
1118 disabling/ending. */
1119 int pass_count = 0;
1121 /* The number of the tracepoint on the target. */
1122 int number_on_target = 0;
1124 /* The total space taken by all the trace frames for this
1125 tracepoint. */
1126 ULONGEST traceframe_usage = 0;
1128 /* The static tracepoint marker id, if known. */
1129 std::string static_trace_marker_id;
1131 /* LTTng/UST allow more than one marker with the same ID string,
1132 although it unadvised because it confuses tools. When setting
1133 static tracepoints by marker ID, this will record the index in
1134 the array of markers we found for the given marker ID for which
1135 this static tracepoint corresponds. When resetting breakpoints,
1136 we will use this index to try to find the same marker again. */
1137 int static_trace_marker_id_idx = 0;
1140 /* The abstract base class for catchpoints. */
1142 struct catchpoint : public breakpoint
1144 /* If TEMP is true, then make the breakpoint temporary. If
1145 COND_STRING is not NULL, then store it in the breakpoint. */
1146 catchpoint (struct gdbarch *gdbarch, bool temp, const char *cond_string);
1148 ~catchpoint () override = 0;
1150 /* If the catchpoint has a condition set then recompute the cached
1151 expression within the single dummy location. */
1152 void re_set (program_space *filter_pspace) override;
1156 /* The following stuff is an abstract data type "bpstat" ("breakpoint
1157 status"). This provides the ability to determine whether we have
1158 stopped at a breakpoint, and what we should do about it. */
1160 /* Clears a chain of bpstat, freeing storage
1161 of each. */
1162 extern void bpstat_clear (bpstat **);
1164 /* Return a copy of a bpstat. Like "bs1 = bs2" but all storage that
1165 is part of the bpstat is copied as well. */
1166 extern bpstat *bpstat_copy (bpstat *);
1168 /* Build the (raw) bpstat chain for the stop information given by ASPACE,
1169 BP_ADDR, and WS. Returns the head of the bpstat chain. */
1171 extern bpstat *build_bpstat_chain (const address_space *aspace,
1172 CORE_ADDR bp_addr,
1173 const target_waitstatus &ws);
1175 /* Get a bpstat associated with having just stopped at address
1176 BP_ADDR in thread PTID. STOP_CHAIN may be supplied as a previously
1177 computed stop chain or NULL, in which case the stop chain will be
1178 computed using build_bpstat_chain.
1180 Determine whether we stopped at a breakpoint, etc, or whether we
1181 don't understand this stop. Result is a chain of bpstat's such
1182 that:
1184 if we don't understand the stop, the result is a null pointer.
1186 if we understand why we stopped, the result is not null.
1188 Each element of the chain refers to a particular breakpoint or
1189 watchpoint at which we have stopped. (We may have stopped for
1190 several reasons concurrently.)
1192 Each element of the chain has valid next, breakpoint_at,
1193 commands, FIXME??? fields.
1195 watchpoints_triggered must be called beforehand to set up each
1196 watchpoint's watchpoint_triggered value.
1200 extern bpstat *bpstat_stop_status (const address_space *aspace,
1201 CORE_ADDR pc, thread_info *thread,
1202 const target_waitstatus &ws,
1203 bpstat *stop_chain = nullptr);
1205 /* Like bpstat_stop_status, but clears all watchpoints'
1206 watchpoint_triggered flag. Unlike with bpstat_stop_status, there's
1207 no need to call watchpoint_triggered beforehand. You'll typically
1208 use this variant when handling a known-non-watchpoint event, like a
1209 fork or exec event. */
1211 extern bpstat *bpstat_stop_status_nowatch (const address_space *aspace,
1212 CORE_ADDR bp_addr,
1213 thread_info *thread,
1214 const target_waitstatus &ws);
1218 /* This bpstat_what stuff tells wait_for_inferior what to do with a
1219 breakpoint (a challenging task).
1221 The enum values order defines priority-like order of the actions.
1222 Once you've decided that some action is appropriate, you'll never
1223 go back and decide something of a lower priority is better. Each
1224 of these actions is mutually exclusive with the others. That
1225 means, that if you find yourself adding a new action class here and
1226 wanting to tell GDB that you have two simultaneous actions to
1227 handle, something is wrong, and you probably don't actually need a
1228 new action type.
1230 Note that a step resume breakpoint overrides another breakpoint of
1231 signal handling (see comment in wait_for_inferior at where we set
1232 the step_resume breakpoint). */
1234 enum bpstat_what_main_action
1236 /* Perform various other tests; that is, this bpstat does not
1237 say to perform any action (e.g. failed watchpoint and nothing
1238 else). */
1239 BPSTAT_WHAT_KEEP_CHECKING,
1241 /* Remove breakpoints, single step once, then put them back in and
1242 go back to what we were doing. It's possible that this should
1243 be removed from the main_action and put into a separate field,
1244 to more cleanly handle
1245 BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE. */
1246 BPSTAT_WHAT_SINGLE,
1248 /* Set longjmp_resume breakpoint, remove all other breakpoints,
1249 and continue. The "remove all other breakpoints" part is
1250 required if we are also stepping over another breakpoint as
1251 well as doing the longjmp handling. */
1252 BPSTAT_WHAT_SET_LONGJMP_RESUME,
1254 /* Clear longjmp_resume breakpoint, then handle as
1255 BPSTAT_WHAT_KEEP_CHECKING. */
1256 BPSTAT_WHAT_CLEAR_LONGJMP_RESUME,
1258 /* Clear step resume breakpoint, and keep checking. */
1259 BPSTAT_WHAT_STEP_RESUME,
1261 /* Rather than distinguish between noisy and silent stops here, it
1262 might be cleaner to have bpstat_print make that decision (also
1263 taking into account stop_print_frame and source_only). But the
1264 implications are a bit scary (interaction with auto-displays,
1265 etc.), so I won't try it. */
1267 /* Stop silently. */
1268 BPSTAT_WHAT_STOP_SILENT,
1270 /* Stop and print. */
1271 BPSTAT_WHAT_STOP_NOISY,
1273 /* Clear step resume breakpoint, and keep checking. High-priority
1274 step-resume breakpoints are used when even if there's a user
1275 breakpoint at the current PC when we set the step-resume
1276 breakpoint, we don't want to re-handle any breakpoint other
1277 than the step-resume when it's hit; instead we want to move
1278 past the breakpoint. This is used in the case of skipping
1279 signal handlers. */
1280 BPSTAT_WHAT_HP_STEP_RESUME,
1283 /* An enum indicating the kind of "stack dummy" stop. This is a bit
1284 of a misnomer because only one kind of truly a stack dummy. */
1285 enum stop_stack_kind
1287 /* We didn't stop at a stack dummy breakpoint. */
1288 STOP_NONE = 0,
1290 /* Stopped at a stack dummy. */
1291 STOP_STACK_DUMMY,
1293 /* Stopped at std::terminate. */
1294 STOP_STD_TERMINATE
1297 struct bpstat_what
1299 enum bpstat_what_main_action main_action;
1301 /* Did we hit a call dummy breakpoint? This only goes with a
1302 main_action of BPSTAT_WHAT_STOP_SILENT or
1303 BPSTAT_WHAT_STOP_NOISY (the concept of continuing from a call
1304 dummy without popping the frame is not a useful one). */
1305 enum stop_stack_kind call_dummy;
1307 /* Used for BPSTAT_WHAT_SET_LONGJMP_RESUME and
1308 BPSTAT_WHAT_CLEAR_LONGJMP_RESUME. True if we are handling a
1309 longjmp, false if we are handling an exception. */
1310 bool is_longjmp;
1313 /* Tell what to do about this bpstat. */
1314 struct bpstat_what bpstat_what (bpstat *);
1316 /* Run breakpoint event callbacks associated with the breakpoints that
1317 triggered. */
1318 extern void bpstat_run_callbacks (bpstat *bs_head);
1320 /* Find the bpstat associated with a breakpoint. NULL otherwise. */
1321 bpstat *bpstat_find_breakpoint (bpstat *, struct breakpoint *);
1323 /* True if a signal that we got in target_wait() was due to
1324 circumstances explained by the bpstat; the signal is therefore not
1325 random. */
1326 extern bool bpstat_explains_signal (bpstat *, enum gdb_signal);
1328 /* True if this bpstat causes a stop. */
1329 extern bool bpstat_causes_stop (bpstat *);
1331 /* True if we should step constantly (e.g. watchpoints on machines
1332 without hardware support). This isn't related to a specific bpstat,
1333 just to things like whether watchpoints are set. */
1334 extern bool bpstat_should_step ();
1336 /* Print a message indicating what happened. */
1337 extern enum print_stop_action bpstat_print (bpstat *bs, target_waitkind kind);
1339 /* Put in *NUM the breakpoint number of the first breakpoint we are
1340 stopped at. *BSP upon return is a bpstat which points to the
1341 remaining breakpoints stopped at (but which is not guaranteed to be
1342 good for anything but further calls to bpstat_num).
1344 Return 0 if passed a bpstat which does not indicate any breakpoints.
1345 Return -1 if stopped at a breakpoint that has been deleted since
1346 we set it.
1347 Return 1 otherwise. */
1348 extern int bpstat_num (bpstat **, int *);
1350 /* If BS indicates a breakpoint and this breakpoint has several code locations,
1351 return the location number of BS, otherwise return 0. */
1353 extern int bpstat_locno (const bpstat *bs);
1355 /* Print BS breakpoint number optionally followed by a . and breakpoint locno.
1357 For a breakpoint with only one code location, outputs the signed field
1358 "bkptno" breakpoint number of BS (as returned by bpstat_num).
1359 If BS has several code locations, outputs a '.' character followed by
1360 the signed field "locno" (as returned by bpstat_locno). */
1362 extern void print_num_locno (const bpstat *bs, struct ui_out *);
1364 /* Perform actions associated with the stopped inferior. Actually, we
1365 just use this for breakpoint commands. Perhaps other actions will
1366 go here later, but this is executed at a late time (from the
1367 command loop). */
1368 extern void bpstat_do_actions (void);
1370 /* Modify all entries of STOP_BPSTAT of INFERIOR_PTID so that the actions will
1371 not be performed. */
1372 extern void bpstat_clear_actions (void);
1374 /* Implementation: */
1376 /* Values used to tell the printing routine how to behave for this
1377 bpstat. */
1378 enum bp_print_how
1380 /* This is used when we want to do a normal printing of the reason
1381 for stopping. The output will depend on the type of eventpoint
1382 we are dealing with. This is the default value, most commonly
1383 used. */
1384 print_it_normal,
1385 /* This is used when nothing should be printed for this bpstat
1386 entry. */
1387 print_it_noop,
1388 /* This is used when everything which needs to be printed has
1389 already been printed. But we still want to print the frame. */
1390 print_it_done
1393 struct bpstat
1395 bpstat ();
1396 bpstat (struct bp_location *bl, bpstat ***bs_link_pointer);
1398 bpstat (const bpstat &);
1399 bpstat &operator= (const bpstat &) = delete;
1401 /* Linked list because there can be more than one breakpoint at
1402 the same place, and a bpstat reflects the fact that all have
1403 been hit. */
1404 bpstat *next;
1406 /* Location that caused the stop. Locations are refcounted, so
1407 this will never be NULL. Note that this location may end up
1408 detached from a breakpoint, but that does not necessary mean
1409 that the struct breakpoint is gone. E.g., consider a
1410 watchpoint with a condition that involves an inferior function
1411 call. Watchpoint locations are recreated often (on resumes,
1412 hence on infcalls too). Between creating the bpstat and after
1413 evaluating the watchpoint condition, this location may hence
1414 end up detached from its original owner watchpoint, even though
1415 the watchpoint is still listed. If it's condition evaluates as
1416 true, we still want this location to cause a stop, and we will
1417 still need to know which watchpoint it was originally attached.
1418 What this means is that we should not (in most cases) follow
1419 the `bpstat->bp_location->owner' link, but instead use the
1420 `breakpoint_at' field below. */
1421 bp_location_ref_ptr bp_location_at;
1423 /* Breakpoint that caused the stop. This is nullified if the
1424 breakpoint ends up being deleted. See comments on
1425 `bp_location_at' above for why do we need this field instead of
1426 following the location's owner. */
1427 struct breakpoint *breakpoint_at;
1429 /* The associated command list. */
1430 counted_command_line commands;
1432 /* Old value associated with a watchpoint. */
1433 value_ref_ptr old_val;
1435 /* True if this breakpoint tells us to print the frame. */
1436 bool print;
1438 /* True if this breakpoint tells us to stop. */
1439 bool stop;
1441 /* Tell bpstat_print and print_bp_stop_message how to print stuff
1442 associated with this element of the bpstat chain. */
1443 enum bp_print_how print_it;
1446 enum inf_context
1448 inf_starting,
1449 inf_running,
1450 inf_exited,
1451 inf_execd
1454 /* The possible return values for breakpoint_here_p.
1455 We guarantee that zero always means "no breakpoint here". */
1456 enum breakpoint_here
1458 no_breakpoint_here = 0,
1459 ordinary_breakpoint_here,
1460 permanent_breakpoint_here
1464 /* Prototypes for breakpoint-related functions. */
1466 extern enum breakpoint_here breakpoint_here_p (const address_space *,
1467 CORE_ADDR);
1469 /* Return true if an enabled breakpoint exists in the range defined by
1470 ADDR and LEN, in ASPACE. */
1471 extern int breakpoint_in_range_p (const address_space *aspace,
1472 CORE_ADDR addr, ULONGEST len);
1474 extern int moribund_breakpoint_here_p (const address_space *, CORE_ADDR);
1476 extern int breakpoint_inserted_here_p (const address_space *,
1477 CORE_ADDR);
1479 extern int software_breakpoint_inserted_here_p (const address_space *,
1480 CORE_ADDR);
1482 /* Return non-zero iff there is a hardware breakpoint inserted at
1483 PC. */
1484 extern int hardware_breakpoint_inserted_here_p (const address_space *,
1485 CORE_ADDR);
1487 /* Check whether any location of BP is inserted at PC. */
1489 extern int breakpoint_has_location_inserted_here (struct breakpoint *bp,
1490 const address_space *aspace,
1491 CORE_ADDR pc);
1493 extern int single_step_breakpoint_inserted_here_p (const address_space *,
1494 CORE_ADDR);
1496 /* Returns true if there's a hardware watchpoint or access watchpoint
1497 inserted in the range defined by ADDR and LEN. */
1498 extern int hardware_watchpoint_inserted_in_range (const address_space *,
1499 CORE_ADDR addr,
1500 ULONGEST len);
1502 /* Returns true if {ASPACE1,ADDR1} and {ASPACE2,ADDR2} represent the
1503 same breakpoint location. In most targets, this can only be true
1504 if ASPACE1 matches ASPACE2. On targets that have global
1505 breakpoints, the address space doesn't really matter. */
1507 extern int breakpoint_address_match (const address_space *aspace1,
1508 CORE_ADDR addr1,
1509 const address_space *aspace2,
1510 CORE_ADDR addr2);
1512 extern void until_break_command (const char *, int, int);
1514 /* Initialize a struct bp_location. */
1516 extern void update_breakpoint_locations
1517 (code_breakpoint *b,
1518 struct program_space *filter_pspace,
1519 gdb::array_view<const symtab_and_line> sals,
1520 gdb::array_view<const symtab_and_line> sals_end);
1522 extern void breakpoint_re_set (void);
1524 extern void breakpoint_re_set_thread (struct breakpoint *);
1526 extern void delete_breakpoint (struct breakpoint *);
1528 struct breakpoint_deleter
1530 void operator() (struct breakpoint *b) const
1532 delete_breakpoint (b);
1536 typedef std::unique_ptr<struct breakpoint, breakpoint_deleter> breakpoint_up;
1538 extern breakpoint_up set_momentary_breakpoint
1539 (struct gdbarch *, struct symtab_and_line, struct frame_id, enum bptype);
1541 extern breakpoint_up set_momentary_breakpoint_at_pc
1542 (struct gdbarch *, CORE_ADDR pc, enum bptype type);
1544 extern struct breakpoint *clone_momentary_breakpoint (struct breakpoint *bpkt);
1546 extern void set_ignore_count (int, int, int);
1548 /* Clear the "inserted" flag in all breakpoint locations of INF's program space
1549 and delete any breakpoints which should go away between runs of the program.
1551 Plus other such housekeeping that has to be done for breakpoints
1552 between runs.
1554 Note: this function gets called at the end of a run (by
1555 generic_mourn_inferior) and when a run begins (by
1556 init_wait_for_inferior). */
1558 extern void breakpoint_init_inferior (inferior *inf, inf_context context);
1560 extern void breakpoint_auto_delete (bpstat *);
1562 /* Return the chain of command lines to execute when this breakpoint
1563 is hit. */
1564 extern struct command_line *breakpoint_commands (struct breakpoint *b);
1566 /* Return a string image of DISP. The string is static, and thus should
1567 NOT be deallocated after use. */
1568 const char *bpdisp_text (enum bpdisp disp);
1570 extern void break_command (const char *, int);
1572 extern void watch_command_wrapper (const char *, int, bool);
1573 extern void awatch_command_wrapper (const char *, int, bool);
1574 extern void rwatch_command_wrapper (const char *, int, bool);
1575 extern void tbreak_command (const char *, int);
1577 extern const struct breakpoint_ops code_breakpoint_ops;
1579 /* Arguments to pass as context to some catch command handlers. */
1580 #define CATCH_PERMANENT ((void *) (uintptr_t) 0)
1581 #define CATCH_TEMPORARY ((void *) (uintptr_t) 1)
1583 /* Like add_cmd, but add the command to both the "catch" and "tcatch"
1584 lists, and pass some additional user data to the command
1585 function. */
1587 extern void
1588 add_catch_command (const char *name, const char *docstring,
1589 cmd_func_ftype *func,
1590 completer_ftype *completer,
1591 void *user_data_catch,
1592 void *user_data_tcatch);
1594 /* Add breakpoint B on the breakpoint list, and notify the user, the
1595 target and breakpoint_created observers of its existence. If
1596 INTERNAL is non-zero, the breakpoint number will be allocated from
1597 the internal breakpoint count. If UPDATE_GLL is non-zero,
1598 update_global_location_list will be called.
1600 Takes ownership of B, and returns a non-owning reference to it. */
1602 extern breakpoint *install_breakpoint
1603 (int internal, std::unique_ptr<breakpoint> &&b, int update_gll);
1605 /* Returns the breakpoint ops appropriate for use with with LOCSPEC
1606 and according to IS_TRACEPOINT. Use this to ensure, for example,
1607 that you pass the correct ops to create_breakpoint for probe
1608 location specs. If LOCSPEC is NULL, returns
1609 code_breakpoint_ops. */
1611 extern const struct breakpoint_ops *breakpoint_ops_for_location_spec
1612 (const location_spec *locspec, bool is_tracepoint);
1614 /* Flags that can be passed down to create_breakpoint, etc., to affect
1615 breakpoint creation in several ways. */
1617 enum breakpoint_create_flags
1619 /* We're adding a breakpoint to our tables that is already
1620 inserted in the target. */
1621 CREATE_BREAKPOINT_FLAGS_INSERTED = 1 << 0
1624 /* Set a breakpoint. This function is shared between CLI and MI
1625 functions for setting a breakpoint at LOCSPEC.
1627 This function has two major modes of operations, selected by the
1628 PARSE_EXTRA and WANTED_TYPE parameters.
1630 When WANTED_TYPE is not bp_dprintf the following rules apply:
1632 If PARSE_EXTRA is zero, LOCSPEC is just the breakpoint's location
1633 spec, with condition, thread, and extra string specified by the
1634 COND_STRING, THREAD, and EXTRA_STRING parameters.
1636 If PARSE_EXTRA is non-zero, this function will attempt to extract the
1637 condition, thread, and extra string from EXTRA_STRING, ignoring the
1638 similarly named parameters.
1640 When WANTED_TYPE is bp_dprintf the following rules apply:
1642 PARSE_EXTRA must always be zero, LOCSPEC is just the breakpoint's
1643 location spec, with condition, thread, and extra string (which
1644 contains the dprintf format and arguments) specified by the
1645 COND_STRING, THREAD, and EXTRA_STRING parameters.
1647 If FORCE_CONDITION is true, the condition (in COND_STRING) is accepted
1648 even when it is invalid at all of the locations. However, if
1649 PARSE_EXTRA is non-zero and WANTED_TYPE is not bp_dprintf, the
1650 FORCE_CONDITION parameter is ignored and the corresponding argument is
1651 parsed from EXTRA_STRING.
1653 The THREAD should be a global thread number, the created breakpoint will
1654 only apply for that thread. If the breakpoint should apply for all
1655 threads then pass -1. However, if PARSE_EXTRA is non-zero and
1656 WANTED_TYPE is not bp_dprintf, then the THREAD parameter is ignored and
1657 an optional thread number will be parsed from EXTRA_STRING.
1659 The INFERIOR should be a global inferior number, the created breakpoint
1660 will only apply for that inferior. If the breakpoint should apply for
1661 all inferiors then pass -1. However, if PARSE_EXTRA is non-zero and
1662 WANTED_TYPE is not bp_dprintf, then the INFERIOR parameter is ignored
1663 and an optional inferior number will be parsed from EXTRA_STRING.
1665 At most one of THREAD and INFERIOR should be set to a value other than
1666 -1; breakpoints can be thread specific, or inferior specific, but not
1667 both.
1669 If INTERNAL is non-zero, the breakpoint number will be allocated
1670 from the internal breakpoint count.
1672 Returns true if any breakpoint was created; false otherwise. */
1674 extern int create_breakpoint (struct gdbarch *gdbarch,
1675 struct location_spec *locspec,
1676 const char *cond_string, int thread,
1677 int inferior,
1678 const char *extra_string,
1679 bool force_condition,
1680 int parse_extra,
1681 int tempflag, enum bptype wanted_type,
1682 int ignore_count,
1683 enum auto_boolean pending_break_support,
1684 const struct breakpoint_ops *ops,
1685 int from_tty,
1686 int enabled,
1687 int internal, unsigned flags);
1689 extern void insert_breakpoints (void);
1691 extern int remove_breakpoints (void);
1693 /* Remove breakpoints of inferior INF. */
1695 extern void remove_breakpoints_inf (inferior *inf);
1697 /* This function can be used to update the breakpoint package's state
1698 after an exec() system call has been executed.
1700 This function causes the following:
1702 - All eventpoints are marked "not inserted".
1703 - All eventpoints with a symbolic address are reset such that
1704 the symbolic address must be reevaluated before the eventpoints
1705 can be reinserted.
1706 - The solib breakpoints are explicitly removed from the breakpoint
1707 list.
1708 - A step-resume breakpoint, if any, is explicitly removed from the
1709 breakpoint list.
1710 - All eventpoints without a symbolic address are removed from the
1711 breakpoint list. */
1712 extern void update_breakpoints_after_exec (void);
1714 /* This function can be used to physically remove hardware breakpoints
1715 and watchpoints from the specified traced inferior process, without
1716 modifying the breakpoint package's state. This can be useful for
1717 those targets which support following the processes of a fork() or
1718 vfork() system call, when one of the resulting two processes is to
1719 be detached and allowed to run free.
1721 It is an error to use this function on the process whose id is
1722 inferior_ptid. */
1723 extern int detach_breakpoints (ptid_t ptid);
1725 /* This function is called when program space PSPACE is about to be
1726 deleted. It takes care of updating breakpoints to not reference
1727 this PSPACE anymore. */
1728 extern void breakpoint_program_space_exit (struct program_space *pspace);
1730 extern void set_longjmp_breakpoint (struct thread_info *tp,
1731 struct frame_id frame);
1732 extern void delete_longjmp_breakpoint (int thread);
1734 /* Mark all longjmp breakpoints from THREAD for later deletion. */
1735 extern void delete_longjmp_breakpoint_at_next_stop (int thread);
1737 extern struct breakpoint *set_longjmp_breakpoint_for_call_dummy (void);
1738 extern void check_longjmp_breakpoint_for_call_dummy (struct thread_info *tp);
1740 extern void enable_overlay_breakpoints (void);
1741 extern void disable_overlay_breakpoints (void);
1743 extern void set_std_terminate_breakpoint (void);
1744 extern void delete_std_terminate_breakpoint (void);
1746 /* These functions respectively disable or reenable all currently
1747 enabled watchpoints. When disabled, the watchpoints are marked
1748 call_disabled. When re-enabled, they are marked enabled.
1750 The intended client of these functions is call_function_by_hand.
1752 The inferior must be stopped, and all breakpoints removed, when
1753 these functions are used.
1755 The need for these functions is that on some targets (e.g., HP-UX),
1756 gdb is unable to unwind through the dummy frame that is pushed as
1757 part of the implementation of a call command. Watchpoints can
1758 cause the inferior to stop in places where this frame is visible,
1759 and that can cause execution control to become very confused.
1761 Note that if a user sets breakpoints in an interactively called
1762 function, the call_disabled watchpoints will have been re-enabled
1763 when the first such breakpoint is reached. However, on targets
1764 that are unable to unwind through the call dummy frame, watches
1765 of stack-based storage may then be deleted, because gdb will
1766 believe that their watched storage is out of scope. (Sigh.) */
1767 extern void disable_watchpoints_before_interactive_call_start (void);
1769 extern void enable_watchpoints_after_interactive_call_stop (void);
1771 /* These functions disable and re-enable all breakpoints during
1772 inferior startup. They are intended to be called from solib
1773 code where necessary. This is needed on platforms where the
1774 main executable is relocated at some point during startup
1775 processing, making breakpoint addresses invalid.
1777 If additional breakpoints are created after the routine
1778 disable_breakpoints_before_startup but before the routine
1779 enable_breakpoints_after_startup was called, they will also
1780 be marked as disabled. */
1781 extern void disable_breakpoints_before_startup (void);
1782 extern void enable_breakpoints_after_startup (void);
1784 /* For script interpreters that need to define breakpoint commands
1785 after they've already read the commands into a struct
1786 command_line. */
1787 extern enum command_control_type commands_from_control_command
1788 (const char *arg, struct command_line *cmd);
1790 extern void clear_breakpoint_hit_counts (void);
1792 extern struct breakpoint *get_breakpoint (int num);
1794 /* The following are for displays, which aren't really breakpoints,
1795 but here is as good a place as any for them. */
1797 extern void disable_current_display (void);
1799 extern void do_displays (void);
1801 extern void disable_display (int);
1803 extern void clear_displays (void);
1805 extern void disable_breakpoint (struct breakpoint *);
1807 extern void enable_breakpoint (struct breakpoint *);
1809 extern void breakpoint_set_commands (struct breakpoint *b,
1810 counted_command_line &&commands);
1812 extern void breakpoint_set_silent (struct breakpoint *b, int silent);
1814 /* Set the thread for this breakpoint. If THREAD is -1, make the
1815 breakpoint work for any thread. Passing a value other than -1 for
1816 THREAD should only be done if b->task is 0; it is not valid to try and
1817 set both a thread and task restriction on a breakpoint. */
1819 extern void breakpoint_set_thread (struct breakpoint *b, int thread);
1821 /* Set the inferior for breakpoint B to INFERIOR. If INFERIOR is -1, make
1822 the breakpoint work for any inferior. */
1824 extern void breakpoint_set_inferior (struct breakpoint *b, int inferior);
1826 /* Set the task for this breakpoint. If TASK is -1, make the breakpoint
1827 work for any task. Passing a value other than -1 for TASK should only
1828 be done if b->thread is -1; it is not valid to try and set both a thread
1829 and task restriction on a breakpoint. */
1831 extern void breakpoint_set_task (struct breakpoint *b, int task);
1833 /* Clear the "inserted" flag in all breakpoints locations in PSPACE. */
1835 extern void mark_breakpoints_out (program_space *pspace);
1837 extern struct breakpoint *create_jit_event_breakpoint (struct gdbarch *,
1838 CORE_ADDR);
1840 extern struct breakpoint *create_solib_event_breakpoint (struct gdbarch *,
1841 CORE_ADDR);
1843 /* Create an solib event breakpoint at ADDRESS in the current program
1844 space, and immediately try to insert it. Returns a pointer to the
1845 breakpoint on success. Deletes the new breakpoint and returns NULL
1846 if inserting the breakpoint fails. */
1847 extern struct breakpoint *create_and_insert_solib_event_breakpoint
1848 (struct gdbarch *gdbarch, CORE_ADDR address);
1850 extern struct breakpoint *create_thread_event_breakpoint (struct gdbarch *,
1851 CORE_ADDR);
1853 extern void remove_jit_event_breakpoints (void);
1855 extern void remove_solib_event_breakpoints (void);
1857 /* Mark solib event breakpoints of the current program space with
1858 delete at next stop disposition. */
1859 extern void remove_solib_event_breakpoints_at_next_stop (void);
1861 /* Disable any breakpoints that are on code in shared libraries in PSPACE.
1862 Only apply to enabled breakpoints, disabled ones can just stay disabled. */
1864 extern void disable_breakpoints_in_shlibs (program_space *pspace);
1866 /* This function returns true if B is a catchpoint. */
1868 extern bool is_catchpoint (struct breakpoint *b);
1870 /* Shared helper function (MI and CLI) for creating and installing
1871 a shared object event catchpoint. If IS_LOAD is true then
1872 the events to be caught are load events, otherwise they are
1873 unload events. If IS_TEMP is true the catchpoint is a
1874 temporary one. If ENABLED is true the catchpoint is
1875 created in an enabled state. */
1877 extern void add_solib_catchpoint (const char *arg, bool is_load, bool is_temp,
1878 bool enabled);
1880 /* Create and insert a new software single step breakpoint for the
1881 current thread. May be called multiple times; each time will add a
1882 new location to the set of potential addresses the next instruction
1883 is at. */
1884 extern void insert_single_step_breakpoint (struct gdbarch *,
1885 const address_space *,
1886 CORE_ADDR);
1888 /* Insert all software single step breakpoints for the current frame.
1889 Return true if any software single step breakpoints are inserted,
1890 otherwise, return false. */
1891 extern int insert_single_step_breakpoints (struct gdbarch *);
1893 /* Check whether any hardware watchpoints have triggered or not,
1894 according to the target, and record it in each watchpoint's
1895 'watchpoint_triggered' field. */
1896 int watchpoints_triggered (const target_waitstatus &);
1898 /* Helper for transparent breakpoint hiding for memory read and write
1899 routines.
1901 Update one of READBUF or WRITEBUF with either the shadows
1902 (READBUF), or the breakpoint instructions (WRITEBUF) of inserted
1903 breakpoints at the memory range defined by MEMADDR and extending
1904 for LEN bytes. If writing, then WRITEBUF is a copy of WRITEBUF_ORG
1905 on entry.*/
1906 extern void breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
1907 const gdb_byte *writebuf_org,
1908 ULONGEST memaddr, LONGEST len);
1910 /* Return true if breakpoints should be inserted now. That'll be the
1911 case if either:
1913 - the target has global breakpoints.
1915 - "breakpoint always-inserted" is on, and the target has
1916 execution.
1918 - threads are executing.
1920 extern int breakpoints_should_be_inserted_now (void);
1922 /* Called each time new event from target is processed.
1923 Retires previously deleted breakpoint locations that
1924 in our opinion won't ever trigger. */
1925 extern void breakpoint_retire_moribund (void);
1927 /* Set break condition of breakpoint B to EXP.
1928 If FORCE, define the condition even if it is invalid in
1929 all of the breakpoint locations. */
1930 extern void set_breakpoint_condition (struct breakpoint *b, const char *exp,
1931 int from_tty, bool force);
1933 /* Set break condition for the breakpoint with number BPNUM to EXP.
1934 Raise an error if no breakpoint with the given number is found.
1935 Also raise an error if the breakpoint already has stop conditions.
1936 If FORCE, define the condition even if it is invalid in
1937 all of the breakpoint locations. */
1938 extern void set_breakpoint_condition (int bpnum, const char *exp,
1939 int from_tty, bool force);
1941 /* Checks if we are catching syscalls or not. */
1942 extern bool catch_syscall_enabled ();
1944 /* Checks if we are catching syscalls with the specific
1945 syscall_number. Used for "filtering" the catchpoints.
1946 Returns false if not, true if we are. */
1947 extern bool catching_syscall_number (int syscall_number);
1949 /* Return a tracepoint with the given number if found. */
1950 extern struct tracepoint *get_tracepoint (int num);
1952 extern struct tracepoint *get_tracepoint_by_number_on_target (int num);
1954 /* Find a tracepoint by parsing a number in the supplied string. */
1955 extern struct tracepoint *
1956 get_tracepoint_by_number (const char **arg,
1957 number_or_range_parser *parser);
1959 /* Return true if B is of tracepoint kind. */
1961 extern bool is_tracepoint (const struct breakpoint *b);
1963 /* Return a vector of all static tracepoints defined at ADDR. */
1964 extern std::vector<breakpoint *> static_tracepoints_here (CORE_ADDR addr);
1966 /* Create an instance of this to start registering breakpoint numbers
1967 for a later "commands" command. */
1969 class scoped_rbreak_breakpoints
1971 public:
1973 scoped_rbreak_breakpoints ();
1974 ~scoped_rbreak_breakpoints ();
1976 DISABLE_COPY_AND_ASSIGN (scoped_rbreak_breakpoints);
1979 /* Breakpoint linked list iterator. */
1981 using breakpoint_list = intrusive_list<breakpoint>;
1983 using breakpoint_iterator = breakpoint_list::iterator;
1985 /* Breakpoint linked list range. */
1987 using breakpoint_range = iterator_range<breakpoint_iterator>;
1989 /* Return a range to iterate over all breakpoints. */
1991 breakpoint_range all_breakpoints ();
1993 /* Breakpoint linked list range, safe against deletion of the current
1994 breakpoint while iterating. */
1996 using breakpoint_safe_range = basic_safe_range<breakpoint_range>;
1998 /* Return a range to iterate over all breakpoints. This range is safe against
1999 deletion of the current breakpoint while iterating. */
2001 breakpoint_safe_range all_breakpoints_safe ();
2003 /* Breakpoint filter to only keep tracepoints. */
2005 struct tracepoint_filter
2007 bool operator() (breakpoint &b)
2008 { return is_tracepoint (&b); }
2011 /* Breakpoint linked list iterator, filtering to only keep tracepoints. */
2013 using tracepoint_iterator
2014 = filtered_iterator<breakpoint_iterator, tracepoint_filter>;
2016 /* Breakpoint linked list range, filtering to only keep tracepoints. */
2018 using tracepoint_range = iterator_range<tracepoint_iterator>;
2020 /* Return a range to iterate over all tracepoints. */
2022 tracepoint_range all_tracepoints ();
2024 /* Return a range to iterate over all breakpoint locations. */
2026 const std::vector<bp_location *> &all_bp_locations ();
2028 /* Nonzero if the specified PC cannot be a location where functions
2029 have been inlined. */
2031 extern int pc_at_non_inline_function (const address_space *aspace,
2032 CORE_ADDR pc,
2033 const target_waitstatus &ws);
2035 extern int user_breakpoint_p (struct breakpoint *);
2037 /* Return true if this breakpoint is pending, false if not. */
2038 extern int pending_breakpoint_p (struct breakpoint *);
2040 /* Attempt to determine architecture of location identified by SAL. */
2041 extern struct gdbarch *get_sal_arch (struct symtab_and_line sal);
2043 extern void breakpoint_free_objfile (struct objfile *objfile);
2045 extern const char *ep_parse_optional_if_clause (const char **arg);
2047 /* Print the "Thread ID hit" part of "Thread ID hit Breakpoint N" to
2048 UIOUT iff debugging multiple threads. */
2049 extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout);
2051 /* Print the specified breakpoint. */
2052 extern void print_breakpoint (breakpoint *bp);
2054 /* Command element for the 'commands' command. */
2055 extern cmd_list_element *commands_cmd_element;
2057 /* Whether to use the fixed output when printing information about a
2058 multi-location breakpoint (see PR 9659). */
2060 extern bool fix_multi_location_breakpoint_output_globally;
2062 /* Whether to use the fixed output when printing information about
2063 commands attached to a breakpoint. */
2065 extern bool fix_breakpoint_script_output_globally;
2067 /* Deal with "catch catch", "catch throw", and "catch rethrow" commands and
2068 the MI equivalents. Sets up to catch events of type EX_EVENT. When
2069 TEMPFLAG is true only the next matching event is caught after which the
2070 catch-point is deleted. If REGEX is not NULL then only exceptions whose
2071 type name matches REGEX will trigger the event. */
2073 extern void catch_exception_event (enum exception_event_kind ex_event,
2074 const char *regex, bool tempflag,
2075 int from_tty);
2077 /* A helper function that prints a shared library stopped event.
2078 IS_CATCHPOINT is true if the event is due to a "catch load"
2079 catchpoint, false otherwise. */
2081 extern void print_solib_event (bool is_catchpoint);
2083 /* Print a message describing any user-breakpoints set at PC. This
2084 concerns with logical breakpoints, so we match program spaces, not
2085 address spaces. */
2087 extern void describe_other_breakpoints (struct gdbarch *,
2088 struct program_space *, CORE_ADDR,
2089 struct obj_section *, int);
2091 /* Enable or disable a breakpoint location LOC. ENABLE
2092 specifies whether to enable or disable. */
2094 extern void enable_disable_bp_location (bp_location *loc, bool enable);
2097 /* Notify interpreters and observers that breakpoint B was modified. */
2099 extern void notify_breakpoint_modified (breakpoint *b);
2101 #endif /* !defined (BREAKPOINT_H) */