GDB (xrefs)
Loading...
Searching...
No Matches
/tmp/gdb-13.1/gdb/breakpoint.h
Go to the documentation of this file.
1/* Data structures associated with breakpoints in GDB.
2 Copyright (C) 1992-2023 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
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.
10
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.
15
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/>. */
18
19#if !defined (BREAKPOINT_H)
20#define BREAKPOINT_H 1
21
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/function-view.h"
33#include "gdbsupport/next-iterator.h"
34#include "gdbsupport/iterator-range.h"
35#include "gdbsupport/refcounted-object.h"
36#include "gdbsupport/safe-iterator.h"
37#include "cli/cli-script.h"
38#include "target/waitstatus.h"
39
40struct block;
44struct thread_info;
45struct bpstat;
46struct bp_location;
47struct linespec_result;
48struct linespec_sals;
49struct inferior;
50
51/* Enum for exception-handling support in 'catch throw', 'catch rethrow',
52 'catch catch' and the MI equivalent. */
53
55{
59};
60
61/* Why are we removing the breakpoint from the target? */
62
64{
65 /* A regular remove. Remove the breakpoint and forget everything
66 about it. */
68
69 /* Detach the breakpoints from a fork child. */
71};
72
73/* This is the maximum number of bytes a breakpoint instruction can
74 take. Feel free to increase it. It's just used in a few places to
75 size arrays that should be independent of the target
76 architecture. */
77
78#define BREAKPOINT_MAX 16
79
80
81/* Type of breakpoint. */
82
84 {
85 bp_none = 0, /* Eventpoint has been deleted */
86 bp_breakpoint, /* Normal breakpoint */
87 bp_hardware_breakpoint, /* Hardware assisted breakpoint */
88 bp_single_step, /* Software single-step */
89 bp_until, /* used by until command */
90 bp_finish, /* used by finish command */
91 bp_watchpoint, /* Watchpoint */
92 bp_hardware_watchpoint, /* Hardware assisted watchpoint */
93 bp_read_watchpoint, /* read watchpoint, (hardware assisted) */
94 bp_access_watchpoint, /* access watchpoint, (hardware assisted) */
95 bp_longjmp, /* secret breakpoint to find longjmp() */
96 bp_longjmp_resume, /* secret breakpoint to escape longjmp() */
97
98 /* Breakpoint placed to the same location(s) like bp_longjmp but used to
99 protect against stale DUMMY_FRAME. Multiple bp_longjmp_call_dummy and
100 one bp_call_dummy are chained together by related_breakpoint for each
101 DUMMY_FRAME. */
103
104 /* An internal breakpoint that is installed on the unwinder's
105 debug hook. */
107 /* An internal breakpoint that is set at the point where an
108 exception will land. */
110
111 /* Used by wait_for_inferior for stepping over subroutine calls,
112 and for skipping prologues. */
114
115 /* Used by wait_for_inferior for stepping over signal
116 handlers. */
118
119 /* Used to detect when a watchpoint expression has gone out of
120 scope. These breakpoints are usually not visible to the user.
121
122 This breakpoint has some interesting properties:
123
124 1) There's always a 1:1 mapping between watchpoints
125 on local variables and watchpoint_scope breakpoints.
126
127 2) It automatically deletes itself and the watchpoint it's
128 associated with when hit.
129
130 3) It can never be disabled. */
132
133 /* The breakpoint at the end of a call dummy. See bp_longjmp_call_dummy it
134 is chained with by related_breakpoint. */
136
137 /* A breakpoint set on std::terminate, that is used to catch
138 otherwise uncaught exceptions thrown during an inferior call. */
140
141 /* Some dynamic linkers (HP, maybe Solaris) can arrange for special
142 code in the inferior to run when significant events occur in the
143 dynamic linker (for example a library is loaded or unloaded).
144
145 By placing a breakpoint in this magic code GDB will get control
146 when these significant events occur. GDB can then re-examine
147 the dynamic linker's data structures to discover any newly loaded
148 dynamic libraries. */
150
151 /* Some multi-threaded systems can arrange for a location in the
152 inferior to be executed when certain thread-related events occur
153 (such as thread creation or thread death).
154
155 By placing a breakpoint at one of these locations, GDB will get
156 control when these events occur. GDB can then update its thread
157 lists etc. */
158
160
161 /* On the same principal, an overlay manager can arrange to call a
162 magic location in the inferior whenever there is an interesting
163 change in overlay status. GDB can update its overlay tables
164 and fiddle with breakpoints in overlays when this breakpoint
165 is hit. */
166
168
169 /* Master copies of longjmp breakpoints. These are always installed
170 as soon as an objfile containing longjmp is loaded, but they are
171 always disabled. While necessary, temporary clones of bp_longjmp
172 type will be created and enabled. */
173
175
176 /* Master copies of std::terminate breakpoints. */
178
179 /* Like bp_longjmp_master, but for exceptions. */
181
183
187 /* Like bp_static_tracepoint but for static markers. */
189
190 /* A dynamic printf stops at the given location, does a formatted
191 print, then automatically continues. (Although this is sort of
192 like a macro packaging up standard breakpoint functionality,
193 GDB doesn't have a way to construct types of breakpoint from
194 elements of behavior.) */
196
197 /* Event for JIT compiled code generation or deletion. */
199
200 /* Breakpoint is placed at the STT_GNU_IFUNC resolver. When hit GDB
201 inserts new bp_gnu_ifunc_resolver_return at the caller.
202 bp_gnu_ifunc_resolver is still being kept here as a different thread
203 may still hit it before bp_gnu_ifunc_resolver_return is hit by the
204 original thread. */
206
207 /* On its hit GDB now know the resolved address of the target
208 STT_GNU_IFUNC function. Associated bp_gnu_ifunc_resolver can be
209 deleted now and the breakpoint moved to the target function entry
210 point. */
212 };
213
214/* States of enablement of breakpoint. */
215
217 {
218 bp_disabled, /* The eventpoint is inactive, and cannot
219 trigger. */
220 bp_enabled, /* The eventpoint is active, and can
221 trigger. */
222 bp_call_disabled, /* The eventpoint has been disabled while a
223 call into the inferior is "in flight",
224 because some eventpoints interfere with
225 the implementation of a call on some
226 targets. The eventpoint will be
227 automatically enabled and reset when the
228 call "lands" (either completes, or stops
229 at another eventpoint). */
230 };
231
232
233/* Disposition of breakpoint. Ie: what to do after hitting it. */
234
236 {
237 disp_del, /* Delete it */
238 disp_del_at_next_stop, /* Delete at next stop,
239 whether hit or not */
240 disp_disable, /* Disable it */
241 disp_donttouch /* Leave it alone */
242 };
243
244/* Status of breakpoint conditions used when synchronizing
245 conditions with the target. */
246
248 {
252 };
253
254/* Information used by targets to insert and remove breakpoints. */
255
257{
258 /* Address space at which the breakpoint was placed. */
260
261 /* Address at which the breakpoint was placed. This is normally
262 the same as REQUESTED_ADDRESS, except when adjustment happens in
263 gdbarch_breakpoint_from_pc. The most common form of adjustment
264 is stripping an alternate ISA marker from the PC which is used
265 to determine the type of breakpoint to insert. */
266 CORE_ADDR placed_address;
267
268 /* Address at which the breakpoint was requested. */
269 CORE_ADDR reqstd_address;
270
271 /* If this is a ranged breakpoint, then this field contains the
272 length of the range that will be watched for execution. */
274
275 /* If the breakpoint lives in memory and reading that memory would
276 give back the breakpoint, instead of the original contents, then
277 the original contents are cached here. Only SHADOW_LEN bytes of
278 this buffer are valid, and only when the breakpoint is inserted. */
280
281 /* The length of the data cached in SHADOW_CONTENTS. */
283
284 /* The breakpoint's kind. It is used in 'kind' parameter in Z
285 packets. */
286 int kind;
287
288 /* Conditions the target should evaluate if it supports target-side
289 breakpoint conditions. These are non-owning pointers. */
290 std::vector<agent_expr *> conditions;
291
292 /* Commands the target should evaluate if it supports target-side
293 breakpoint commands. These are non-owning pointers. */
294 std::vector<agent_expr *> tcommands;
295
296 /* Flag that is true if the breakpoint should be left in place even
297 when GDB is not connected. */
299};
300
301/* GDB maintains two types of information about each breakpoint (or
302 watchpoint, or other related event). The first type corresponds
303 to struct breakpoint; this is a relatively high-level structure
304 which contains the source location(s), stopping conditions, user
305 commands to execute when the breakpoint is hit, and so forth.
306
307 The second type of information corresponds to struct bp_location.
308 Each breakpoint has one or (eventually) more locations associated
309 with it, which represent target-specific and machine-specific
310 mechanisms for stopping the program. For instance, a watchpoint
311 expression may require multiple hardware watchpoints in order to
312 catch all changes in the value of the expression being watched. */
313
315{
320 bp_loc_other /* Miscellaneous... */
322
323class bp_location : public refcounted_object
324{
325public:
326 bp_location () = default;
327
328 /* Construct a bp_location with the type inferred from OWNER's
329 type. */
330 explicit bp_location (breakpoint *owner);
331
332 /* Construct a bp_location with type TYPE. */
334
335 virtual ~bp_location () = default;
336
337 /* Chain pointer to the next breakpoint location for
338 the same parent breakpoint. */
340
341 /* Type of this breakpoint location. */
343
344 /* Each breakpoint location must belong to exactly one higher-level
345 breakpoint. This pointer is NULL iff this bp_location is no
346 longer attached to a breakpoint. For example, when a breakpoint
347 is deleted, its locations may still be found in the
348 moribund_locations list, or if we had stopped for it, in
349 bpstats. */
351
352 /* Conditional. Break only if this expression's value is nonzero.
353 Unlike string form of condition, which is associated with
354 breakpoint, this is associated with location, since if breakpoint
355 has several locations, the evaluation of expression can be
356 different for different locations. Only valid for real
357 breakpoints; a watchpoint's conditional expression is stored in
358 the owner breakpoint object. */
360
361 /* Conditional expression in agent expression
362 bytecode form. This is used for stub-side breakpoint
363 condition evaluation. */
365
366 /* Signals that the condition has changed since the last time
367 we updated the global location list. This means the condition
368 needs to be sent to the target again. This is used together
369 with target-side breakpoint conditions.
370
371 condition_unchanged: It means there has been no condition changes.
372
373 condition_modified: It means this location had its condition modified.
374
375 condition_updated: It means we already marked all the locations that are
376 duplicates of this location and thus we don't need to call
377 force_breakpoint_reinsertion (...) for this location. */
378
380
382
383 /* Signals that breakpoint conditions and/or commands need to be
384 re-synced with the target. This has no use other than
385 target-side breakpoints. */
386 bool needs_update = false;
387
388 /* This location's address is in an unloaded solib, and so this
389 location should not be inserted. It will be automatically
390 enabled when that solib is loaded. */
391 bool shlib_disabled = false;
392
393 /* Is this particular location enabled. */
394 bool enabled = false;
395
396 /* Is this particular location disabled because the condition
397 expression is invalid at this location. For a location to be
398 reported as enabled, the ENABLED field above has to be true *and*
399 the DISABLED_BY_COND field has to be false. */
400 bool disabled_by_cond = false;
401
402 /* True if this breakpoint is now inserted. */
403 bool inserted = false;
404
405 /* True if this is a permanent breakpoint. There is a breakpoint
406 instruction hard-wired into the target's code. Don't try to
407 write another breakpoint instruction on top of it, or restore its
408 value. Step over it using the architecture's
409 gdbarch_skip_permanent_breakpoint method. */
410 bool permanent = false;
411
412 /* True if this is not the first breakpoint in the list
413 for the given address. location of tracepoint can _never_
414 be duplicated with other locations of tracepoints and other
415 kinds of breakpoints, because two locations at the same
416 address may have different actions, so both of these locations
417 should be downloaded and so that `tfind N' always works. */
418 bool duplicate = false;
419
420 /* If we someday support real thread-specific breakpoints, then
421 the breakpoint location will need a thread identifier. */
422
423 /* Data for specific breakpoint types. These could be a union, but
424 simplicity is more important than memory usage for breakpoints. */
425
426 /* Architecture associated with this location's address. May be
427 different from the breakpoint architecture. */
428 struct gdbarch *gdbarch = NULL;
429
430 /* The program space associated with this breakpoint location
431 address. Note that an address space may be represented in more
432 than one program space (e.g. each uClinux program will be given
433 its own program space, but there will only be one address space
434 for all of them), but we must not insert more than one location
435 at the same address in the same address space. */
437
438 /* Note that zero is a perfectly valid code address on some platforms
439 (for example, the mn10200 (OBSOLETE) and mn10300 simulators). NULL
440 is not a special value for this field. Valid for all types except
441 bp_loc_other. */
442 CORE_ADDR address = 0;
443
444 /* For hardware watchpoints, the size of the memory region being
445 watched. For hardware ranged breakpoints, the size of the
446 breakpoint range. */
447 int length = 0;
448
449 /* Type of hardware watchpoint. */
450 target_hw_bp_type watchpoint_type {};
451
452 /* For any breakpoint type with an address, this is the section
453 associated with the address. Used primarily for overlay
454 debugging. */
456
457 /* Address at which breakpoint was requested, either by the user or
458 by GDB for internal breakpoints. This will usually be the same
459 as ``address'' (above) except for cases in which
460 ADJUST_BREAKPOINT_ADDRESS has computed a different address at
461 which to place the breakpoint in order to comply with a
462 processor's architectual constraints. */
463 CORE_ADDR requested_address = 0;
464
465 /* An additional address assigned with this location. This is currently
466 only used by STT_GNU_IFUNC resolver breakpoints to hold the address
467 of the resolver function. */
468 CORE_ADDR related_address = 0;
469
470 /* If the location comes from a probe point, this is the probe associated
471 with it. */
473
474 gdb::unique_xmalloc_ptr<char> function_name;
475
476 /* Details of the placed breakpoint, when inserted. */
478
479 /* Similarly, for the breakpoint at an overlay's LMA, if necessary. */
481
482 /* In a non-stop mode, it's possible that we delete a breakpoint,
483 but as we do that, some still running thread hits that breakpoint.
484 For that reason, we need to keep locations belonging to deleted
485 breakpoints for a bit, so that don't report unexpected SIGTRAP.
486 We can't keep such locations forever, so we use a heuristic --
487 after we process certain number of inferior events since
488 breakpoint was deleted, we retire all locations of that breakpoint.
489 This variable keeps a number of events still to go, when
490 it becomes 0 this location is retired. */
492
493 /* Line number which was used to place this location.
494
495 Breakpoint placed into a comment keeps it's user specified line number
496 despite ADDRESS resolves into a different line number. */
497
498 int line_number = 0;
499
500 /* Symtab which was used to place this location. This is used
501 to find the corresponding source file name. */
502
503 struct symtab *symtab = NULL;
504
505 /* The symbol found by the location parser, if any. This may be used to
506 ascertain when a location spec was set at a different location than
507 the one originally selected by parsing, e.g., inlined symbols. */
508 const struct symbol *symbol = NULL;
509
510 /* Similarly, the minimal symbol found by the location parser, if
511 any. This may be used to ascertain if the location was
512 originally set on a GNU ifunc symbol. */
513 const minimal_symbol *msymbol = NULL;
514
515 /* The objfile the symbol or minimal symbol were found in. */
516 const struct objfile *objfile = NULL;
517};
518
519/* A policy class for bp_location reference counting. */
521{
522 static void incref (bp_location *loc)
523 {
524 loc->incref ();
525 }
526
527 static void decref (bp_location *loc)
528 {
529 gdb_assert (loc->refcount () > 0);
530 loc->decref ();
531 if (loc->refcount () == 0)
532 delete loc;
533 }
534};
535
536/* A gdb::ref_ptr that has been specialized for bp_location. */
537typedef gdb::ref_ptr<bp_location, bp_location_ref_policy>
539
540/* The possible return values for print_bpstat, print_it_normal,
541 print_it_done, print_it_noop. */
543{
544 /* We printed nothing or we need to do some more analysis. */
546
547 /* We printed something, and we *do* desire that something to be
548 followed by a location. */
550
551 /* We printed something, and we do *not* desire that something to be
552 followed by a location. */
554
555 /* We already printed all we needed to print, don't print anything
556 else. */
559
560/* This structure is a collection of function pointers that, if available,
561 will be called instead of the performing the default action for this
562 bptype. */
563
565{
566 /* Create SALs from location spec, storing the result in
567 linespec_result.
568
569 For an explanation about the arguments, see the function
570 `create_sals_from_location_spec_default'.
571
572 This function is called inside `create_breakpoint'. */
574 struct linespec_result *canonical);
575
576 /* This method will be responsible for creating a breakpoint given its SALs.
577 Usually, it just calls `create_breakpoints_sal' (for ordinary
578 breakpoints). However, there may be some special cases where we might
579 need to do some tweaks, e.g., see
580 `strace_marker_create_breakpoints_sal'.
581
582 This function is called inside `create_breakpoint'. */
584 struct linespec_result *,
585 gdb::unique_xmalloc_ptr<char>,
586 gdb::unique_xmalloc_ptr<char>,
587 enum bptype, enum bpdisp, int, int,
588 int, int, int, int, unsigned);
589};
590
592{
593 /* This watchpoint definitely did not trigger. */
595
596 /* Some hardware watchpoint triggered, and it might have been this
597 one, but we do not know which it was. */
599
600 /* This hardware watchpoint definitely did trigger. */
603
604/* Some targets (e.g., embedded PowerPC) need two debug registers to set
605 a watchpoint over a memory region. If this flag is true, GDB will use
606 only one register per watchpoint, thus assuming that all accesses that
607 modify a memory location happen at its starting address. */
608
609extern bool target_exact_watchpoints;
610
611/* bp_location linked list range. */
612
613using bp_location_range = next_range<bp_location>;
614
615/* Note that the ->silent field is not currently used by any commands
616 (though the code is in there if it was to be, and set_raw_breakpoint
617 does set it to 0). I implemented it because I thought it would be
618 useful for a hack I had to put in; I'm going to leave it in because
619 I can see how there might be times when it would indeed be useful */
620
621/* Abstract base class representing all kinds of breakpoints. */
622
624{
625 breakpoint (struct gdbarch *gdbarch_, enum bptype bptype,
626 bool temp = true, const char *cond_string = nullptr);
627
629
630 virtual ~breakpoint () = 0;
631
632 /* Allocate a location for this breakpoint. */
633 virtual struct bp_location *allocate_location ();
634
635 /* Reevaluate a breakpoint. This is necessary after symbols change
636 (e.g., an executable or DSO was loaded, or the inferior just
637 started). */
638 virtual void re_set ()
639 {
640 /* Nothing to re-set. */
641 }
642
643 /* Insert the breakpoint or watchpoint or activate the catchpoint.
644 Return 0 for success, 1 if the breakpoint, watchpoint or
645 catchpoint type is not supported, -1 for failure. */
646 virtual int insert_location (struct bp_location *);
647
648 /* Remove the breakpoint/catchpoint that was previously inserted
649 with the "insert" method above. Return 0 for success, 1 if the
650 breakpoint, watchpoint or catchpoint type is not supported,
651 -1 for failure. */
652 virtual int remove_location (struct bp_location *,
653 enum remove_bp_reason reason);
654
655 /* Return true if it the target has stopped due to hitting
656 breakpoint location BL. This function does not check if we
657 should stop, only if BL explains the stop. ASPACE is the address
658 space in which the event occurred, BP_ADDR is the address at
659 which the inferior stopped, and WS is the target_waitstatus
660 describing the event. */
661 virtual int breakpoint_hit (const struct bp_location *bl,
662 const address_space *aspace,
663 CORE_ADDR bp_addr,
664 const target_waitstatus &ws);
665
666 /* Check internal conditions of the breakpoint referred to by BS.
667 If we should not stop for this breakpoint, set BS->stop to 0. */
668 virtual void check_status (struct bpstat *bs)
669 {
670 /* Always stop. */
671 }
672
673 /* Tell how many hardware resources (debug registers) are needed
674 for this breakpoint. If this function is not provided, then
675 the breakpoint or watchpoint needs one debug register. */
676 virtual int resources_needed (const struct bp_location *);
677
678 /* The normal print routine for this breakpoint, called when we
679 hit it. */
680 virtual enum print_stop_action print_it (const bpstat *bs) const;
681
682 /* Display information about this breakpoint, for "info
683 breakpoints". Returns false if this method should use the
684 default behavior. */
685 virtual bool print_one (bp_location **) const
686 {
687 return false;
688 }
689
690 /* Display extra information about this breakpoint, below the normal
691 breakpoint description in "info breakpoints".
692
693 In the example below, the "address range" line was printed
694 by ranged_breakpoint::print_one_detail.
695
696 (gdb) info breakpoints
697 Num Type Disp Enb Address What
698 2 hw breakpoint keep y in main at test-watch.c:70
699 address range: [0x10000458, 0x100004c7]
700
701 */
702 virtual void print_one_detail (struct ui_out *) const
703 {
704 /* Nothing. */
705 }
706
707 /* Display information about this breakpoint after setting it
708 (roughly speaking; this is called from "mention"). */
709 virtual void print_mention () const;
710
711 /* Print to FP the CLI command that recreates this breakpoint. */
712 virtual void print_recreate (struct ui_file *fp) const;
713
714 /* Return true if this breakpoint explains a signal. See
715 bpstat_explains_signal. */
716 virtual bool explains_signal (enum gdb_signal)
717 {
718 return true;
719 }
720
721 /* Called after evaluating the breakpoint's condition,
722 and only if it evaluated true. */
723 virtual void after_condition_true (struct bpstat *bs)
724 {
725 /* Nothing to do. */
726 }
727
728 /* Return a range of this breakpoint's locations. */
730
732 /* Type of breakpoint. */
734 /* Zero means disabled; remember the info but don't break here. */
736 /* What to do with this breakpoint after we hit it. */
738 /* Number assigned to distinguish breakpoints. */
739 int number = 0;
740
741 /* Location(s) associated with this high-level breakpoint. */
743
744 /* True means a silent breakpoint (don't print frame info if we stop
745 here). */
746 bool silent = false;
747 /* True means display ADDR_STRING to the user verbatim. */
748 bool display_canonical = false;
749 /* Number of stops at this breakpoint that should be continued
750 automatically before really stopping. */
752
753 /* Number of stops at this breakpoint before it will be
754 disabled. */
756
757 /* Chain of command lines to execute when this breakpoint is
758 hit. */
760 /* Stack depth (address of frame). If nonzero, break only if fp
761 equals this. */
763
764 /* The program space used to set the breakpoint. This is only set
765 for breakpoints which are specific to a program space; for
766 non-thread-specific ordinary breakpoints this is NULL. */
768
769 /* The location specification we used to set the breakpoint. */
771
772 /* The filter that should be passed to decode_line_full when
773 re-setting this breakpoint. This may be NULL. */
774 gdb::unique_xmalloc_ptr<char> filter;
775
776 /* For a ranged breakpoint, the location specification we used to
777 find the end of the range. */
779
780 /* Architecture we used to set the breakpoint. */
782 /* Language we used to set the breakpoint. */
784 /* Input radix we used to set the breakpoint. */
786 /* String form of the breakpoint condition (malloc'd), or NULL if
787 there is no condition. */
788 gdb::unique_xmalloc_ptr<char> cond_string;
789
790 /* String form of extra parameters, or NULL if there are none.
791 Malloc'd. */
792 gdb::unique_xmalloc_ptr<char> extra_string;
793
794 /* Holds the address of the related watchpoint_scope breakpoint when
795 using watchpoints on local variables (might the concept of a
796 related breakpoint be useful elsewhere, if not just call it the
797 watchpoint_scope breakpoint or something like that. FIXME). */
799
800 /* Thread number for thread-specific breakpoint, or -1 if don't
801 care. */
802 int thread = -1;
803
804 /* Ada task number for task-specific breakpoint, or 0 if don't
805 care. */
806 int task = 0;
807
808 /* Count of the number of times this breakpoint was taken, dumped
809 with the info, but not used for anything else. Useful for seeing
810 how many times you hit a break prior to the program aborting, so
811 you can back up to just before the abort. */
812 int hit_count = 0;
813
814 /* Is breakpoint's condition not yet parsed because we found no
815 location initially so had no context to parse the condition
816 in. */
818
819 /* With a Python scripting enabled GDB, store a reference to the
820 Python object that has been associated with this breakpoint.
821 This is always NULL for a GDB that is not script enabled. It can
822 sometimes be NULL for enabled GDBs as not all breakpoint types
823 are tracked by the scripting language API. */
825
826 /* Same as py_bp_object, but for Scheme. */
828
829protected:
830
831 /* Helper for breakpoint_ops->print_recreate implementations. Prints
832 the "thread" or "task" condition of B, and then a newline.
833
834 Necessary because most breakpoint implementations accept
835 thread/task conditions at the end of the spec line, like "break foo
836 thread 1", which needs outputting before any breakpoint-type
837 specific extra command necessary for B's recreation. */
838 void print_recreate_thread (struct ui_file *fp) const;
839};
840
841/* Abstract base class representing code breakpoints. User "break"
842 breakpoints, internal and momentary breakpoints, etc. IOW, any
843 kind of breakpoint whose locations are created from SALs. */
845{
847
848 /* Create a breakpoint with SALS as locations. Use LOCATION as a
849 description of the location, and COND_STRING as condition
850 expression. If LOCATION is NULL then create an "address
851 location" from the address in the SAL. */
853 gdb::array_view<const symtab_and_line> sals,
855 gdb::unique_xmalloc_ptr<char> filter,
856 gdb::unique_xmalloc_ptr<char> cond_string,
857 gdb::unique_xmalloc_ptr<char> extra_string,
858 enum bpdisp disposition,
859 int thread, int task, int ignore_count,
860 int from_tty,
861 int enabled, unsigned flags,
863
864 ~code_breakpoint () override = 0;
865
866 /* Add a location for SAL to this breakpoint. */
868
869 void re_set () override;
870 int insert_location (struct bp_location *) override;
871 int remove_location (struct bp_location *,
872 enum remove_bp_reason reason) override;
873 int breakpoint_hit (const struct bp_location *bl,
874 const address_space *aspace,
875 CORE_ADDR bp_addr,
876 const target_waitstatus &ws) override;
877
878protected:
879
880 /* Given the location spec, this method decodes it and returns the
881 SAL locations related to it. For ordinary breakpoints, it calls
882 `decode_line_full'. If SEARCH_PSPACE is not NULL, symbol search
883 is restricted to just that program space.
884
885 This function is called inside `location_spec_to_sals'. */
886 virtual std::vector<symtab_and_line> decode_location_spec
888 struct program_space *search_pspace);
889
890 /* Helper method that does the basic work of re_set. */
891 void re_set_default ();
892
893 /* Find the SaL locations corresponding to the given LOCATION.
894 On return, FOUND will be 1 if any SaL was found, zero otherwise. */
895
896 std::vector<symtab_and_line> location_spec_to_sals
898 struct program_space *search_pspace,
899 int *found);
900};
901
902/* An instance of this type is used to represent a watchpoint,
903 a.k.a. a data breakpoint. */
904
905struct watchpoint : public breakpoint
906{
908
909 void re_set () override;
910 int insert_location (struct bp_location *) override;
911 int remove_location (struct bp_location *,
912 enum remove_bp_reason reason) override;
913 int breakpoint_hit (const struct bp_location *bl,
914 const address_space *aspace,
915 CORE_ADDR bp_addr,
916 const target_waitstatus &ws) override;
917 void check_status (struct bpstat *bs) override;
918 int resources_needed (const struct bp_location *) override;
919
920 /* Tell whether we can downgrade from a hardware watchpoint to a software
921 one. If not, the user will not be able to enable the watchpoint when
922 there are not enough hardware resources available. */
923 virtual bool works_in_software_mode () const;
924
925 enum print_stop_action print_it (const bpstat *bs) const override;
926 void print_mention () const override;
927 void print_recreate (struct ui_file *fp) const override;
928 bool explains_signal (enum gdb_signal) override;
929
930 /* String form of exp to use for displaying to the user (malloc'd),
931 or NULL if none. */
932 gdb::unique_xmalloc_ptr<char> exp_string;
933 /* String form to use for reparsing of EXP (malloc'd) or NULL. */
934 gdb::unique_xmalloc_ptr<char> exp_string_reparse;
935
936 /* The expression we are watching, or NULL if not a watchpoint. */
938 /* The largest block within which it is valid, or NULL if it is
939 valid anywhere (e.g. consists just of global symbols). */
940 const struct block *exp_valid_block;
941 /* The conditional expression if any. */
943 /* The largest block within which it is valid, or NULL if it is
944 valid anywhere (e.g. consists just of global symbols). */
946 /* Value of the watchpoint the last time we checked it, or NULL when
947 we do not know the value yet or the value was not readable. VAL
948 is never lazy. */
950
951 /* True if VAL is valid. If VAL_VALID is set but VAL is NULL,
952 then an error occurred reading the value. */
954
955 /* When watching the location of a bitfield, contains the offset and size of
956 the bitfield. Otherwise contains 0. */
959
960 /* Holds the frame address which identifies the frame this
961 watchpoint should be evaluated in, or `null' if the watchpoint
962 should be evaluated on the outermost frame. */
964
965 /* Holds the thread which identifies the frame this watchpoint
966 should be considered in scope for, or `null_ptid' if the
967 watchpoint should be evaluated in all threads. */
969
970 /* For hardware watchpoints, the triggered status according to the
971 hardware. */
973
974 /* Whether this watchpoint is exact (see
975 target_exact_watchpoints). */
976 int exact;
977
978 /* The mask address for a masked hardware watchpoint. */
979 CORE_ADDR hw_wp_mask;
980};
981
982/* Return true if BPT is either a software breakpoint or a hardware
983 breakpoint. */
984
985extern bool is_breakpoint (const struct breakpoint *bpt);
986
987/* Return true if BPT is of any watchpoint kind, hardware or
988 software. */
989
990extern bool is_watchpoint (const struct breakpoint *bpt);
991
992/* Return true if BPT is a C++ exception catchpoint (catch
993 catch/throw/rethrow). */
994
996
997/* An instance of this type is used to represent all kinds of
998 tracepoints. */
999
1001{
1003
1004 int breakpoint_hit (const struct bp_location *bl,
1005 const address_space *aspace, CORE_ADDR bp_addr,
1006 const target_waitstatus &ws) override;
1007 void print_one_detail (struct ui_out *uiout) const override;
1008 void print_mention () const override;
1009 void print_recreate (struct ui_file *fp) const override;
1010
1011 /* Number of times this tracepoint should single-step and collect
1012 additional data. */
1013 long step_count = 0;
1014
1015 /* Number of times this tracepoint should be hit before
1016 disabling/ending. */
1017 int pass_count = 0;
1018
1019 /* The number of the tracepoint on the target. */
1021
1022 /* The total space taken by all the trace frames for this
1023 tracepoint. */
1024 ULONGEST traceframe_usage = 0;
1025
1026 /* The static tracepoint marker id, if known. */
1028
1029 /* LTTng/UST allow more than one marker with the same ID string,
1030 although it unadvised because it confuses tools. When setting
1031 static tracepoints by marker ID, this will record the index in
1032 the array of markers we found for the given marker ID for which
1033 this static tracepoint corresponds. When resetting breakpoints,
1034 we will use this index to try to find the same marker again. */
1036};
1037
1038/* The abstract base class for catchpoints. */
1039
1040struct catchpoint : public breakpoint
1041{
1042 /* If TEMP is true, then make the breakpoint temporary. If
1043 COND_STRING is not NULL, then store it in the breakpoint. */
1044 catchpoint (struct gdbarch *gdbarch, bool temp, const char *cond_string);
1045
1046 ~catchpoint () override = 0;
1047};
1048
1049
1050/* The following stuff is an abstract data type "bpstat" ("breakpoint
1051 status"). This provides the ability to determine whether we have
1052 stopped at a breakpoint, and what we should do about it. */
1053
1054/* Clears a chain of bpstat, freeing storage
1055 of each. */
1056extern void bpstat_clear (bpstat **);
1057
1058/* Return a copy of a bpstat. Like "bs1 = bs2" but all storage that
1059 is part of the bpstat is copied as well. */
1060extern bpstat *bpstat_copy (bpstat *);
1061
1062/* Build the (raw) bpstat chain for the stop information given by ASPACE,
1063 BP_ADDR, and WS. Returns the head of the bpstat chain. */
1064
1065extern bpstat *build_bpstat_chain (const address_space *aspace,
1066 CORE_ADDR bp_addr,
1067 const target_waitstatus &ws);
1068
1069/* Get a bpstat associated with having just stopped at address
1070 BP_ADDR in thread PTID. STOP_CHAIN may be supplied as a previously
1071 computed stop chain or NULL, in which case the stop chain will be
1072 computed using build_bpstat_chain.
1073
1074 Determine whether we stopped at a breakpoint, etc, or whether we
1075 don't understand this stop. Result is a chain of bpstat's such
1076 that:
1077
1078 if we don't understand the stop, the result is a null pointer.
1079
1080 if we understand why we stopped, the result is not null.
1081
1082 Each element of the chain refers to a particular breakpoint or
1083 watchpoint at which we have stopped. (We may have stopped for
1084 several reasons concurrently.)
1085
1086 Each element of the chain has valid next, breakpoint_at,
1087 commands, FIXME??? fields.
1088
1089 watchpoints_triggered must be called beforehand to set up each
1090 watchpoint's watchpoint_triggered value.
1091
1092*/
1093
1094extern bpstat *bpstat_stop_status (const address_space *aspace,
1095 CORE_ADDR pc, thread_info *thread,
1096 const target_waitstatus &ws,
1097 bpstat *stop_chain = nullptr);
1098
1099/* Like bpstat_stop_status, but clears all watchpoints'
1100 watchpoint_triggered flag. Unlike with bpstat_stop_status, there's
1101 no need to call watchpoint_triggered beforehand. You'll typically
1102 use this variant when handling a known-non-watchpoint event, like a
1103 fork or exec event. */
1104
1105extern bpstat *bpstat_stop_status_nowatch (const address_space *aspace,
1106 CORE_ADDR bp_addr,
1107 thread_info *thread,
1108 const target_waitstatus &ws);
1109
1110
1111
1112/* This bpstat_what stuff tells wait_for_inferior what to do with a
1113 breakpoint (a challenging task).
1114
1115 The enum values order defines priority-like order of the actions.
1116 Once you've decided that some action is appropriate, you'll never
1117 go back and decide something of a lower priority is better. Each
1118 of these actions is mutually exclusive with the others. That
1119 means, that if you find yourself adding a new action class here and
1120 wanting to tell GDB that you have two simultaneous actions to
1121 handle, something is wrong, and you probably don't actually need a
1122 new action type.
1123
1124 Note that a step resume breakpoint overrides another breakpoint of
1125 signal handling (see comment in wait_for_inferior at where we set
1126 the step_resume breakpoint). */
1127
1129 {
1130 /* Perform various other tests; that is, this bpstat does not
1131 say to perform any action (e.g. failed watchpoint and nothing
1132 else). */
1134
1135 /* Remove breakpoints, single step once, then put them back in and
1136 go back to what we were doing. It's possible that this should
1137 be removed from the main_action and put into a separate field,
1138 to more cleanly handle
1139 BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE. */
1141
1142 /* Set longjmp_resume breakpoint, remove all other breakpoints,
1143 and continue. The "remove all other breakpoints" part is
1144 required if we are also stepping over another breakpoint as
1145 well as doing the longjmp handling. */
1147
1148 /* Clear longjmp_resume breakpoint, then handle as
1149 BPSTAT_WHAT_KEEP_CHECKING. */
1151
1152 /* Clear step resume breakpoint, and keep checking. */
1154
1155 /* Rather than distinguish between noisy and silent stops here, it
1156 might be cleaner to have bpstat_print make that decision (also
1157 taking into account stop_print_frame and source_only). But the
1158 implications are a bit scary (interaction with auto-displays,
1159 etc.), so I won't try it. */
1160
1161 /* Stop silently. */
1163
1164 /* Stop and print. */
1166
1167 /* Clear step resume breakpoint, and keep checking. High-priority
1168 step-resume breakpoints are used when even if there's a user
1169 breakpoint at the current PC when we set the step-resume
1170 breakpoint, we don't want to re-handle any breakpoint other
1171 than the step-resume when it's hit; instead we want to move
1172 past the breakpoint. This is used in the case of skipping
1173 signal handlers. */
1175 };
1176
1177/* An enum indicating the kind of "stack dummy" stop. This is a bit
1178 of a misnomer because only one kind of truly a stack dummy. */
1180 {
1181 /* We didn't stop at a stack dummy breakpoint. */
1183
1184 /* Stopped at a stack dummy. */
1186
1187 /* Stopped at std::terminate. */
1190
1192 {
1194
1195 /* Did we hit a call dummy breakpoint? This only goes with a
1196 main_action of BPSTAT_WHAT_STOP_SILENT or
1197 BPSTAT_WHAT_STOP_NOISY (the concept of continuing from a call
1198 dummy without popping the frame is not a useful one). */
1200
1201 /* Used for BPSTAT_WHAT_SET_LONGJMP_RESUME and
1202 BPSTAT_WHAT_CLEAR_LONGJMP_RESUME. True if we are handling a
1203 longjmp, false if we are handling an exception. */
1205 };
1206
1207/* Tell what to do about this bpstat. */
1208struct bpstat_what bpstat_what (bpstat *);
1209
1210/* Run breakpoint event callbacks associated with the breakpoints that
1211 triggered. */
1212extern void bpstat_run_callbacks (bpstat *bs_head);
1213
1214/* Find the bpstat associated with a breakpoint. NULL otherwise. */
1216
1217/* True if a signal that we got in target_wait() was due to
1218 circumstances explained by the bpstat; the signal is therefore not
1219 random. */
1220extern bool bpstat_explains_signal (bpstat *, enum gdb_signal);
1221
1222/* True if this bpstat causes a stop. */
1223extern bool bpstat_causes_stop (bpstat *);
1224
1225/* True if we should step constantly (e.g. watchpoints on machines
1226 without hardware support). This isn't related to a specific bpstat,
1227 just to things like whether watchpoints are set. */
1228extern bool bpstat_should_step ();
1229
1230/* Print a message indicating what happened. */
1232
1233/* Put in *NUM the breakpoint number of the first breakpoint we are
1234 stopped at. *BSP upon return is a bpstat which points to the
1235 remaining breakpoints stopped at (but which is not guaranteed to be
1236 good for anything but further calls to bpstat_num).
1237
1238 Return 0 if passed a bpstat which does not indicate any breakpoints.
1239 Return -1 if stopped at a breakpoint that has been deleted since
1240 we set it.
1241 Return 1 otherwise. */
1242extern int bpstat_num (bpstat **, int *);
1243
1244/* If BS indicates a breakpoint and this breakpoint has several code locations,
1245 return the location number of BS, otherwise return 0. */
1246
1247extern int bpstat_locno (const bpstat *bs);
1248
1249/* Print BS breakpoint number optionally followed by a . and breakpoint locno.
1250
1251 For a breakpoint with only one code location, outputs the signed field
1252 "bkptno" breakpoint number of BS (as returned by bpstat_num).
1253 If BS has several code locations, outputs a '.' character followed by
1254 the signed field "locno" (as returned by bpstat_locno). */
1255
1256extern void print_num_locno (const bpstat *bs, struct ui_out *);
1257
1258/* Perform actions associated with the stopped inferior. Actually, we
1259 just use this for breakpoint commands. Perhaps other actions will
1260 go here later, but this is executed at a late time (from the
1261 command loop). */
1262extern void bpstat_do_actions (void);
1263
1264/* Modify all entries of STOP_BPSTAT of INFERIOR_PTID so that the actions will
1265 not be performed. */
1266extern void bpstat_clear_actions (void);
1267
1268/* Implementation: */
1269
1270/* Values used to tell the printing routine how to behave for this
1271 bpstat. */
1273 {
1274 /* This is used when we want to do a normal printing of the reason
1275 for stopping. The output will depend on the type of eventpoint
1276 we are dealing with. This is the default value, most commonly
1277 used. */
1279 /* This is used when nothing should be printed for this bpstat
1280 entry. */
1282 /* This is used when everything which needs to be printed has
1283 already been printed. But we still want to print the frame. */
1286
1288 {
1289 bpstat ();
1290 bpstat (struct bp_location *bl, bpstat ***bs_link_pointer);
1291
1292 bpstat (const bpstat &);
1293 bpstat &operator= (const bpstat &) = delete;
1294
1295 /* Linked list because there can be more than one breakpoint at
1296 the same place, and a bpstat reflects the fact that all have
1297 been hit. */
1299
1300 /* Location that caused the stop. Locations are refcounted, so
1301 this will never be NULL. Note that this location may end up
1302 detached from a breakpoint, but that does not necessary mean
1303 that the struct breakpoint is gone. E.g., consider a
1304 watchpoint with a condition that involves an inferior function
1305 call. Watchpoint locations are recreated often (on resumes,
1306 hence on infcalls too). Between creating the bpstat and after
1307 evaluating the watchpoint condition, this location may hence
1308 end up detached from its original owner watchpoint, even though
1309 the watchpoint is still listed. If it's condition evaluates as
1310 true, we still want this location to cause a stop, and we will
1311 still need to know which watchpoint it was originally attached.
1312 What this means is that we should not (in most cases) follow
1313 the `bpstat->bp_location->owner' link, but instead use the
1314 `breakpoint_at' field below. */
1316
1317 /* Breakpoint that caused the stop. This is nullified if the
1318 breakpoint ends up being deleted. See comments on
1319 `bp_location_at' above for why do we need this field instead of
1320 following the location's owner. */
1322
1323 /* The associated command list. */
1325
1326 /* Old value associated with a watchpoint. */
1328
1329 /* Nonzero if this breakpoint tells us to print the frame. */
1330 char print;
1331
1332 /* Nonzero if this breakpoint tells us to stop. */
1333 char stop;
1334
1335 /* Tell bpstat_print and print_bp_stop_message how to print stuff
1336 associated with this element of the bpstat chain. */
1338 };
1339
1341 {
1345 inf_execd
1347
1348/* The possible return values for breakpoint_here_p.
1349 We guarantee that zero always means "no breakpoint here". */
1351 {
1356
1357
1358/* Prototypes for breakpoint-related functions. */
1359
1361 CORE_ADDR);
1362
1363/* Return true if an enabled breakpoint exists in the range defined by
1364 ADDR and LEN, in ASPACE. */
1365extern int breakpoint_in_range_p (const address_space *aspace,
1366 CORE_ADDR addr, ULONGEST len);
1367
1368extern int moribund_breakpoint_here_p (const address_space *, CORE_ADDR);
1369
1370extern int breakpoint_inserted_here_p (const address_space *,
1371 CORE_ADDR);
1372
1374 CORE_ADDR);
1375
1376/* Return non-zero iff there is a hardware breakpoint inserted at
1377 PC. */
1379 CORE_ADDR);
1380
1381/* Check whether any location of BP is inserted at PC. */
1382
1384 const address_space *aspace,
1385 CORE_ADDR pc);
1386
1388 CORE_ADDR);
1389
1390/* Returns true if there's a hardware watchpoint or access watchpoint
1391 inserted in the range defined by ADDR and LEN. */
1393 CORE_ADDR addr,
1394 ULONGEST len);
1395
1396/* Returns true if {ASPACE1,ADDR1} and {ASPACE2,ADDR2} represent the
1397 same breakpoint location. In most targets, this can only be true
1398 if ASPACE1 matches ASPACE2. On targets that have global
1399 breakpoints, the address space doesn't really matter. */
1400
1401extern int breakpoint_address_match (const address_space *aspace1,
1402 CORE_ADDR addr1,
1403 const address_space *aspace2,
1404 CORE_ADDR addr2);
1405
1406extern void until_break_command (const char *, int, int);
1407
1408/* Initialize a struct bp_location. */
1409
1411 (code_breakpoint *b,
1412 struct program_space *filter_pspace,
1413 gdb::array_view<const symtab_and_line> sals,
1414 gdb::array_view<const symtab_and_line> sals_end);
1415
1416extern void breakpoint_re_set (void);
1417
1418extern void breakpoint_re_set_thread (struct breakpoint *);
1419
1420extern void delete_breakpoint (struct breakpoint *);
1421
1423{
1424 void operator() (struct breakpoint *b) const
1425 {
1427 }
1428};
1429
1430typedef std::unique_ptr<struct breakpoint, breakpoint_deleter> breakpoint_up;
1431
1433 (struct gdbarch *, struct symtab_and_line, struct frame_id, enum bptype);
1434
1436 (struct gdbarch *, CORE_ADDR pc, enum bptype type);
1437
1438extern struct breakpoint *clone_momentary_breakpoint (struct breakpoint *bpkt);
1439
1440extern void set_ignore_count (int, int, int);
1441
1442extern void breakpoint_init_inferior (enum inf_context);
1443
1444extern void breakpoint_auto_delete (bpstat *);
1445
1446/* Return the chain of command lines to execute when this breakpoint
1447 is hit. */
1448extern struct command_line *breakpoint_commands (struct breakpoint *b);
1449
1450/* Return a string image of DISP. The string is static, and thus should
1451 NOT be deallocated after use. */
1452const char *bpdisp_text (enum bpdisp disp);
1453
1454extern void break_command (const char *, int);
1455
1456extern void watch_command_wrapper (const char *, int, bool);
1457extern void awatch_command_wrapper (const char *, int, bool);
1458extern void rwatch_command_wrapper (const char *, int, bool);
1459extern void tbreak_command (const char *, int);
1460
1461extern const struct breakpoint_ops code_breakpoint_ops;
1462
1463/* Arguments to pass as context to some catch command handlers. */
1464#define CATCH_PERMANENT ((void *) (uintptr_t) 0)
1465#define CATCH_TEMPORARY ((void *) (uintptr_t) 1)
1466
1467/* Like add_cmd, but add the command to both the "catch" and "tcatch"
1468 lists, and pass some additional user data to the command
1469 function. */
1470
1471extern void
1472 add_catch_command (const char *name, const char *docstring,
1474 completer_ftype *completer,
1475 void *user_data_catch,
1476 void *user_data_tcatch);
1477
1478/* Add breakpoint B on the breakpoint list, and notify the user, the
1479 target and breakpoint_created observers of its existence. If
1480 INTERNAL is non-zero, the breakpoint number will be allocated from
1481 the internal breakpoint count. If UPDATE_GLL is non-zero,
1482 update_global_location_list will be called. */
1483
1484extern void install_breakpoint (int internal, std::unique_ptr<breakpoint> &&b,
1485 int update_gll);
1486
1487/* Returns the breakpoint ops appropriate for use with with LOCSPEC
1488 and according to IS_TRACEPOINT. Use this to ensure, for example,
1489 that you pass the correct ops to create_breakpoint for probe
1490 location specs. If LOCSPEC is NULL, returns
1491 code_breakpoint_ops. */
1492
1494 (const location_spec *locspec, bool is_tracepoint);
1495
1496/* Flags that can be passed down to create_breakpoint, etc., to affect
1497 breakpoint creation in several ways. */
1498
1500 {
1501 /* We're adding a breakpoint to our tables that is already
1502 inserted in the target. */
1505
1506/* Set a breakpoint. This function is shared between CLI and MI
1507 functions for setting a breakpoint at LOCSPEC.
1508
1509 This function has two major modes of operations, selected by the
1510 PARSE_EXTRA parameter.
1511
1512 If PARSE_EXTRA is zero, LOCSPEC is just the breakpoint's location
1513 spec, with condition, thread, and extra string specified by the
1514 COND_STRING, THREAD, and EXTRA_STRING parameters.
1515
1516 If PARSE_EXTRA is non-zero, this function will attempt to extract
1517 the condition, thread, and extra string from EXTRA_STRING, ignoring
1518 the similarly named parameters.
1519
1520 If FORCE_CONDITION is true, the condition is accepted even when it is
1521 invalid at all of the locations. However, if PARSE_EXTRA is non-zero,
1522 the FORCE_CONDITION parameter is ignored and the corresponding argument
1523 is parsed from EXTRA_STRING.
1524
1525 If INTERNAL is non-zero, the breakpoint number will be allocated
1526 from the internal breakpoint count.
1527
1528 Returns true if any breakpoint was created; false otherwise. */
1529
1530extern int create_breakpoint (struct gdbarch *gdbarch,
1531 struct location_spec *locspec,
1532 const char *cond_string, int thread,
1533 const char *extra_string,
1534 bool force_condition,
1535 int parse_extra,
1536 int tempflag, enum bptype wanted_type,
1537 int ignore_count,
1539 const struct breakpoint_ops *ops,
1540 int from_tty,
1541 int enabled,
1542 int internal, unsigned flags);
1543
1544extern void insert_breakpoints (void);
1545
1546extern int remove_breakpoints (void);
1547
1548/* Remove breakpoints of inferior INF. */
1549
1550extern void remove_breakpoints_inf (inferior *inf);
1551
1552/* This function can be used to update the breakpoint package's state
1553 after an exec() system call has been executed.
1554
1555 This function causes the following:
1556
1557 - All eventpoints are marked "not inserted".
1558 - All eventpoints with a symbolic address are reset such that
1559 the symbolic address must be reevaluated before the eventpoints
1560 can be reinserted.
1561 - The solib breakpoints are explicitly removed from the breakpoint
1562 list.
1563 - A step-resume breakpoint, if any, is explicitly removed from the
1564 breakpoint list.
1565 - All eventpoints without a symbolic address are removed from the
1566 breakpoint list. */
1567extern void update_breakpoints_after_exec (void);
1568
1569/* This function can be used to physically remove hardware breakpoints
1570 and watchpoints from the specified traced inferior process, without
1571 modifying the breakpoint package's state. This can be useful for
1572 those targets which support following the processes of a fork() or
1573 vfork() system call, when one of the resulting two processes is to
1574 be detached and allowed to run free.
1575
1576 It is an error to use this function on the process whose id is
1577 inferior_ptid. */
1578extern int detach_breakpoints (ptid_t ptid);
1579
1580/* This function is called when program space PSPACE is about to be
1581 deleted. It takes care of updating breakpoints to not reference
1582 this PSPACE anymore. */
1583extern void breakpoint_program_space_exit (struct program_space *pspace);
1584
1585extern void set_longjmp_breakpoint (struct thread_info *tp,
1586 struct frame_id frame);
1587extern void delete_longjmp_breakpoint (int thread);
1588
1589/* Mark all longjmp breakpoints from THREAD for later deletion. */
1590extern void delete_longjmp_breakpoint_at_next_stop (int thread);
1591
1594
1595extern void enable_overlay_breakpoints (void);
1596extern void disable_overlay_breakpoints (void);
1597
1598extern void set_std_terminate_breakpoint (void);
1599extern void delete_std_terminate_breakpoint (void);
1600
1601/* These functions respectively disable or reenable all currently
1602 enabled watchpoints. When disabled, the watchpoints are marked
1603 call_disabled. When re-enabled, they are marked enabled.
1604
1605 The intended client of these functions is call_function_by_hand.
1606
1607 The inferior must be stopped, and all breakpoints removed, when
1608 these functions are used.
1609
1610 The need for these functions is that on some targets (e.g., HP-UX),
1611 gdb is unable to unwind through the dummy frame that is pushed as
1612 part of the implementation of a call command. Watchpoints can
1613 cause the inferior to stop in places where this frame is visible,
1614 and that can cause execution control to become very confused.
1615
1616 Note that if a user sets breakpoints in an interactively called
1617 function, the call_disabled watchpoints will have been re-enabled
1618 when the first such breakpoint is reached. However, on targets
1619 that are unable to unwind through the call dummy frame, watches
1620 of stack-based storage may then be deleted, because gdb will
1621 believe that their watched storage is out of scope. (Sigh.) */
1623
1625
1626/* These functions disable and re-enable all breakpoints during
1627 inferior startup. They are intended to be called from solib
1628 code where necessary. This is needed on platforms where the
1629 main executable is relocated at some point during startup
1630 processing, making breakpoint addresses invalid.
1631
1632 If additional breakpoints are created after the routine
1633 disable_breakpoints_before_startup but before the routine
1634 enable_breakpoints_after_startup was called, they will also
1635 be marked as disabled. */
1636extern void disable_breakpoints_before_startup (void);
1637extern void enable_breakpoints_after_startup (void);
1638
1639/* For script interpreters that need to define breakpoint commands
1640 after they've already read the commands into a struct
1641 command_line. */
1643 (const char *arg, struct command_line *cmd);
1644
1645extern void clear_breakpoint_hit_counts (void);
1646
1647extern struct breakpoint *get_breakpoint (int num);
1648
1649/* The following are for displays, which aren't really breakpoints,
1650 but here is as good a place as any for them. */
1651
1652extern void disable_current_display (void);
1653
1654extern void do_displays (void);
1655
1656extern void disable_display (int);
1657
1658extern void clear_displays (void);
1659
1660extern void disable_breakpoint (struct breakpoint *);
1661
1662extern void enable_breakpoint (struct breakpoint *);
1663
1664extern void breakpoint_set_commands (struct breakpoint *b,
1666
1667extern void breakpoint_set_silent (struct breakpoint *b, int silent);
1668
1669extern void breakpoint_set_thread (struct breakpoint *b, int thread);
1670
1671extern void breakpoint_set_task (struct breakpoint *b, int task);
1672
1673/* Clear the "inserted" flag in all breakpoints. */
1674extern void mark_breakpoints_out (void);
1675
1676extern struct breakpoint *create_jit_event_breakpoint (struct gdbarch *,
1677 CORE_ADDR);
1678
1679extern struct breakpoint *create_solib_event_breakpoint (struct gdbarch *,
1680 CORE_ADDR);
1681
1682/* Create an solib event breakpoint at ADDRESS in the current program
1683 space, and immediately try to insert it. Returns a pointer to the
1684 breakpoint on success. Deletes the new breakpoint and returns NULL
1685 if inserting the breakpoint fails. */
1687 (struct gdbarch *gdbarch, CORE_ADDR address);
1688
1689extern struct breakpoint *create_thread_event_breakpoint (struct gdbarch *,
1690 CORE_ADDR);
1691
1692extern void remove_jit_event_breakpoints (void);
1693
1694extern void remove_solib_event_breakpoints (void);
1695
1696/* Mark solib event breakpoints of the current program space with
1697 delete at next stop disposition. */
1699
1700extern void disable_breakpoints_in_shlibs (void);
1701
1702/* This function returns true if B is a catchpoint. */
1703
1704extern bool is_catchpoint (struct breakpoint *b);
1705
1706/* Shared helper function (MI and CLI) for creating and installing
1707 a shared object event catchpoint. If IS_LOAD is true then
1708 the events to be caught are load events, otherwise they are
1709 unload events. If IS_TEMP is true the catchpoint is a
1710 temporary one. If ENABLED is true the catchpoint is
1711 created in an enabled state. */
1712
1713extern void add_solib_catchpoint (const char *arg, bool is_load, bool is_temp,
1714 bool enabled);
1715
1716/* Create and insert a new software single step breakpoint for the
1717 current thread. May be called multiple times; each time will add a
1718 new location to the set of potential addresses the next instruction
1719 is at. */
1720extern void insert_single_step_breakpoint (struct gdbarch *,
1721 const address_space *,
1722 CORE_ADDR);
1723
1724/* Insert all software single step breakpoints for the current frame.
1725 Return true if any software single step breakpoints are inserted,
1726 otherwise, return false. */
1727extern int insert_single_step_breakpoints (struct gdbarch *);
1728
1729/* Check whether any hardware watchpoints have triggered or not,
1730 according to the target, and record it in each watchpoint's
1731 'watchpoint_triggered' field. */
1733
1734/* Helper for transparent breakpoint hiding for memory read and write
1735 routines.
1736
1737 Update one of READBUF or WRITEBUF with either the shadows
1738 (READBUF), or the breakpoint instructions (WRITEBUF) of inserted
1739 breakpoints at the memory range defined by MEMADDR and extending
1740 for LEN bytes. If writing, then WRITEBUF is a copy of WRITEBUF_ORG
1741 on entry.*/
1742extern void breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
1743 const gdb_byte *writebuf_org,
1744 ULONGEST memaddr, LONGEST len);
1745
1746/* Return true if breakpoints should be inserted now. That'll be the
1747 case if either:
1748
1749 - the target has global breakpoints.
1750
1751 - "breakpoint always-inserted" is on, and the target has
1752 execution.
1753
1754 - threads are executing.
1755*/
1756extern int breakpoints_should_be_inserted_now (void);
1757
1758/* Called each time new event from target is processed.
1759 Retires previously deleted breakpoint locations that
1760 in our opinion won't ever trigger. */
1761extern void breakpoint_retire_moribund (void);
1762
1763/* Set break condition of breakpoint B to EXP.
1764 If FORCE, define the condition even if it is invalid in
1765 all of the breakpoint locations. */
1766extern void set_breakpoint_condition (struct breakpoint *b, const char *exp,
1767 int from_tty, bool force);
1768
1769/* Set break condition for the breakpoint with number BPNUM to EXP.
1770 Raise an error if no breakpoint with the given number is found.
1771 Also raise an error if the breakpoint already has stop conditions.
1772 If FORCE, define the condition even if it is invalid in
1773 all of the breakpoint locations. */
1774extern void set_breakpoint_condition (int bpnum, const char *exp,
1775 int from_tty, bool force);
1776
1777/* Checks if we are catching syscalls or not.
1778 Returns 0 if not, greater than 0 if we are. */
1779extern int catch_syscall_enabled (void);
1780
1781/* Checks if we are catching syscalls with the specific
1782 syscall_number. Used for "filtering" the catchpoints.
1783 Returns false if not, true if we are. */
1784extern bool catching_syscall_number (int syscall_number);
1785
1786/* Return a tracepoint with the given number if found. */
1787extern struct tracepoint *get_tracepoint (int num);
1788
1789extern struct tracepoint *get_tracepoint_by_number_on_target (int num);
1790
1791/* Find a tracepoint by parsing a number in the supplied string. */
1792extern struct tracepoint *
1793 get_tracepoint_by_number (const char **arg,
1794 number_or_range_parser *parser);
1795
1796/* Return true if B is of tracepoint kind. */
1797
1798extern bool is_tracepoint (const struct breakpoint *b);
1799
1800/* Return a vector of all static tracepoints defined at ADDR. */
1801extern std::vector<breakpoint *> static_tracepoints_here (CORE_ADDR addr);
1802
1803/* Create an instance of this to start registering breakpoint numbers
1804 for a later "commands" command. */
1805
1807{
1808public:
1809
1812
1814};
1815
1816/* Breakpoint linked list iterator. */
1817
1818using breakpoint_iterator = next_iterator<breakpoint>;
1819
1820/* Breakpoint linked list range. */
1821
1822using breakpoint_range = iterator_range<breakpoint_iterator>;
1823
1824/* Return a range to iterate over all breakpoints. */
1825
1827
1828/* Breakpoint linked list range, safe against deletion of the current
1829 breakpoint while iterating. */
1830
1831using breakpoint_safe_range = basic_safe_range<breakpoint_range>;
1832
1833/* Return a range to iterate over all breakpoints. This range is safe against
1834 deletion of the current breakpoint while iterating. */
1835
1837
1838/* Breakpoint filter to only keep tracepoints. */
1839
1841{
1843 { return is_tracepoint (b); }
1844};
1845
1846/* Breakpoint linked list iterator, filtering to only keep tracepoints. */
1847
1849 = filtered_iterator<breakpoint_iterator, tracepoint_filter>;
1850
1851/* Breakpoint linked list range, filtering to only keep tracepoints. */
1852
1853using tracepoint_range = iterator_range<tracepoint_iterator>;
1854
1855/* Return a range to iterate over all tracepoints. */
1856
1858
1859/* Return a range to iterate over all breakpoint locations. */
1860
1861const std::vector<bp_location *> &all_bp_locations ();
1862
1863/* Nonzero if the specified PC cannot be a location where functions
1864 have been inlined. */
1865
1866extern int pc_at_non_inline_function (const address_space *aspace,
1867 CORE_ADDR pc,
1868 const target_waitstatus &ws);
1869
1870extern int user_breakpoint_p (struct breakpoint *);
1871
1872/* Return true if this breakpoint is pending, false if not. */
1873extern int pending_breakpoint_p (struct breakpoint *);
1874
1875/* Attempt to determine architecture of location identified by SAL. */
1876extern struct gdbarch *get_sal_arch (struct symtab_and_line sal);
1877
1878extern void breakpoint_free_objfile (struct objfile *objfile);
1879
1880extern const char *ep_parse_optional_if_clause (const char **arg);
1881
1882/* Print the "Thread ID hit" part of "Thread ID hit Breakpoint N" to
1883 UIOUT iff debugging multiple threads. */
1884extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout);
1885
1886/* Print the specified breakpoint. */
1887extern void print_breakpoint (breakpoint *bp);
1888
1889/* Command element for the 'commands' command. */
1891
1892/* Whether to use the fixed output when printing information about a
1893 multi-location breakpoint (see PR 9659). */
1894
1896
1897/* Whether to use the fixed output when printing information about
1898 commands attached to a breakpoint. */
1899
1901
1902/* Deal with "catch catch", "catch throw", and "catch rethrow" commands and
1903 the MI equivalents. Sets up to catch events of type EX_EVENT. When
1904 TEMPFLAG is true only the next matching event is caught after which the
1905 catch-point is deleted. If REGEX is not NULL then only exceptions whose
1906 type name matches REGEX will trigger the event. */
1907
1908extern void catch_exception_event (enum exception_event_kind ex_event,
1909 const char *regex, bool tempflag,
1910 int from_tty);
1911
1912/* A helper function that prints a shared library stopped event.
1913 IS_CATCHPOINT is true if the event is due to a "catch load"
1914 catchpoint, false otherwise. */
1915
1916extern void print_solib_event (bool is_catchpoint);
1917
1918/* Print a message describing any user-breakpoints set at PC. This
1919 concerns with logical breakpoints, so we match program spaces, not
1920 address spaces. */
1921
1922extern void describe_other_breakpoints (struct gdbarch *,
1923 struct program_space *, CORE_ADDR,
1924 struct obj_section *, int);
1925
1926/* Enable or disable a breakpoint location LOC. ENABLE
1927 specifies whether to enable or disable. */
1928
1930
1931#endif /* !defined (BREAKPOINT_H) */
const char *const name
Definition: aarch64-tdep.c:67
std::unique_ptr< agent_expr > agent_expr_up
Definition: ax.h:157
static enum auto_boolean pending_break_support
Definition: breakpoint.c:467
void print_breakpoint(breakpoint *bp)
Definition: breakpoint.c:6762
void breakpoint_program_space_exit(struct program_space *pspace)
Definition: breakpoint.c:3009
void breakpoint_re_set(void)
Definition: breakpoint.c:12917
struct breakpoint * create_solib_event_breakpoint(struct gdbarch *, CORE_ADDR)
Definition: breakpoint.c:7764
int user_breakpoint_p(struct breakpoint *)
Definition: breakpoint.c:6772
const std::vector< bp_location * > & all_bp_locations()
Definition: breakpoint.c:657
void check_longjmp_breakpoint_for_call_dummy(struct thread_info *tp)
Definition: breakpoint.c:7570
void remove_solib_event_breakpoints_at_next_stop(void)
Definition: breakpoint.c:7740
void breakpoint_retire_moribund(void)
Definition: breakpoint.c:11446
void enable_disable_bp_location(bp_location *loc, bool enable)
Definition: breakpoint.c:13304
bpdisp
Definition: breakpoint.h:236
@ disp_donttouch
Definition: breakpoint.h:241
@ disp_del
Definition: breakpoint.h:237
@ disp_disable
Definition: breakpoint.h:240
@ disp_del_at_next_stop
Definition: breakpoint.h:238
int insert_single_step_breakpoints(struct gdbarch *)
Definition: breakpoint.c:13642
#define BREAKPOINT_MAX
Definition: breakpoint.h:78
void disable_display(int)
Definition: printcmd.c:2241
void breakpoint_set_thread(struct breakpoint *b, int thread)
Definition: breakpoint.c:1461
void remove_jit_event_breakpoints(void)
Definition: breakpoint.c:7720
void breakpoint_re_set_thread(struct breakpoint *)
Definition: breakpoint.c:12973
struct breakpoint * get_breakpoint(int num)
Definition: breakpoint.c:811
void bpstat_run_callbacks(bpstat *bs_head)
Definition: breakpoint.c:6004
int software_breakpoint_inserted_here_p(const address_space *, CORE_ADDR)
Definition: breakpoint.c:4311
void insert_single_step_breakpoint(struct gdbarch *, const address_space *, CORE_ADDR)
Definition: breakpoint.c:13606
struct breakpoint * clone_momentary_breakpoint(struct breakpoint *bpkt)
Definition: breakpoint.c:8151
void add_solib_catchpoint(const char *arg, bool is_load, bool is_temp, bool enabled)
bool fix_breakpoint_script_output_globally
Definition: breakpoint.c:6308
bool is_breakpoint(const struct breakpoint *bpt)
Definition: breakpoint.c:1787
int remove_breakpoints(void)
Definition: breakpoint.c:3226
bpstat_what_main_action
Definition: breakpoint.h:1129
@ BPSTAT_WHAT_STOP_NOISY
Definition: breakpoint.h:1165
@ BPSTAT_WHAT_CLEAR_LONGJMP_RESUME
Definition: breakpoint.h:1150
@ BPSTAT_WHAT_STOP_SILENT
Definition: breakpoint.h:1162
@ BPSTAT_WHAT_SINGLE
Definition: breakpoint.h:1140
@ BPSTAT_WHAT_SET_LONGJMP_RESUME
Definition: breakpoint.h:1146
@ BPSTAT_WHAT_HP_STEP_RESUME
Definition: breakpoint.h:1174
@ BPSTAT_WHAT_STEP_RESUME
Definition: breakpoint.h:1153
@ BPSTAT_WHAT_KEEP_CHECKING
Definition: breakpoint.h:1133
int breakpoints_should_be_inserted_now(void)
Definition: breakpoint.c:514
bool bpstat_should_step()
Definition: breakpoint.c:6032
int detach_breakpoints(ptid_t ptid)
Definition: breakpoint.c:3868
bool bpstat_explains_signal(bpstat *, enum gdb_signal)
Definition: breakpoint.c:4461
void set_std_terminate_breakpoint(void)
Definition: breakpoint.c:7667
int bpstat_num(bpstat **, int *)
Definition: breakpoint.c:4485
void watch_command_wrapper(const char *, int, bool)
Definition: breakpoint.c:10422
int pending_breakpoint_p(struct breakpoint *)
Definition: breakpoint.c:6780
iterator_range< tracepoint_iterator > tracepoint_range
Definition: breakpoint.h:1853
bp_print_how
Definition: breakpoint.h:1273
@ print_it_noop
Definition: breakpoint.h:1281
@ print_it_done
Definition: breakpoint.h:1284
@ print_it_normal
Definition: breakpoint.h:1278
void add_catch_command(const char *name, const char *docstring, cmd_func_ftype *func, completer_ftype *completer, void *user_data_catch, void *user_data_tcatch)
Definition: breakpoint.c:14303
void enable_breakpoint(struct breakpoint *)
Definition: breakpoint.c:13509
const char * bpdisp_text(enum bpdisp disp)
Definition: breakpoint.c:437
const struct breakpoint_ops code_breakpoint_ops
Definition: breakpoint.c:225
int watchpoints_triggered(const target_waitstatus &)
Definition: breakpoint.c:5003
void enable_breakpoints_after_startup(void)
Definition: breakpoint.c:8070
bool fix_multi_location_breakpoint_output_globally
Definition: breakpoint.c:6675
next_range< bp_location > bp_location_range
Definition: breakpoint.h:613
bool is_watchpoint(const struct breakpoint *bpt)
Definition: breakpoint.c:1807
enum breakpoint_here breakpoint_here_p(const address_space *, CORE_ADDR)
Definition: breakpoint.c:4199
int breakpoint_inserted_here_p(const address_space *, CORE_ADDR)
Definition: breakpoint.c:4293
enum command_control_type commands_from_control_command(const char *arg, struct command_line *cmd)
Definition: breakpoint.c:1566
struct tracepoint * get_tracepoint_by_number_on_target(int num)
Definition: breakpoint.c:14045
void install_breakpoint(int internal, std::unique_ptr< breakpoint > &&b, int update_gll)
Definition: breakpoint.c:7960
void delete_std_terminate_breakpoint(void)
Definition: breakpoint.c:7680
bptype
Definition: breakpoint.h:84
@ bp_gnu_ifunc_resolver_return
Definition: breakpoint.h:211
@ bp_std_terminate_master
Definition: breakpoint.h:177
@ bp_breakpoint
Definition: breakpoint.h:86
@ bp_exception_resume
Definition: breakpoint.h:109
@ bp_watchpoint
Definition: breakpoint.h:91
@ bp_longjmp_call_dummy
Definition: breakpoint.h:102
@ bp_thread_event
Definition: breakpoint.h:159
@ bp_dprintf
Definition: breakpoint.h:195
@ bp_step_resume
Definition: breakpoint.h:113
@ bp_longjmp
Definition: breakpoint.h:95
@ bp_fast_tracepoint
Definition: breakpoint.h:185
@ bp_overlay_event
Definition: breakpoint.h:167
@ bp_hardware_breakpoint
Definition: breakpoint.h:87
@ bp_exception_master
Definition: breakpoint.h:180
@ bp_read_watchpoint
Definition: breakpoint.h:93
@ bp_shlib_event
Definition: breakpoint.h:149
@ bp_std_terminate
Definition: breakpoint.h:139
@ bp_finish
Definition: breakpoint.h:90
@ bp_until
Definition: breakpoint.h:89
@ bp_catchpoint
Definition: breakpoint.h:182
@ bp_access_watchpoint
Definition: breakpoint.h:94
@ bp_call_dummy
Definition: breakpoint.h:135
@ bp_jit_event
Definition: breakpoint.h:198
@ bp_gnu_ifunc_resolver
Definition: breakpoint.h:205
@ bp_none
Definition: breakpoint.h:85
@ bp_static_marker_tracepoint
Definition: breakpoint.h:188
@ bp_hp_step_resume
Definition: breakpoint.h:117
@ bp_longjmp_master
Definition: breakpoint.h:174
@ bp_longjmp_resume
Definition: breakpoint.h:96
@ bp_watchpoint_scope
Definition: breakpoint.h:131
@ bp_single_step
Definition: breakpoint.h:88
@ bp_hardware_watchpoint
Definition: breakpoint.h:92
@ bp_static_tracepoint
Definition: breakpoint.h:186
@ bp_exception
Definition: breakpoint.h:106
@ bp_tracepoint
Definition: breakpoint.h:184
void bpstat_clear_actions(void)
Definition: breakpoint.c:4558
breakpoint_create_flags
Definition: breakpoint.h:1500
@ CREATE_BREAKPOINT_FLAGS_INSERTED
Definition: breakpoint.h:1503
void break_command(const char *, int)
Definition: breakpoint.c:9223
void bpstat_clear(bpstat **)
Definition: breakpoint.c:4384
void delete_breakpoint(struct breakpoint *)
Definition: breakpoint.c:12254
inf_context
Definition: breakpoint.h:1341
@ inf_running
Definition: breakpoint.h:1343
@ inf_starting
Definition: breakpoint.h:1342
@ inf_exited
Definition: breakpoint.h:1344
@ inf_execd
Definition: breakpoint.h:1345
struct command_line * breakpoint_commands(struct breakpoint *b)
Definition: breakpoint.c:426
void breakpoint_set_silent(struct breakpoint *b, int silent)
Definition: breakpoint.c:1448
std::unique_ptr< struct breakpoint, breakpoint_deleter > breakpoint_up
Definition: breakpoint.h:1430
exception_event_kind
Definition: breakpoint.h:55
@ EX_EVENT_CATCH
Definition: breakpoint.h:58
@ EX_EVENT_THROW
Definition: breakpoint.h:56
@ EX_EVENT_RETHROW
Definition: breakpoint.h:57
cmd_list_element * commands_cmd_element
Definition: breakpoint.c:14374
void bpstat_do_actions(void)
Definition: breakpoint.c:4754
void remove_breakpoints_inf(inferior *inf)
Definition: breakpoint.c:3262
void breakpoint_free_objfile(struct objfile *objfile)
Definition: breakpoint.c:14361
void disable_current_display(void)
Definition: printcmd.c:2253
void remove_solib_event_breakpoints(void)
Definition: breakpoint.c:7729
breakpoint_up set_momentary_breakpoint(struct gdbarch *, struct symtab_and_line, struct frame_id, enum bptype)
void tbreak_command(const char *, int)
Definition: breakpoint.c:9229
void rwatch_command_wrapper(const char *, int, bool)
Definition: breakpoint.c:10504
int pc_at_non_inline_function(const address_space *aspace, CORE_ADDR pc, const target_waitstatus &ws)
Definition: breakpoint.c:14339
int single_step_breakpoint_inserted_here_p(const address_space *, CORE_ADDR)
Definition: breakpoint.c:13682
int hardware_breakpoint_inserted_here_p(const address_space *, CORE_ADDR)
Definition: breakpoint.c:4329
bpstat * bpstat_stop_status_nowatch(const address_space *aspace, CORE_ADDR bp_addr, thread_info *thread, const target_waitstatus &ws)
Definition: breakpoint.c:5782
bpstat * bpstat_stop_status(const address_space *aspace, CORE_ADDR pc, thread_info *thread, const target_waitstatus &ws, bpstat *stop_chain=nullptr)
Definition: breakpoint.c:5672
int breakpoint_in_range_p(const address_space *aspace, CORE_ADDR addr, ULONGEST len)
Definition: breakpoint.c:4231
bpstat * bpstat_copy(bpstat *)
Definition: breakpoint.c:4418
int catch_syscall_enabled(void)
void breakpoint_set_task(struct breakpoint *b, int task)
Definition: breakpoint.c:1474
bpstat * build_bpstat_chain(const address_space *aspace, CORE_ADDR bp_addr, const target_waitstatus &ws)
Definition: breakpoint.c:5597
void disable_breakpoints_before_startup(void)
Definition: breakpoint.c:8063
void enable_watchpoints_after_interactive_call_stop(void)
Definition: breakpoint.c:8052
bool is_exception_catchpoint(breakpoint *bp)
condition_status
Definition: breakpoint.h:248
@ condition_updated
Definition: breakpoint.h:251
@ condition_unchanged
Definition: breakpoint.h:249
@ condition_modified
Definition: breakpoint.h:250
void breakpoint_set_commands(struct breakpoint *b, counted_command_line &&commands)
Definition: breakpoint.c:1434
next_iterator< breakpoint > breakpoint_iterator
Definition: breakpoint.h:1818
int create_breakpoint(struct gdbarch *gdbarch, struct location_spec *locspec, const char *cond_string, int thread, const char *extra_string, bool force_condition, int parse_extra, int tempflag, enum bptype wanted_type, int ignore_count, enum auto_boolean pending_break_support, const struct breakpoint_ops *ops, int from_tty, int enabled, int internal, unsigned flags)
Definition: breakpoint.c:8945
struct tracepoint * get_tracepoint(int num)
Definition: breakpoint.c:14031
void catch_exception_event(enum exception_event_kind ex_event, const char *regex, bool tempflag, int from_tty)
void breakpoint_auto_delete(bpstat *)
Definition: breakpoint.c:10875
int breakpoint_has_location_inserted_here(struct breakpoint *bp, const address_space *aspace, CORE_ADDR pc)
Definition: breakpoint.c:13666
void print_solib_event(bool is_catchpoint)
Definition: breakpoint.c:4863
struct breakpoint * set_longjmp_breakpoint_for_call_dummy(void)
Definition: breakpoint.c:7534
void clear_displays(void)
Definition: printcmd.c:2002
print_stop_action
Definition: breakpoint.h:543
@ PRINT_SRC_AND_LOC
Definition: breakpoint.h:549
@ PRINT_NOTHING
Definition: breakpoint.h:557
@ PRINT_UNKNOWN
Definition: breakpoint.h:545
@ PRINT_SRC_ONLY
Definition: breakpoint.h:553
void until_break_command(const char *, int, int)
Definition: breakpoint.c:10592
void breakpoint_init_inferior(enum inf_context)
Definition: breakpoint.c:4087
bool target_exact_watchpoints
Definition: breakpoint.c:611
breakpoint_up set_momentary_breakpoint_at_pc(struct gdbarch *, CORE_ADDR pc, enum bptype type)
Definition: breakpoint.c:8162
std::vector< breakpoint * > static_tracepoints_here(CORE_ADDR addr)
Definition: breakpoint.c:1414
breakpoint_here
Definition: breakpoint.h:1351
@ ordinary_breakpoint_here
Definition: breakpoint.h:1353
@ no_breakpoint_here
Definition: breakpoint.h:1352
@ permanent_breakpoint_here
Definition: breakpoint.h:1354
void clear_breakpoint_hit_counts(void)
Definition: breakpoint.c:800
bool catching_syscall_number(int syscall_number)
int breakpoint_address_match(const address_space *aspace1, CORE_ADDR addr1, const address_space *aspace2, CORE_ADDR addr2)
Definition: breakpoint.c:7122
void disable_watchpoints_before_interactive_call_start(void)
Definition: breakpoint.c:8041
void set_breakpoint_condition(struct breakpoint *b, const char *exp, int from_tty, bool force)
Definition: breakpoint.c:1005
bool bpstat_causes_stop(bpstat *)
Definition: breakpoint.c:6044
struct breakpoint * create_and_insert_solib_event_breakpoint(struct gdbarch *gdbarch, CORE_ADDR address)
Definition: breakpoint.c:7772
void breakpoint_xfer_memory(gdb_byte *readbuf, gdb_byte *writebuf, const gdb_byte *writebuf_org, ULONGEST memaddr, LONGEST len)
Definition: breakpoint.c:1700
void disable_breakpoints_in_shlibs(void)
Definition: breakpoint.c:7791
void disable_breakpoint(struct breakpoint *)
Definition: breakpoint.c:13357
const char * ep_parse_optional_if_clause(const char **arg)
void mark_breakpoints_out(void)
Definition: breakpoint.c:4067
void delete_longjmp_breakpoint_at_next_stop(int thread)
Definition: breakpoint.c:7518
bool is_tracepoint(const struct breakpoint *b)
Definition: breakpoint.c:1294
enable_state
Definition: breakpoint.h:217
@ bp_disabled
Definition: breakpoint.h:218
@ bp_enabled
Definition: breakpoint.h:220
@ bp_call_disabled
Definition: breakpoint.h:222
remove_bp_reason
Definition: breakpoint.h:64
@ REMOVE_BREAKPOINT
Definition: breakpoint.h:67
@ DETACH_BREAKPOINT
Definition: breakpoint.h:70
bp_loc_type
Definition: breakpoint.h:315
@ bp_loc_hardware_breakpoint
Definition: breakpoint.h:317
@ bp_loc_other
Definition: breakpoint.h:320
@ bp_loc_software_breakpoint
Definition: breakpoint.h:316
@ bp_loc_software_watchpoint
Definition: breakpoint.h:318
@ bp_loc_hardware_watchpoint
Definition: breakpoint.h:319
void insert_breakpoints(void)
Definition: breakpoint.c:3047
basic_safe_range< breakpoint_range > breakpoint_safe_range
Definition: breakpoint.h:1831
struct gdbarch * get_sal_arch(struct symtab_and_line sal)
Definition: breakpoint.c:7468
stop_stack_kind
Definition: breakpoint.h:1180
@ STOP_NONE
Definition: breakpoint.h:1182
@ STOP_STD_TERMINATE
Definition: breakpoint.h:1188
@ STOP_STACK_DUMMY
Definition: breakpoint.h:1185
void delete_longjmp_breakpoint(int thread)
Definition: breakpoint.c:7507
void update_breakpoints_after_exec(void)
Definition: breakpoint.c:3749
int moribund_breakpoint_here_p(const address_space *, CORE_ADDR)
Definition: breakpoint.c:4263
filtered_iterator< breakpoint_iterator, tracepoint_filter > tracepoint_iterator
Definition: breakpoint.h:1849
enum print_stop_action bpstat_print(bpstat *bs, target_waitkind kind)
Definition: breakpoint.c:4934
void update_breakpoint_locations(code_breakpoint *b, struct program_space *filter_pspace, gdb::array_view< const symtab_and_line > sals, gdb::array_view< const symtab_and_line > sals_end)
Definition: breakpoint.c:12659
void do_displays(void)
Definition: printcmd.c:2231
void set_longjmp_breakpoint(struct thread_info *tp, struct frame_id frame)
Definition: breakpoint.c:7483
int hardware_watchpoint_inserted_in_range(const address_space *, CORE_ADDR addr, ULONGEST len)
Definition: breakpoint.c:4345
void print_num_locno(const bpstat *bs, struct ui_out *)
Definition: breakpoint.c:4539
int bpstat_locno(const bpstat *bs)
Definition: breakpoint.c:4507
tracepoint_range all_tracepoints()
Definition: breakpoint.c:645
const struct breakpoint_ops * breakpoint_ops_for_location_spec(const location_spec *locspec, bool is_tracepoint)
Definition: breakpoint.c:8933
void disable_overlay_breakpoints(void)
Definition: breakpoint.c:7653
void describe_other_breakpoints(struct gdbarch *, struct program_space *, CORE_ADDR, struct obj_section *, int)
Definition: breakpoint.c:7018
bpstat * bpstat_find_breakpoint(bpstat *, struct breakpoint *)
Definition: breakpoint.c:4445
watchpoint_triggered
Definition: breakpoint.h:592
@ watch_triggered_no
Definition: breakpoint.h:594
@ watch_triggered_unknown
Definition: breakpoint.h:598
@ watch_triggered_yes
Definition: breakpoint.h:601
struct breakpoint * create_jit_event_breakpoint(struct gdbarch *, CORE_ADDR)
Definition: breakpoint.c:7712
iterator_range< breakpoint_iterator > breakpoint_range
Definition: breakpoint.h:1822
bool is_catchpoint(struct breakpoint *b)
Definition: breakpoint.c:4375
struct tracepoint * get_tracepoint_by_number(const char **arg, number_or_range_parser *parser)
Definition: breakpoint.c:14064
breakpoint_safe_range all_breakpoints_safe()
Definition: breakpoint.c:637
gdb::ref_ptr< bp_location, bp_location_ref_policy > bp_location_ref_ptr
Definition: breakpoint.h:538
void enable_overlay_breakpoints(void)
Definition: breakpoint.c:7641
struct breakpoint * create_thread_event_breakpoint(struct gdbarch *, CORE_ADDR)
Definition: breakpoint.c:7688
void set_ignore_count(int, int, int)
Definition: breakpoint.c:12992
breakpoint_range all_breakpoints()
Definition: breakpoint.c:629
void maybe_print_thread_hit_breakpoint(struct ui_out *uiout)
Definition: breakpoint.c:4792
void awatch_command_wrapper(const char *, int, bool)
Definition: breakpoint.c:10516
const minimal_symbol * msymbol
Definition: breakpoint.h:513
expression_up cond
Definition: breakpoint.h:359
bp_location * next
Definition: breakpoint.h:339
bool inserted
Definition: breakpoint.h:403
breakpoint * owner
Definition: breakpoint.h:350
int line_number
Definition: breakpoint.h:498
CORE_ADDR requested_address
Definition: breakpoint.h:463
virtual ~bp_location()=default
bool enabled
Definition: breakpoint.h:394
bp_target_info overlay_target_info
Definition: breakpoint.h:480
CORE_ADDR address
Definition: breakpoint.h:442
CORE_ADDR related_address
Definition: breakpoint.h:468
bool permanent
Definition: breakpoint.h:410
bool shlib_disabled
Definition: breakpoint.h:391
bool needs_update
Definition: breakpoint.h:386
bp_location()=default
bool disabled_by_cond
Definition: breakpoint.h:400
agent_expr_up cond_bytecode
Definition: breakpoint.h:364
gdb::unique_xmalloc_ptr< char > function_name
Definition: breakpoint.h:474
bp_loc_type loc_type
Definition: breakpoint.h:342
int events_till_retirement
Definition: breakpoint.h:491
agent_expr_up cmd_bytecode
Definition: breakpoint.h:381
obj_section * section
Definition: breakpoint.h:455
condition_status condition_changed
Definition: breakpoint.h:379
target_hw_bp_type watchpoint_type
Definition: breakpoint.h:450
program_space * pspace
Definition: breakpoint.h:436
bool duplicate
Definition: breakpoint.h:418
Definition: probe.h:115
DISABLE_COPY_AND_ASSIGN(scoped_rbreak_breakpoints)
Definition: ui-out.h:160
command_control_type
Definition: cli-script.h:36
std::shared_ptr< command_line > counted_command_line
Definition: cli-script.h:67
void completer_ftype(struct cmd_list_element *, completion_tracker &tracker, const char *text, const char *word)
Definition: command.h:495
void cmd_func_ftype(const char *args, int from_tty, cmd_list_element *c)
Definition: command.h:483
auto_boolean
Definition: defs.h:248
language
Definition: defs.h:211
std::unique_ptr< expression > expression_up
Definition: expression.h:229
const struct frame_id null_frame_id
Definition: frame.c:664
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
Definition: gnu-nat.c:1862
std::unique_ptr< location_spec > location_spec_up
Definition: location.h:71
void(* func)(remote_target *remote, char *)
#define enable()
Definition: ser-go32.c:239
Definition: block.h:109
static void incref(bp_location *loc)
Definition: breakpoint.h:522
static void decref(bp_location *loc)
Definition: breakpoint.h:527
std::vector< agent_expr * > conditions
Definition: breakpoint.h:290
std::vector< agent_expr * > tcommands
Definition: breakpoint.h:294
gdb_byte shadow_contents[BREAKPOINT_MAX]
Definition: breakpoint.h:279
CORE_ADDR placed_address
Definition: breakpoint.h:266
CORE_ADDR reqstd_address
Definition: breakpoint.h:269
struct address_space * placed_address_space
Definition: breakpoint.h:259
bool is_longjmp
Definition: breakpoint.h:1204
enum stop_stack_kind call_dummy
Definition: breakpoint.h:1199
enum bpstat_what_main_action main_action
Definition: breakpoint.h:1193
value_ref_ptr old_val
Definition: breakpoint.h:1327
bp_location_ref_ptr bp_location_at
Definition: breakpoint.h:1315
bpstat * next
Definition: breakpoint.h:1298
enum bp_print_how print_it
Definition: breakpoint.h:1337
bpstat & operator=(const bpstat &)=delete
counted_command_line commands
Definition: breakpoint.h:1324
char print
Definition: breakpoint.h:1330
char stop
Definition: breakpoint.h:1333
struct breakpoint * breakpoint_at
Definition: breakpoint.h:1321
void operator()(struct breakpoint *b) const
Definition: breakpoint.h:1424
void(* create_sals_from_location_spec)(location_spec *locspec, struct linespec_result *canonical)
Definition: breakpoint.h:573
void(* create_breakpoints_sal)(struct gdbarch *, struct linespec_result *, gdb::unique_xmalloc_ptr< char >, gdb::unique_xmalloc_ptr< char >, enum bptype, enum bpdisp, int, int, int, int, int, int, unsigned)
Definition: breakpoint.h:583
counted_command_line commands
Definition: breakpoint.h:759
virtual int breakpoint_hit(const struct bp_location *bl, const address_space *aspace, CORE_ADDR bp_addr, const target_waitstatus &ws)
Definition: breakpoint.c:11601
breakpoint(struct gdbarch *gdbarch_, enum bptype bptype, bool temp=true, const char *cond_string=nullptr)
Definition: breakpoint.c:7934
int ignore_count
Definition: breakpoint.h:751
int enable_count
Definition: breakpoint.h:755
virtual void print_recreate(struct ui_file *fp) const
Definition: breakpoint.c:11628
virtual int resources_needed(const struct bp_location *)
Definition: breakpoint.c:11610
virtual ~breakpoint()=0
Definition: breakpoint.c:248
location_spec_up locspec
Definition: breakpoint.h:770
bp_location_range locations() const
Definition: breakpoint.c:11573
breakpoint * next
Definition: breakpoint.h:731
virtual void check_status(struct bpstat *bs)
Definition: breakpoint.h:668
gdb::unique_xmalloc_ptr< char > cond_string
Definition: breakpoint.h:788
gdbpy_breakpoint_object * py_bp_object
Definition: breakpoint.h:824
void print_recreate_thread(struct ui_file *fp) const
Definition: breakpoint.c:14099
int hit_count
Definition: breakpoint.h:812
virtual int insert_location(struct bp_location *)
Definition: breakpoint.c:11588
DISABLE_COPY_AND_ASSIGN(breakpoint)
virtual enum print_stop_action print_it(const bpstat *bs) const
Definition: breakpoint.c:11616
breakpoint * related_breakpoint
Definition: breakpoint.h:798
int condition_not_parsed
Definition: breakpoint.h:817
virtual struct bp_location * allocate_location()
Definition: breakpoint.c:11579
gdb::unique_xmalloc_ptr< char > filter
Definition: breakpoint.h:774
virtual bool print_one(bp_location **) const
Definition: breakpoint.h:685
gdbscm_breakpoint_object * scm_bp_object
Definition: breakpoint.h:827
virtual void re_set()
Definition: breakpoint.h:638
virtual bool explains_signal(enum gdb_signal)
Definition: breakpoint.h:716
bool silent
Definition: breakpoint.h:746
virtual int remove_location(struct bp_location *, enum remove_bp_reason reason)
Definition: breakpoint.c:11594
virtual void print_one_detail(struct ui_out *) const
Definition: breakpoint.h:702
virtual void print_mention() const
Definition: breakpoint.c:11622
struct gdbarch * gdbarch
Definition: breakpoint.h:781
bp_location * loc
Definition: breakpoint.h:742
gdb::unique_xmalloc_ptr< char > extra_string
Definition: breakpoint.h:792
program_space * pspace
Definition: breakpoint.h:767
int input_radix
Definition: breakpoint.h:785
enum language language
Definition: breakpoint.h:783
virtual void after_condition_true(struct bpstat *bs)
Definition: breakpoint.h:723
bpdisp disposition
Definition: breakpoint.h:737
location_spec_up locspec_range_end
Definition: breakpoint.h:778
bool display_canonical
Definition: breakpoint.h:748
~catchpoint() override=0
Definition: breakpoint.c:256
void re_set_default()
Definition: breakpoint.c:12868
~code_breakpoint() override=0
Definition: breakpoint.c:252
code_breakpoint(struct gdbarch *gdbarch, bptype type, gdb::array_view< const symtab_and_line > sals, location_spec_up &&locspec, gdb::unique_xmalloc_ptr< char > filter, gdb::unique_xmalloc_ptr< char > cond_string, gdb::unique_xmalloc_ptr< char > extra_string, enum bpdisp disposition, int thread, int task, int ignore_count, int from_tty, int enabled, unsigned flags, int display_canonical)
Definition: breakpoint.c:8401
int breakpoint_hit(const struct bp_location *bl, const address_space *aspace, CORE_ADDR bp_addr, const target_waitstatus &ws) override
Definition: breakpoint.c:11690
virtual std::vector< symtab_and_line > decode_location_spec(location_spec *locspec, struct program_space *search_pspace)
Definition: breakpoint.c:11826
bp_location * add_location(const symtab_and_line &sal)
Definition: breakpoint.c:8243
void re_set() override
Definition: breakpoint.c:11636
int insert_location(struct bp_location *) override
Definition: breakpoint.c:11650
std::vector< symtab_and_line > location_spec_to_sals(location_spec *locspec, struct program_space *search_pspace, int *found)
Definition: breakpoint.c:12782
int remove_location(struct bp_location *, enum remove_bp_reason reason) override
Definition: breakpoint.c:11674
Definition: gnu-nat.c:154
bool operator()(breakpoint *b)
Definition: breakpoint.h:1842
std::string static_trace_marker_id
Definition: breakpoint.h:1027
void print_recreate(struct ui_file *fp) const override
Definition: breakpoint.c:12061
long step_count
Definition: breakpoint.h:1013
int number_on_target
Definition: breakpoint.h:1020
ULONGEST traceframe_usage
Definition: breakpoint.h:1024
int breakpoint_hit(const struct bp_location *bl, const address_space *aspace, CORE_ADDR bp_addr, const target_waitstatus &ws) override
Definition: breakpoint.c:12009
int static_trace_marker_id_idx
Definition: breakpoint.h:1035
void print_one_detail(struct ui_out *uiout) const override
Definition: breakpoint.c:12019
void print_mention() const override
Definition: breakpoint.c:12033
int pass_count
Definition: breakpoint.h:1017
Definition: gdbtypes.h:922
ptid_t watchpoint_thread
Definition: breakpoint.h:968
int insert_location(struct bp_location *) override
Definition: breakpoint.c:9597
int breakpoint_hit(const struct bp_location *bl, const address_space *aspace, CORE_ADDR bp_addr, const target_waitstatus &ws) override
Definition: breakpoint.c:9618
bool val_valid
Definition: breakpoint.h:953
void check_status(struct bpstat *bs) override
Definition: breakpoint.c:9638
struct frame_id watchpoint_frame
Definition: breakpoint.h:963
int remove_location(struct bp_location *, enum remove_bp_reason reason) override
Definition: breakpoint.c:9608
int val_bitsize
Definition: breakpoint.h:958
virtual bool works_in_software_mode() const
Definition: breakpoint.c:9660
void re_set() override
Definition: breakpoint.c:9564
gdb::unique_xmalloc_ptr< char > exp_string
Definition: breakpoint.h:932
gdb::unique_xmalloc_ptr< char > exp_string_reparse
Definition: breakpoint.h:934
enum print_stop_action print_it(const bpstat *bs) const override
Definition: breakpoint.c:9667
expression_up exp
Definition: breakpoint.h:937
CORE_ADDR hw_wp_mask
Definition: breakpoint.h:979
int val_bitpos
Definition: breakpoint.h:957
bool explains_signal(enum gdb_signal) override
Definition: breakpoint.c:9816
expression_up cond_exp
Definition: breakpoint.h:942
void print_mention() const override
Definition: breakpoint.c:9755
int resources_needed(const struct bp_location *) override
Definition: breakpoint.c:9649
const struct block * exp_valid_block
Definition: breakpoint.h:940
const struct block * cond_exp_valid_block
Definition: breakpoint.h:945
void print_recreate(struct ui_file *fp) const override
Definition: breakpoint.c:9791
enum watchpoint_triggered watchpoint_triggered
Definition: breakpoint.h:972
value_ref_ptr val
Definition: breakpoint.h:949
gdb::ref_ptr< struct value, value_ref_policy > value_ref_ptr
Definition: value.h:120
target_waitkind
Definition: waitstatus.h:30