15796c8dcSSimon Schubert /* Data structures associated with breakpoints in GDB. 2*ef5ccd6cSJohn Marino Copyright (C) 1992-2013 Free Software Foundation, Inc. 35796c8dcSSimon Schubert 45796c8dcSSimon Schubert This file is part of GDB. 55796c8dcSSimon Schubert 65796c8dcSSimon Schubert This program is free software; you can redistribute it and/or modify 75796c8dcSSimon Schubert it under the terms of the GNU General Public License as published by 85796c8dcSSimon Schubert the Free Software Foundation; either version 3 of the License, or 95796c8dcSSimon Schubert (at your option) any later version. 105796c8dcSSimon Schubert 115796c8dcSSimon Schubert This program is distributed in the hope that it will be useful, 125796c8dcSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of 135796c8dcSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 145796c8dcSSimon Schubert GNU General Public License for more details. 155796c8dcSSimon Schubert 165796c8dcSSimon Schubert You should have received a copy of the GNU General Public License 175796c8dcSSimon Schubert along with this program. If not, see <http://www.gnu.org/licenses/>. */ 185796c8dcSSimon Schubert 195796c8dcSSimon Schubert #if !defined (BREAKPOINT_H) 205796c8dcSSimon Schubert #define BREAKPOINT_H 1 215796c8dcSSimon Schubert 225796c8dcSSimon Schubert #include "frame.h" 235796c8dcSSimon Schubert #include "value.h" 245796c8dcSSimon Schubert #include "vec.h" 25*ef5ccd6cSJohn Marino #include "ax.h" 26*ef5ccd6cSJohn Marino #include "command.h" 275796c8dcSSimon Schubert 285796c8dcSSimon Schubert struct value; 295796c8dcSSimon Schubert struct block; 30c50c785cSJohn Marino struct breakpoint_object; 31c50c785cSJohn Marino struct get_number_or_range_state; 32a45ae5f8SJohn Marino struct thread_info; 33a45ae5f8SJohn Marino struct bpstats; 34a45ae5f8SJohn Marino struct bp_location; 35*ef5ccd6cSJohn Marino struct linespec_result; 36*ef5ccd6cSJohn Marino struct linespec_sals; 375796c8dcSSimon Schubert 38c50c785cSJohn Marino /* This is the maximum number of bytes a breakpoint instruction can 39c50c785cSJohn Marino take. Feel free to increase it. It's just used in a few places to 40c50c785cSJohn Marino size arrays that should be independent of the target 41c50c785cSJohn Marino architecture. */ 425796c8dcSSimon Schubert 435796c8dcSSimon Schubert #define BREAKPOINT_MAX 16 445796c8dcSSimon Schubert 455796c8dcSSimon Schubert 465796c8dcSSimon Schubert /* Type of breakpoint. */ 47c50c785cSJohn Marino /* FIXME In the future, we should fold all other breakpoint-like 48c50c785cSJohn Marino things into here. This includes: 495796c8dcSSimon Schubert 50c50c785cSJohn Marino * single-step (for machines where we have to simulate single 51c50c785cSJohn Marino stepping) (probably, though perhaps it is better for it to look as 52c50c785cSJohn Marino much as possible like a single-step to wait_for_inferior). */ 535796c8dcSSimon Schubert 545796c8dcSSimon Schubert enum bptype 555796c8dcSSimon Schubert { 56c50c785cSJohn Marino bp_none = 0, /* Eventpoint has been deleted */ 575796c8dcSSimon Schubert bp_breakpoint, /* Normal breakpoint */ 585796c8dcSSimon Schubert bp_hardware_breakpoint, /* Hardware assisted breakpoint */ 595796c8dcSSimon Schubert bp_until, /* used by until command */ 605796c8dcSSimon Schubert bp_finish, /* used by finish command */ 615796c8dcSSimon Schubert bp_watchpoint, /* Watchpoint */ 625796c8dcSSimon Schubert bp_hardware_watchpoint, /* Hardware assisted watchpoint */ 635796c8dcSSimon Schubert bp_read_watchpoint, /* read watchpoint, (hardware assisted) */ 645796c8dcSSimon Schubert bp_access_watchpoint, /* access watchpoint, (hardware assisted) */ 655796c8dcSSimon Schubert bp_longjmp, /* secret breakpoint to find longjmp() */ 665796c8dcSSimon Schubert bp_longjmp_resume, /* secret breakpoint to escape longjmp() */ 675796c8dcSSimon Schubert 68*ef5ccd6cSJohn Marino /* Breakpoint placed to the same location(s) like bp_longjmp but used to 69*ef5ccd6cSJohn Marino protect against stale DUMMY_FRAME. Multiple bp_longjmp_call_dummy and 70*ef5ccd6cSJohn Marino one bp_call_dummy are chained together by related_breakpoint for each 71*ef5ccd6cSJohn Marino DUMMY_FRAME. */ 72*ef5ccd6cSJohn Marino bp_longjmp_call_dummy, 73*ef5ccd6cSJohn Marino 74c50c785cSJohn Marino /* An internal breakpoint that is installed on the unwinder's 75c50c785cSJohn Marino debug hook. */ 76c50c785cSJohn Marino bp_exception, 77c50c785cSJohn Marino /* An internal breakpoint that is set at the point where an 78c50c785cSJohn Marino exception will land. */ 79c50c785cSJohn Marino bp_exception_resume, 80c50c785cSJohn Marino 81c50c785cSJohn Marino /* Used by wait_for_inferior for stepping over subroutine calls, 82a45ae5f8SJohn Marino and for skipping prologues. */ 835796c8dcSSimon Schubert bp_step_resume, 845796c8dcSSimon Schubert 85a45ae5f8SJohn Marino /* Used by wait_for_inferior for stepping over signal 86a45ae5f8SJohn Marino handlers. */ 87a45ae5f8SJohn Marino bp_hp_step_resume, 88a45ae5f8SJohn Marino 895796c8dcSSimon Schubert /* Used to detect when a watchpoint expression has gone out of 905796c8dcSSimon Schubert scope. These breakpoints are usually not visible to the user. 915796c8dcSSimon Schubert 925796c8dcSSimon Schubert This breakpoint has some interesting properties: 935796c8dcSSimon Schubert 945796c8dcSSimon Schubert 1) There's always a 1:1 mapping between watchpoints 955796c8dcSSimon Schubert on local variables and watchpoint_scope breakpoints. 965796c8dcSSimon Schubert 975796c8dcSSimon Schubert 2) It automatically deletes itself and the watchpoint it's 985796c8dcSSimon Schubert associated with when hit. 995796c8dcSSimon Schubert 1005796c8dcSSimon Schubert 3) It can never be disabled. */ 1015796c8dcSSimon Schubert bp_watchpoint_scope, 1025796c8dcSSimon Schubert 103*ef5ccd6cSJohn Marino /* The breakpoint at the end of a call dummy. See bp_longjmp_call_dummy it 104*ef5ccd6cSJohn Marino is chained with by related_breakpoint. */ 1055796c8dcSSimon Schubert bp_call_dummy, 1065796c8dcSSimon Schubert 107cf7f2e2dSJohn Marino /* A breakpoint set on std::terminate, that is used to catch 108cf7f2e2dSJohn Marino otherwise uncaught exceptions thrown during an inferior call. */ 109cf7f2e2dSJohn Marino bp_std_terminate, 110cf7f2e2dSJohn Marino 1115796c8dcSSimon Schubert /* Some dynamic linkers (HP, maybe Solaris) can arrange for special 1125796c8dcSSimon Schubert code in the inferior to run when significant events occur in the 1135796c8dcSSimon Schubert dynamic linker (for example a library is loaded or unloaded). 1145796c8dcSSimon Schubert 1155796c8dcSSimon Schubert By placing a breakpoint in this magic code GDB will get control 1165796c8dcSSimon Schubert when these significant events occur. GDB can then re-examine 1175796c8dcSSimon Schubert the dynamic linker's data structures to discover any newly loaded 1185796c8dcSSimon Schubert dynamic libraries. */ 1195796c8dcSSimon Schubert bp_shlib_event, 1205796c8dcSSimon Schubert 1215796c8dcSSimon Schubert /* Some multi-threaded systems can arrange for a location in the 1225796c8dcSSimon Schubert inferior to be executed when certain thread-related events occur 1235796c8dcSSimon Schubert (such as thread creation or thread death). 1245796c8dcSSimon Schubert 1255796c8dcSSimon Schubert By placing a breakpoint at one of these locations, GDB will get 1265796c8dcSSimon Schubert control when these events occur. GDB can then update its thread 1275796c8dcSSimon Schubert lists etc. */ 1285796c8dcSSimon Schubert 1295796c8dcSSimon Schubert bp_thread_event, 1305796c8dcSSimon Schubert 1315796c8dcSSimon Schubert /* On the same principal, an overlay manager can arrange to call a 1325796c8dcSSimon Schubert magic location in the inferior whenever there is an interesting 1335796c8dcSSimon Schubert change in overlay status. GDB can update its overlay tables 1345796c8dcSSimon Schubert and fiddle with breakpoints in overlays when this breakpoint 1355796c8dcSSimon Schubert is hit. */ 1365796c8dcSSimon Schubert 1375796c8dcSSimon Schubert bp_overlay_event, 1385796c8dcSSimon Schubert 1395796c8dcSSimon Schubert /* Master copies of longjmp breakpoints. These are always installed 1405796c8dcSSimon Schubert as soon as an objfile containing longjmp is loaded, but they are 1415796c8dcSSimon Schubert always disabled. While necessary, temporary clones of bp_longjmp 1425796c8dcSSimon Schubert type will be created and enabled. */ 1435796c8dcSSimon Schubert 1445796c8dcSSimon Schubert bp_longjmp_master, 1455796c8dcSSimon Schubert 146cf7f2e2dSJohn Marino /* Master copies of std::terminate breakpoints. */ 147cf7f2e2dSJohn Marino bp_std_terminate_master, 148cf7f2e2dSJohn Marino 149c50c785cSJohn Marino /* Like bp_longjmp_master, but for exceptions. */ 150c50c785cSJohn Marino bp_exception_master, 151c50c785cSJohn Marino 1525796c8dcSSimon Schubert bp_catchpoint, 1535796c8dcSSimon Schubert 1545796c8dcSSimon Schubert bp_tracepoint, 155cf7f2e2dSJohn Marino bp_fast_tracepoint, 156cf7f2e2dSJohn Marino bp_static_tracepoint, 1575796c8dcSSimon Schubert 158*ef5ccd6cSJohn Marino /* A dynamic printf stops at the given location, does a formatted 159*ef5ccd6cSJohn Marino print, then automatically continues. (Although this is sort of 160*ef5ccd6cSJohn Marino like a macro packaging up standard breakpoint functionality, 161*ef5ccd6cSJohn Marino GDB doesn't have a way to construct types of breakpoint from 162*ef5ccd6cSJohn Marino elements of behavior.) */ 163*ef5ccd6cSJohn Marino bp_dprintf, 164*ef5ccd6cSJohn Marino 1655796c8dcSSimon Schubert /* Event for JIT compiled code generation or deletion. */ 1665796c8dcSSimon Schubert bp_jit_event, 167c50c785cSJohn Marino 168c50c785cSJohn Marino /* Breakpoint is placed at the STT_GNU_IFUNC resolver. When hit GDB 169c50c785cSJohn Marino inserts new bp_gnu_ifunc_resolver_return at the caller. 170c50c785cSJohn Marino bp_gnu_ifunc_resolver is still being kept here as a different thread 171c50c785cSJohn Marino may still hit it before bp_gnu_ifunc_resolver_return is hit by the 172c50c785cSJohn Marino original thread. */ 173c50c785cSJohn Marino bp_gnu_ifunc_resolver, 174c50c785cSJohn Marino 175c50c785cSJohn Marino /* On its hit GDB now know the resolved address of the target 176c50c785cSJohn Marino STT_GNU_IFUNC function. Associated bp_gnu_ifunc_resolver can be 177c50c785cSJohn Marino deleted now and the breakpoint moved to the target function entry 178c50c785cSJohn Marino point. */ 179c50c785cSJohn Marino bp_gnu_ifunc_resolver_return, 1805796c8dcSSimon Schubert }; 1815796c8dcSSimon Schubert 1825796c8dcSSimon Schubert /* States of enablement of breakpoint. */ 1835796c8dcSSimon Schubert 1845796c8dcSSimon Schubert enum enable_state 1855796c8dcSSimon Schubert { 186c50c785cSJohn Marino bp_disabled, /* The eventpoint is inactive, and cannot 187c50c785cSJohn Marino trigger. */ 188c50c785cSJohn Marino bp_enabled, /* The eventpoint is active, and can 189c50c785cSJohn Marino trigger. */ 190c50c785cSJohn Marino bp_call_disabled, /* The eventpoint has been disabled while a 191c50c785cSJohn Marino call into the inferior is "in flight", 192c50c785cSJohn Marino because some eventpoints interfere with 193c50c785cSJohn Marino the implementation of a call on some 194c50c785cSJohn Marino targets. The eventpoint will be 195c50c785cSJohn Marino automatically enabled and reset when the 196c50c785cSJohn Marino call "lands" (either completes, or stops 197c50c785cSJohn Marino at another eventpoint). */ 198c50c785cSJohn Marino bp_permanent /* There is a breakpoint instruction 199c50c785cSJohn Marino hard-wired into the target's code. Don't 200c50c785cSJohn Marino try to write another breakpoint 201c50c785cSJohn Marino instruction on top of it, or restore its 202c50c785cSJohn Marino value. Step over it using the 203c50c785cSJohn Marino architecture's SKIP_INSN macro. */ 2045796c8dcSSimon Schubert }; 2055796c8dcSSimon Schubert 2065796c8dcSSimon Schubert 2075796c8dcSSimon Schubert /* Disposition of breakpoint. Ie: what to do after hitting it. */ 2085796c8dcSSimon Schubert 2095796c8dcSSimon Schubert enum bpdisp 2105796c8dcSSimon Schubert { 2115796c8dcSSimon Schubert disp_del, /* Delete it */ 212c50c785cSJohn Marino disp_del_at_next_stop, /* Delete at next stop, 213c50c785cSJohn Marino whether hit or not */ 2145796c8dcSSimon Schubert disp_disable, /* Disable it */ 2155796c8dcSSimon Schubert disp_donttouch /* Leave it alone */ 2165796c8dcSSimon Schubert }; 2175796c8dcSSimon Schubert 2185796c8dcSSimon Schubert enum target_hw_bp_type 2195796c8dcSSimon Schubert { 2205796c8dcSSimon Schubert hw_write = 0, /* Common HW watchpoint */ 2215796c8dcSSimon Schubert hw_read = 1, /* Read HW watchpoint */ 2225796c8dcSSimon Schubert hw_access = 2, /* Access HW watchpoint */ 2235796c8dcSSimon Schubert hw_execute = 3 /* Execute HW breakpoint */ 2245796c8dcSSimon Schubert }; 2255796c8dcSSimon Schubert 2265796c8dcSSimon Schubert 227*ef5ccd6cSJohn Marino /* Status of breakpoint conditions used when synchronizing 228*ef5ccd6cSJohn Marino conditions with the target. */ 229*ef5ccd6cSJohn Marino 230*ef5ccd6cSJohn Marino enum condition_status 231*ef5ccd6cSJohn Marino { 232*ef5ccd6cSJohn Marino condition_unchanged = 0, 233*ef5ccd6cSJohn Marino condition_modified, 234*ef5ccd6cSJohn Marino condition_updated 235*ef5ccd6cSJohn Marino }; 236*ef5ccd6cSJohn Marino 2375796c8dcSSimon Schubert /* Information used by targets to insert and remove breakpoints. */ 2385796c8dcSSimon Schubert 2395796c8dcSSimon Schubert struct bp_target_info 2405796c8dcSSimon Schubert { 241cf7f2e2dSJohn Marino /* Address space at which the breakpoint was placed. */ 242cf7f2e2dSJohn Marino struct address_space *placed_address_space; 243cf7f2e2dSJohn Marino 2445796c8dcSSimon Schubert /* Address at which the breakpoint was placed. This is normally the 2455796c8dcSSimon Schubert same as ADDRESS from the bp_location, except when adjustment 2465796c8dcSSimon Schubert happens in gdbarch_breakpoint_from_pc. The most common form of 2475796c8dcSSimon Schubert adjustment is stripping an alternate ISA marker from the PC which 2485796c8dcSSimon Schubert is used to determine the type of breakpoint to insert. */ 2495796c8dcSSimon Schubert CORE_ADDR placed_address; 2505796c8dcSSimon Schubert 251c50c785cSJohn Marino /* If this is a ranged breakpoint, then this field contains the 252c50c785cSJohn Marino length of the range that will be watched for execution. */ 253c50c785cSJohn Marino int length; 254c50c785cSJohn Marino 2555796c8dcSSimon Schubert /* If the breakpoint lives in memory and reading that memory would 2565796c8dcSSimon Schubert give back the breakpoint, instead of the original contents, then 2575796c8dcSSimon Schubert the original contents are cached here. Only SHADOW_LEN bytes of 2585796c8dcSSimon Schubert this buffer are valid, and only when the breakpoint is inserted. */ 2595796c8dcSSimon Schubert gdb_byte shadow_contents[BREAKPOINT_MAX]; 2605796c8dcSSimon Schubert 2615796c8dcSSimon Schubert /* The length of the data cached in SHADOW_CONTENTS. */ 2625796c8dcSSimon Schubert int shadow_len; 2635796c8dcSSimon Schubert 2645796c8dcSSimon Schubert /* The size of the placed breakpoint, according to 265c50c785cSJohn Marino gdbarch_breakpoint_from_pc, when the breakpoint was inserted. 266c50c785cSJohn Marino This is generally the same as SHADOW_LEN, unless we did not need 2675796c8dcSSimon Schubert to read from the target to implement the memory breakpoint 268c50c785cSJohn Marino (e.g. if a remote stub handled the details). We may still need 269c50c785cSJohn Marino the size to remove the breakpoint safely. */ 2705796c8dcSSimon Schubert int placed_size; 271*ef5ccd6cSJohn Marino 272*ef5ccd6cSJohn Marino /* Vector of conditions the target should evaluate if it supports target-side 273*ef5ccd6cSJohn Marino breakpoint conditions. */ 274*ef5ccd6cSJohn Marino VEC(agent_expr_p) *conditions; 275*ef5ccd6cSJohn Marino 276*ef5ccd6cSJohn Marino /* Vector of commands the target should evaluate if it supports 277*ef5ccd6cSJohn Marino target-side breakpoint commands. */ 278*ef5ccd6cSJohn Marino VEC(agent_expr_p) *tcommands; 279*ef5ccd6cSJohn Marino 280*ef5ccd6cSJohn Marino /* Flag that is true if the breakpoint should be left in place even 281*ef5ccd6cSJohn Marino when GDB is not connected. */ 282*ef5ccd6cSJohn Marino int persist; 2835796c8dcSSimon Schubert }; 2845796c8dcSSimon Schubert 2855796c8dcSSimon Schubert /* GDB maintains two types of information about each breakpoint (or 2865796c8dcSSimon Schubert watchpoint, or other related event). The first type corresponds 2875796c8dcSSimon Schubert to struct breakpoint; this is a relatively high-level structure 2885796c8dcSSimon Schubert which contains the source location(s), stopping conditions, user 2895796c8dcSSimon Schubert commands to execute when the breakpoint is hit, and so forth. 2905796c8dcSSimon Schubert 2915796c8dcSSimon Schubert The second type of information corresponds to struct bp_location. 2925796c8dcSSimon Schubert Each breakpoint has one or (eventually) more locations associated 2935796c8dcSSimon Schubert with it, which represent target-specific and machine-specific 2945796c8dcSSimon Schubert mechanisms for stopping the program. For instance, a watchpoint 2955796c8dcSSimon Schubert expression may require multiple hardware watchpoints in order to 2965796c8dcSSimon Schubert catch all changes in the value of the expression being watched. */ 2975796c8dcSSimon Schubert 2985796c8dcSSimon Schubert enum bp_loc_type 2995796c8dcSSimon Schubert { 3005796c8dcSSimon Schubert bp_loc_software_breakpoint, 3015796c8dcSSimon Schubert bp_loc_hardware_breakpoint, 3025796c8dcSSimon Schubert bp_loc_hardware_watchpoint, 3035796c8dcSSimon Schubert bp_loc_other /* Miscellaneous... */ 3045796c8dcSSimon Schubert }; 3055796c8dcSSimon Schubert 306a45ae5f8SJohn Marino /* This structure is a collection of function pointers that, if 307a45ae5f8SJohn Marino available, will be called instead of performing the default action 308a45ae5f8SJohn Marino for this bp_loc_type. */ 309a45ae5f8SJohn Marino 310a45ae5f8SJohn Marino struct bp_location_ops 311a45ae5f8SJohn Marino { 312a45ae5f8SJohn Marino /* Destructor. Releases everything from SELF (but not SELF 313a45ae5f8SJohn Marino itself). */ 314a45ae5f8SJohn Marino void (*dtor) (struct bp_location *self); 315a45ae5f8SJohn Marino }; 316a45ae5f8SJohn Marino 3175796c8dcSSimon Schubert struct bp_location 3185796c8dcSSimon Schubert { 3195796c8dcSSimon Schubert /* Chain pointer to the next breakpoint location for 3205796c8dcSSimon Schubert the same parent breakpoint. */ 3215796c8dcSSimon Schubert struct bp_location *next; 3225796c8dcSSimon Schubert 323a45ae5f8SJohn Marino /* Methods associated with this location. */ 324a45ae5f8SJohn Marino const struct bp_location_ops *ops; 325a45ae5f8SJohn Marino 326c50c785cSJohn Marino /* The reference count. */ 327c50c785cSJohn Marino int refc; 328c50c785cSJohn Marino 3295796c8dcSSimon Schubert /* Type of this breakpoint location. */ 3305796c8dcSSimon Schubert enum bp_loc_type loc_type; 3315796c8dcSSimon Schubert 3325796c8dcSSimon Schubert /* Each breakpoint location must belong to exactly one higher-level 333c50c785cSJohn Marino breakpoint. This pointer is NULL iff this bp_location is no 334c50c785cSJohn Marino longer attached to a breakpoint. For example, when a breakpoint 335c50c785cSJohn Marino is deleted, its locations may still be found in the 336c50c785cSJohn Marino moribund_locations list, or if we had stopped for it, in 337c50c785cSJohn Marino bpstats. */ 3385796c8dcSSimon Schubert struct breakpoint *owner; 3395796c8dcSSimon Schubert 3405796c8dcSSimon Schubert /* Conditional. Break only if this expression's value is nonzero. 341cf7f2e2dSJohn Marino Unlike string form of condition, which is associated with 342cf7f2e2dSJohn Marino breakpoint, this is associated with location, since if breakpoint 343cf7f2e2dSJohn Marino has several locations, the evaluation of expression can be 344cf7f2e2dSJohn Marino different for different locations. Only valid for real 345cf7f2e2dSJohn Marino breakpoints; a watchpoint's conditional expression is stored in 346cf7f2e2dSJohn Marino the owner breakpoint object. */ 3475796c8dcSSimon Schubert struct expression *cond; 3485796c8dcSSimon Schubert 349*ef5ccd6cSJohn Marino /* Conditional expression in agent expression 350*ef5ccd6cSJohn Marino bytecode form. This is used for stub-side breakpoint 351*ef5ccd6cSJohn Marino condition evaluation. */ 352*ef5ccd6cSJohn Marino struct agent_expr *cond_bytecode; 353*ef5ccd6cSJohn Marino 354*ef5ccd6cSJohn Marino /* Signals that the condition has changed since the last time 355*ef5ccd6cSJohn Marino we updated the global location list. This means the condition 356*ef5ccd6cSJohn Marino needs to be sent to the target again. This is used together 357*ef5ccd6cSJohn Marino with target-side breakpoint conditions. 358*ef5ccd6cSJohn Marino 359*ef5ccd6cSJohn Marino condition_unchanged: It means there has been no condition changes. 360*ef5ccd6cSJohn Marino 361*ef5ccd6cSJohn Marino condition_modified: It means this location had its condition modified. 362*ef5ccd6cSJohn Marino 363*ef5ccd6cSJohn Marino condition_updated: It means we already marked all the locations that are 364*ef5ccd6cSJohn Marino duplicates of this location and thus we don't need to call 365*ef5ccd6cSJohn Marino force_breakpoint_reinsertion (...) for this location. */ 366*ef5ccd6cSJohn Marino 367*ef5ccd6cSJohn Marino enum condition_status condition_changed; 368*ef5ccd6cSJohn Marino 369*ef5ccd6cSJohn Marino struct agent_expr *cmd_bytecode; 370*ef5ccd6cSJohn Marino 371*ef5ccd6cSJohn Marino /* Signals that breakpoint conditions and/or commands need to be 372*ef5ccd6cSJohn Marino re-synched with the target. This has no use other than 373*ef5ccd6cSJohn Marino target-side breakpoints. */ 374*ef5ccd6cSJohn Marino char needs_update; 375*ef5ccd6cSJohn Marino 3765796c8dcSSimon Schubert /* This location's address is in an unloaded solib, and so this 3775796c8dcSSimon Schubert location should not be inserted. It will be automatically 3785796c8dcSSimon Schubert enabled when that solib is loaded. */ 3795796c8dcSSimon Schubert char shlib_disabled; 3805796c8dcSSimon Schubert 3815796c8dcSSimon Schubert /* Is this particular location enabled. */ 3825796c8dcSSimon Schubert char enabled; 3835796c8dcSSimon Schubert 3845796c8dcSSimon Schubert /* Nonzero if this breakpoint is now inserted. */ 3855796c8dcSSimon Schubert char inserted; 3865796c8dcSSimon Schubert 3875796c8dcSSimon Schubert /* Nonzero if this is not the first breakpoint in the list 388a45ae5f8SJohn Marino for the given address. location of tracepoint can _never_ 389a45ae5f8SJohn Marino be duplicated with other locations of tracepoints and other 390a45ae5f8SJohn Marino kinds of breakpoints, because two locations at the same 391a45ae5f8SJohn Marino address may have different actions, so both of these locations 392a45ae5f8SJohn Marino should be downloaded and so that `tfind N' always works. */ 3935796c8dcSSimon Schubert char duplicate; 3945796c8dcSSimon Schubert 3955796c8dcSSimon Schubert /* If we someday support real thread-specific breakpoints, then 3965796c8dcSSimon Schubert the breakpoint location will need a thread identifier. */ 3975796c8dcSSimon Schubert 3985796c8dcSSimon Schubert /* Data for specific breakpoint types. These could be a union, but 3995796c8dcSSimon Schubert simplicity is more important than memory usage for breakpoints. */ 4005796c8dcSSimon Schubert 4015796c8dcSSimon Schubert /* Architecture associated with this location's address. May be 4025796c8dcSSimon Schubert different from the breakpoint architecture. */ 4035796c8dcSSimon Schubert struct gdbarch *gdbarch; 4045796c8dcSSimon Schubert 405cf7f2e2dSJohn Marino /* The program space associated with this breakpoint location 406cf7f2e2dSJohn Marino address. Note that an address space may be represented in more 407cf7f2e2dSJohn Marino than one program space (e.g. each uClinux program will be given 408cf7f2e2dSJohn Marino its own program space, but there will only be one address space 409cf7f2e2dSJohn Marino for all of them), but we must not insert more than one location 410cf7f2e2dSJohn Marino at the same address in the same address space. */ 411cf7f2e2dSJohn Marino struct program_space *pspace; 412cf7f2e2dSJohn Marino 4135796c8dcSSimon Schubert /* Note that zero is a perfectly valid code address on some platforms 4145796c8dcSSimon Schubert (for example, the mn10200 (OBSOLETE) and mn10300 simulators). NULL 4155796c8dcSSimon Schubert is not a special value for this field. Valid for all types except 4165796c8dcSSimon Schubert bp_loc_other. */ 4175796c8dcSSimon Schubert CORE_ADDR address; 4185796c8dcSSimon Schubert 419c50c785cSJohn Marino /* For hardware watchpoints, the size of the memory region being 420c50c785cSJohn Marino watched. For hardware ranged breakpoints, the size of the 421c50c785cSJohn Marino breakpoint range. */ 4225796c8dcSSimon Schubert int length; 4235796c8dcSSimon Schubert 4245796c8dcSSimon Schubert /* Type of hardware watchpoint. */ 4255796c8dcSSimon Schubert enum target_hw_bp_type watchpoint_type; 4265796c8dcSSimon Schubert 4275796c8dcSSimon Schubert /* For any breakpoint type with an address, this is the section 428c50c785cSJohn Marino associated with the address. Used primarily for overlay 429c50c785cSJohn Marino debugging. */ 4305796c8dcSSimon Schubert struct obj_section *section; 4315796c8dcSSimon Schubert 4325796c8dcSSimon Schubert /* Address at which breakpoint was requested, either by the user or 4335796c8dcSSimon Schubert by GDB for internal breakpoints. This will usually be the same 4345796c8dcSSimon Schubert as ``address'' (above) except for cases in which 4355796c8dcSSimon Schubert ADJUST_BREAKPOINT_ADDRESS has computed a different address at 4365796c8dcSSimon Schubert which to place the breakpoint in order to comply with a 4375796c8dcSSimon Schubert processor's architectual constraints. */ 4385796c8dcSSimon Schubert CORE_ADDR requested_address; 4395796c8dcSSimon Schubert 440*ef5ccd6cSJohn Marino /* An additional address assigned with this location. This is currently 441*ef5ccd6cSJohn Marino only used by STT_GNU_IFUNC resolver breakpoints to hold the address 442*ef5ccd6cSJohn Marino of the resolver function. */ 443*ef5ccd6cSJohn Marino CORE_ADDR related_address; 444*ef5ccd6cSJohn Marino 445*ef5ccd6cSJohn Marino /* If the location comes from a probe point, this is the probe associated 446*ef5ccd6cSJohn Marino with it. */ 447*ef5ccd6cSJohn Marino struct probe *probe; 448*ef5ccd6cSJohn Marino 4495796c8dcSSimon Schubert char *function_name; 4505796c8dcSSimon Schubert 4515796c8dcSSimon Schubert /* Details of the placed breakpoint, when inserted. */ 4525796c8dcSSimon Schubert struct bp_target_info target_info; 4535796c8dcSSimon Schubert 4545796c8dcSSimon Schubert /* Similarly, for the breakpoint at an overlay's LMA, if necessary. */ 4555796c8dcSSimon Schubert struct bp_target_info overlay_target_info; 4565796c8dcSSimon Schubert 4575796c8dcSSimon Schubert /* In a non-stop mode, it's possible that we delete a breakpoint, 4585796c8dcSSimon Schubert but as we do that, some still running thread hits that breakpoint. 4595796c8dcSSimon Schubert For that reason, we need to keep locations belonging to deleted 4605796c8dcSSimon Schubert breakpoints for a bit, so that don't report unexpected SIGTRAP. 4615796c8dcSSimon Schubert We can't keep such locations forever, so we use a heuristic -- 4625796c8dcSSimon Schubert after we process certain number of inferior events since 4635796c8dcSSimon Schubert breakpoint was deleted, we retire all locations of that breakpoint. 4645796c8dcSSimon Schubert This variable keeps a number of events still to go, when 4655796c8dcSSimon Schubert it becomes 0 this location is retired. */ 4665796c8dcSSimon Schubert int events_till_retirement; 467a45ae5f8SJohn Marino 468*ef5ccd6cSJohn Marino /* Line number which was used to place this location. 469*ef5ccd6cSJohn Marino 470*ef5ccd6cSJohn Marino Breakpoint placed into a comment keeps it's user specified line number 471*ef5ccd6cSJohn Marino despite ADDRESS resolves into a different line number. */ 472a45ae5f8SJohn Marino 473a45ae5f8SJohn Marino int line_number; 474a45ae5f8SJohn Marino 475*ef5ccd6cSJohn Marino /* Symtab which was used to place this location. This is used 476*ef5ccd6cSJohn Marino to find the corresponding source file name. */ 477a45ae5f8SJohn Marino 478*ef5ccd6cSJohn Marino struct symtab *symtab; 479*ef5ccd6cSJohn Marino }; 480*ef5ccd6cSJohn Marino 481*ef5ccd6cSJohn Marino /* Return values for bpstat_explains_signal. Note that the order of 482*ef5ccd6cSJohn Marino the constants is important here; they are compared directly in 483*ef5ccd6cSJohn Marino bpstat_explains_signal. */ 484*ef5ccd6cSJohn Marino 485*ef5ccd6cSJohn Marino enum bpstat_signal_value 486*ef5ccd6cSJohn Marino { 487*ef5ccd6cSJohn Marino /* bpstat does not explain this signal. */ 488*ef5ccd6cSJohn Marino BPSTAT_SIGNAL_NO = 0, 489*ef5ccd6cSJohn Marino 490*ef5ccd6cSJohn Marino /* bpstat explains this signal; signal should not be delivered. */ 491*ef5ccd6cSJohn Marino BPSTAT_SIGNAL_HIDE, 492*ef5ccd6cSJohn Marino 493*ef5ccd6cSJohn Marino /* bpstat explains this signal; signal should be delivered. */ 494*ef5ccd6cSJohn Marino BPSTAT_SIGNAL_PASS 4955796c8dcSSimon Schubert }; 4965796c8dcSSimon Schubert 4975796c8dcSSimon Schubert /* This structure is a collection of function pointers that, if available, 4985796c8dcSSimon Schubert will be called instead of the performing the default action for this 4995796c8dcSSimon Schubert bptype. */ 5005796c8dcSSimon Schubert 5015796c8dcSSimon Schubert struct breakpoint_ops 5025796c8dcSSimon Schubert { 503a45ae5f8SJohn Marino /* Destructor. Releases everything from SELF (but not SELF 504a45ae5f8SJohn Marino itself). */ 505a45ae5f8SJohn Marino void (*dtor) (struct breakpoint *self); 506a45ae5f8SJohn Marino 507a45ae5f8SJohn Marino /* Allocate a location for this breakpoint. */ 508a45ae5f8SJohn Marino struct bp_location * (*allocate_location) (struct breakpoint *); 509a45ae5f8SJohn Marino 510a45ae5f8SJohn Marino /* Reevaluate a breakpoint. This is necessary after symbols change 511a45ae5f8SJohn Marino (e.g., an executable or DSO was loaded, or the inferior just 512a45ae5f8SJohn Marino started). */ 513a45ae5f8SJohn Marino void (*re_set) (struct breakpoint *self); 514a45ae5f8SJohn Marino 515c50c785cSJohn Marino /* Insert the breakpoint or watchpoint or activate the catchpoint. 516a45ae5f8SJohn Marino Return 0 for success, 1 if the breakpoint, watchpoint or 517a45ae5f8SJohn Marino catchpoint type is not supported, -1 for failure. */ 518c50c785cSJohn Marino int (*insert_location) (struct bp_location *); 5195796c8dcSSimon Schubert 5205796c8dcSSimon Schubert /* Remove the breakpoint/catchpoint that was previously inserted 521c50c785cSJohn Marino with the "insert" method above. Return 0 for success, 1 if the 522c50c785cSJohn Marino breakpoint, watchpoint or catchpoint type is not supported, 523c50c785cSJohn Marino -1 for failure. */ 524c50c785cSJohn Marino int (*remove_location) (struct bp_location *); 5255796c8dcSSimon Schubert 526a45ae5f8SJohn Marino /* Return true if it the target has stopped due to hitting 527a45ae5f8SJohn Marino breakpoint location BL. This function does not check if we 528*ef5ccd6cSJohn Marino should stop, only if BL explains the stop. ASPACE is the address 529*ef5ccd6cSJohn Marino space in which the event occurred, BP_ADDR is the address at 530*ef5ccd6cSJohn Marino which the inferior stopped, and WS is the target_waitstatus 531*ef5ccd6cSJohn Marino describing the event. */ 532*ef5ccd6cSJohn Marino int (*breakpoint_hit) (const struct bp_location *bl, 533*ef5ccd6cSJohn Marino struct address_space *aspace, 534*ef5ccd6cSJohn Marino CORE_ADDR bp_addr, 535*ef5ccd6cSJohn Marino const struct target_waitstatus *ws); 536c50c785cSJohn Marino 537a45ae5f8SJohn Marino /* Check internal conditions of the breakpoint referred to by BS. 538a45ae5f8SJohn Marino If we should not stop for this breakpoint, set BS->stop to 0. */ 539a45ae5f8SJohn Marino void (*check_status) (struct bpstats *bs); 540a45ae5f8SJohn Marino 541c50c785cSJohn Marino /* Tell how many hardware resources (debug registers) are needed 542c50c785cSJohn Marino for this breakpoint. If this function is not provided, then 543c50c785cSJohn Marino the breakpoint or watchpoint needs one debug register. */ 544c50c785cSJohn Marino int (*resources_needed) (const struct bp_location *); 5455796c8dcSSimon Schubert 546a45ae5f8SJohn Marino /* Tell whether we can downgrade from a hardware watchpoint to a software 547a45ae5f8SJohn Marino one. If not, the user will not be able to enable the watchpoint when 548a45ae5f8SJohn Marino there are not enough hardware resources available. */ 549a45ae5f8SJohn Marino int (*works_in_software_mode) (const struct breakpoint *); 550a45ae5f8SJohn Marino 5515796c8dcSSimon Schubert /* The normal print routine for this breakpoint, called when we 5525796c8dcSSimon Schubert hit it. */ 553a45ae5f8SJohn Marino enum print_stop_action (*print_it) (struct bpstats *bs); 5545796c8dcSSimon Schubert 555c50c785cSJohn Marino /* Display information about this breakpoint, for "info 556c50c785cSJohn Marino breakpoints". */ 5575796c8dcSSimon Schubert void (*print_one) (struct breakpoint *, struct bp_location **); 5585796c8dcSSimon Schubert 559c50c785cSJohn Marino /* Display extra information about this breakpoint, below the normal 560c50c785cSJohn Marino breakpoint description in "info breakpoints". 561c50c785cSJohn Marino 562c50c785cSJohn Marino In the example below, the "address range" line was printed 563c50c785cSJohn Marino by print_one_detail_ranged_breakpoint. 564c50c785cSJohn Marino 565c50c785cSJohn Marino (gdb) info breakpoints 566c50c785cSJohn Marino Num Type Disp Enb Address What 567c50c785cSJohn Marino 2 hw breakpoint keep y in main at test-watch.c:70 568c50c785cSJohn Marino address range: [0x10000458, 0x100004c7] 569c50c785cSJohn Marino 570c50c785cSJohn Marino */ 571c50c785cSJohn Marino void (*print_one_detail) (const struct breakpoint *, struct ui_out *); 572c50c785cSJohn Marino 573c50c785cSJohn Marino /* Display information about this breakpoint after setting it 574c50c785cSJohn Marino (roughly speaking; this is called from "mention"). */ 5755796c8dcSSimon Schubert void (*print_mention) (struct breakpoint *); 576cf7f2e2dSJohn Marino 577cf7f2e2dSJohn Marino /* Print to FP the CLI command that recreates this breakpoint. */ 578cf7f2e2dSJohn Marino void (*print_recreate) (struct breakpoint *, struct ui_file *fp); 579*ef5ccd6cSJohn Marino 580*ef5ccd6cSJohn Marino /* Create SALs from address string, storing the result in linespec_result. 581*ef5ccd6cSJohn Marino 582*ef5ccd6cSJohn Marino For an explanation about the arguments, see the function 583*ef5ccd6cSJohn Marino `create_sals_from_address_default'. 584*ef5ccd6cSJohn Marino 585*ef5ccd6cSJohn Marino This function is called inside `create_breakpoint'. */ 586*ef5ccd6cSJohn Marino void (*create_sals_from_address) (char **, struct linespec_result *, 587*ef5ccd6cSJohn Marino enum bptype, char *, char **); 588*ef5ccd6cSJohn Marino 589*ef5ccd6cSJohn Marino /* This method will be responsible for creating a breakpoint given its SALs. 590*ef5ccd6cSJohn Marino Usually, it just calls `create_breakpoints_sal' (for ordinary 591*ef5ccd6cSJohn Marino breakpoints). However, there may be some special cases where we might 592*ef5ccd6cSJohn Marino need to do some tweaks, e.g., see 593*ef5ccd6cSJohn Marino `strace_marker_create_breakpoints_sal'. 594*ef5ccd6cSJohn Marino 595*ef5ccd6cSJohn Marino This function is called inside `create_breakpoint'. */ 596*ef5ccd6cSJohn Marino void (*create_breakpoints_sal) (struct gdbarch *, 597*ef5ccd6cSJohn Marino struct linespec_result *, 598*ef5ccd6cSJohn Marino struct linespec_sals *, char *, 599*ef5ccd6cSJohn Marino char *, 600*ef5ccd6cSJohn Marino enum bptype, enum bpdisp, int, int, 601*ef5ccd6cSJohn Marino int, const struct breakpoint_ops *, 602*ef5ccd6cSJohn Marino int, int, int, unsigned); 603*ef5ccd6cSJohn Marino 604*ef5ccd6cSJohn Marino /* Given the address string (second parameter), this method decodes it 605*ef5ccd6cSJohn Marino and provides the SAL locations related to it. For ordinary breakpoints, 606*ef5ccd6cSJohn Marino it calls `decode_line_full'. 607*ef5ccd6cSJohn Marino 608*ef5ccd6cSJohn Marino This function is called inside `addr_string_to_sals'. */ 609*ef5ccd6cSJohn Marino void (*decode_linespec) (struct breakpoint *, char **, 610*ef5ccd6cSJohn Marino struct symtabs_and_lines *); 611*ef5ccd6cSJohn Marino 612*ef5ccd6cSJohn Marino /* Return true if this breakpoint explains a signal, but the signal 613*ef5ccd6cSJohn Marino should still be delivered to the inferior. This is used to make 614*ef5ccd6cSJohn Marino 'catch signal' interact properly with 'handle'; see 615*ef5ccd6cSJohn Marino bpstat_explains_signal. */ 616*ef5ccd6cSJohn Marino enum bpstat_signal_value (*explains_signal) (struct breakpoint *, 617*ef5ccd6cSJohn Marino enum gdb_signal); 618*ef5ccd6cSJohn Marino 619*ef5ccd6cSJohn Marino /* Called after evaluating the breakpoint's condition, 620*ef5ccd6cSJohn Marino and only if it evaluated true. */ 621*ef5ccd6cSJohn Marino void (*after_condition_true) (struct bpstats *bs); 6225796c8dcSSimon Schubert }; 6235796c8dcSSimon Schubert 624a45ae5f8SJohn Marino /* Helper for breakpoint_ops->print_recreate implementations. Prints 625a45ae5f8SJohn Marino the "thread" or "task" condition of B, and then a newline. 626a45ae5f8SJohn Marino 627a45ae5f8SJohn Marino Necessary because most breakpoint implementations accept 628a45ae5f8SJohn Marino thread/task conditions at the end of the spec line, like "break foo 629a45ae5f8SJohn Marino thread 1", which needs outputting before any breakpoint-type 630a45ae5f8SJohn Marino specific extra command necessary for B's recreation. */ 631a45ae5f8SJohn Marino extern void print_recreate_thread (struct breakpoint *b, struct ui_file *fp); 632a45ae5f8SJohn Marino 6335796c8dcSSimon Schubert enum watchpoint_triggered 6345796c8dcSSimon Schubert { 6355796c8dcSSimon Schubert /* This watchpoint definitely did not trigger. */ 6365796c8dcSSimon Schubert watch_triggered_no = 0, 6375796c8dcSSimon Schubert 6385796c8dcSSimon Schubert /* Some hardware watchpoint triggered, and it might have been this 6395796c8dcSSimon Schubert one, but we do not know which it was. */ 6405796c8dcSSimon Schubert watch_triggered_unknown, 6415796c8dcSSimon Schubert 6425796c8dcSSimon Schubert /* This hardware watchpoint definitely did trigger. */ 6435796c8dcSSimon Schubert watch_triggered_yes 6445796c8dcSSimon Schubert }; 6455796c8dcSSimon Schubert 6465796c8dcSSimon Schubert typedef struct bp_location *bp_location_p; 6475796c8dcSSimon Schubert DEF_VEC_P(bp_location_p); 6485796c8dcSSimon Schubert 649cf7f2e2dSJohn Marino /* A reference-counted struct command_line. This lets multiple 650cf7f2e2dSJohn Marino breakpoints share a single command list. This is an implementation 651cf7f2e2dSJohn Marino detail to the breakpoints module. */ 652cf7f2e2dSJohn Marino struct counted_command_line; 653cf7f2e2dSJohn Marino 654c50c785cSJohn Marino /* Some targets (e.g., embedded PowerPC) need two debug registers to set 655c50c785cSJohn Marino a watchpoint over a memory region. If this flag is true, GDB will use 656c50c785cSJohn Marino only one register per watchpoint, thus assuming that all acesses that 657c50c785cSJohn Marino modify a memory location happen at its starting address. */ 658c50c785cSJohn Marino 659c50c785cSJohn Marino extern int target_exact_watchpoints; 660c50c785cSJohn Marino 6615796c8dcSSimon Schubert /* Note that the ->silent field is not currently used by any commands 6625796c8dcSSimon Schubert (though the code is in there if it was to be, and set_raw_breakpoint 6635796c8dcSSimon Schubert does set it to 0). I implemented it because I thought it would be 6645796c8dcSSimon Schubert useful for a hack I had to put in; I'm going to leave it in because 6655796c8dcSSimon Schubert I can see how there might be times when it would indeed be useful */ 6665796c8dcSSimon Schubert 667a45ae5f8SJohn Marino /* This is for all kinds of breakpoints. */ 6685796c8dcSSimon Schubert 6695796c8dcSSimon Schubert struct breakpoint 6705796c8dcSSimon Schubert { 671a45ae5f8SJohn Marino /* Methods associated with this breakpoint. */ 672a45ae5f8SJohn Marino const struct breakpoint_ops *ops; 673a45ae5f8SJohn Marino 6745796c8dcSSimon Schubert struct breakpoint *next; 6755796c8dcSSimon Schubert /* Type of breakpoint. */ 6765796c8dcSSimon Schubert enum bptype type; 6775796c8dcSSimon Schubert /* Zero means disabled; remember the info but don't break here. */ 6785796c8dcSSimon Schubert enum enable_state enable_state; 6795796c8dcSSimon Schubert /* What to do with this breakpoint after we hit it. */ 6805796c8dcSSimon Schubert enum bpdisp disposition; 6815796c8dcSSimon Schubert /* Number assigned to distinguish breakpoints. */ 6825796c8dcSSimon Schubert int number; 6835796c8dcSSimon Schubert 6845796c8dcSSimon Schubert /* Location(s) associated with this high-level breakpoint. */ 6855796c8dcSSimon Schubert struct bp_location *loc; 6865796c8dcSSimon Schubert 6875796c8dcSSimon Schubert /* Non-zero means a silent breakpoint (don't print frame info 6885796c8dcSSimon Schubert if we stop here). */ 6895796c8dcSSimon Schubert unsigned char silent; 690c50c785cSJohn Marino /* Non-zero means display ADDR_STRING to the user verbatim. */ 691c50c785cSJohn Marino unsigned char display_canonical; 6925796c8dcSSimon Schubert /* Number of stops at this breakpoint that should 6935796c8dcSSimon Schubert be continued automatically before really stopping. */ 6945796c8dcSSimon Schubert int ignore_count; 695*ef5ccd6cSJohn Marino 696*ef5ccd6cSJohn Marino /* Number of stops at this breakpoint before it will be 697*ef5ccd6cSJohn Marino disabled. */ 698*ef5ccd6cSJohn Marino int enable_count; 699*ef5ccd6cSJohn Marino 700c50c785cSJohn Marino /* Chain of command lines to execute when this breakpoint is 701c50c785cSJohn Marino hit. */ 702cf7f2e2dSJohn Marino struct counted_command_line *commands; 7035796c8dcSSimon Schubert /* Stack depth (address of frame). If nonzero, break only if fp 7045796c8dcSSimon Schubert equals this. */ 7055796c8dcSSimon Schubert struct frame_id frame_id; 7065796c8dcSSimon Schubert 707a45ae5f8SJohn Marino /* The program space used to set the breakpoint. This is only set 708a45ae5f8SJohn Marino for breakpoints which are specific to a program space; for 709a45ae5f8SJohn Marino non-thread-specific ordinary breakpoints this is NULL. */ 710cf7f2e2dSJohn Marino struct program_space *pspace; 711cf7f2e2dSJohn Marino 7125796c8dcSSimon Schubert /* String we used to set the breakpoint (malloc'd). */ 7135796c8dcSSimon Schubert char *addr_string; 714c50c785cSJohn Marino 715a45ae5f8SJohn Marino /* The filter that should be passed to decode_line_full when 716a45ae5f8SJohn Marino re-setting this breakpoint. This may be NULL, but otherwise is 717a45ae5f8SJohn Marino allocated with xmalloc. */ 718a45ae5f8SJohn Marino char *filter; 719a45ae5f8SJohn Marino 720c50c785cSJohn Marino /* For a ranged breakpoint, the string we used to find 721c50c785cSJohn Marino the end of the range (malloc'd). */ 722c50c785cSJohn Marino char *addr_string_range_end; 723c50c785cSJohn Marino 7245796c8dcSSimon Schubert /* Architecture we used to set the breakpoint. */ 7255796c8dcSSimon Schubert struct gdbarch *gdbarch; 7265796c8dcSSimon Schubert /* Language we used to set the breakpoint. */ 7275796c8dcSSimon Schubert enum language language; 7285796c8dcSSimon Schubert /* Input radix we used to set the breakpoint. */ 7295796c8dcSSimon Schubert int input_radix; 730c50c785cSJohn Marino /* String form of the breakpoint condition (malloc'd), or NULL if 731c50c785cSJohn Marino there is no condition. */ 7325796c8dcSSimon Schubert char *cond_string; 733*ef5ccd6cSJohn Marino 734*ef5ccd6cSJohn Marino /* String form of extra parameters, or NULL if there are none. */ 735*ef5ccd6cSJohn Marino char *extra_string; 7365796c8dcSSimon Schubert 7375796c8dcSSimon Schubert /* Holds the address of the related watchpoint_scope breakpoint 738c50c785cSJohn Marino when using watchpoints on local variables (might the concept of 739c50c785cSJohn Marino a related breakpoint be useful elsewhere, if not just call it 740c50c785cSJohn Marino the watchpoint_scope breakpoint or something like that. 741c50c785cSJohn Marino FIXME). */ 7425796c8dcSSimon Schubert struct breakpoint *related_breakpoint; 7435796c8dcSSimon Schubert 744c50c785cSJohn Marino /* Thread number for thread-specific breakpoint, 745c50c785cSJohn Marino or -1 if don't care. */ 7465796c8dcSSimon Schubert int thread; 7475796c8dcSSimon Schubert 748c50c785cSJohn Marino /* Ada task number for task-specific breakpoint, 749c50c785cSJohn Marino or 0 if don't care. */ 7505796c8dcSSimon Schubert int task; 7515796c8dcSSimon Schubert 7525796c8dcSSimon Schubert /* Count of the number of times this breakpoint was taken, dumped 7535796c8dcSSimon Schubert with the info, but not used for anything else. Useful for 7545796c8dcSSimon Schubert seeing how many times you hit a break prior to the program 7555796c8dcSSimon Schubert aborting, so you can back up to just before the abort. */ 7565796c8dcSSimon Schubert int hit_count; 7575796c8dcSSimon Schubert 7585796c8dcSSimon Schubert /* Is breakpoint's condition not yet parsed because we found 7595796c8dcSSimon Schubert no location initially so had no context to parse 7605796c8dcSSimon Schubert the condition in. */ 7615796c8dcSSimon Schubert int condition_not_parsed; 7625796c8dcSSimon Schubert 763a45ae5f8SJohn Marino /* With a Python scripting enabled GDB, store a reference to the 764a45ae5f8SJohn Marino Python object that has been associated with this breakpoint. 765a45ae5f8SJohn Marino This is always NULL for a GDB that is not script enabled. It 766a45ae5f8SJohn Marino can sometimes be NULL for enabled GDBs as not all breakpoint 767a45ae5f8SJohn Marino types are tracked by the Python scripting API. */ 768a45ae5f8SJohn Marino struct breakpoint_object *py_bp_object; 769a45ae5f8SJohn Marino }; 770a45ae5f8SJohn Marino 771a45ae5f8SJohn Marino /* An instance of this type is used to represent a watchpoint. It 772a45ae5f8SJohn Marino includes a "struct breakpoint" as a kind of base class; users 773a45ae5f8SJohn Marino downcast to "struct breakpoint *" when needed. */ 774a45ae5f8SJohn Marino 775a45ae5f8SJohn Marino struct watchpoint 776a45ae5f8SJohn Marino { 777a45ae5f8SJohn Marino /* The base class. */ 778a45ae5f8SJohn Marino struct breakpoint base; 779a45ae5f8SJohn Marino 780a45ae5f8SJohn Marino /* String form of exp to use for displaying to the user (malloc'd), 781a45ae5f8SJohn Marino or NULL if none. */ 782a45ae5f8SJohn Marino char *exp_string; 783a45ae5f8SJohn Marino /* String form to use for reparsing of EXP (malloc'd) or NULL. */ 784a45ae5f8SJohn Marino char *exp_string_reparse; 785a45ae5f8SJohn Marino 786a45ae5f8SJohn Marino /* The expression we are watching, or NULL if not a watchpoint. */ 787a45ae5f8SJohn Marino struct expression *exp; 788a45ae5f8SJohn Marino /* The largest block within which it is valid, or NULL if it is 789a45ae5f8SJohn Marino valid anywhere (e.g. consists just of global symbols). */ 790*ef5ccd6cSJohn Marino const struct block *exp_valid_block; 791a45ae5f8SJohn Marino /* The conditional expression if any. */ 792a45ae5f8SJohn Marino struct expression *cond_exp; 793a45ae5f8SJohn Marino /* The largest block within which it is valid, or NULL if it is 794a45ae5f8SJohn Marino valid anywhere (e.g. consists just of global symbols). */ 795*ef5ccd6cSJohn Marino const struct block *cond_exp_valid_block; 796a45ae5f8SJohn Marino /* Value of the watchpoint the last time we checked it, or NULL when 797a45ae5f8SJohn Marino we do not know the value yet or the value was not readable. VAL 798a45ae5f8SJohn Marino is never lazy. */ 799a45ae5f8SJohn Marino struct value *val; 800a45ae5f8SJohn Marino /* Nonzero if VAL is valid. If VAL_VALID is set but VAL is NULL, 801a45ae5f8SJohn Marino then an error occurred reading the value. */ 802a45ae5f8SJohn Marino int val_valid; 803a45ae5f8SJohn Marino 804a45ae5f8SJohn Marino /* Holds the frame address which identifies the frame this 805a45ae5f8SJohn Marino watchpoint should be evaluated in, or `null' if the watchpoint 806a45ae5f8SJohn Marino should be evaluated on the outermost frame. */ 807a45ae5f8SJohn Marino struct frame_id watchpoint_frame; 808a45ae5f8SJohn Marino 809a45ae5f8SJohn Marino /* Holds the thread which identifies the frame this watchpoint 810a45ae5f8SJohn Marino should be considered in scope for, or `null_ptid' if the 811a45ae5f8SJohn Marino watchpoint should be evaluated in all threads. */ 812a45ae5f8SJohn Marino ptid_t watchpoint_thread; 813a45ae5f8SJohn Marino 814a45ae5f8SJohn Marino /* For hardware watchpoints, the triggered status according to the 815a45ae5f8SJohn Marino hardware. */ 816a45ae5f8SJohn Marino enum watchpoint_triggered watchpoint_triggered; 817a45ae5f8SJohn Marino 818a45ae5f8SJohn Marino /* Whether this watchpoint is exact (see 819a45ae5f8SJohn Marino target_exact_watchpoints). */ 820a45ae5f8SJohn Marino int exact; 821a45ae5f8SJohn Marino 822a45ae5f8SJohn Marino /* The mask address for a masked hardware watchpoint. */ 823a45ae5f8SJohn Marino CORE_ADDR hw_wp_mask; 824a45ae5f8SJohn Marino }; 825a45ae5f8SJohn Marino 826*ef5ccd6cSJohn Marino /* Return true if BPT is either a software breakpoint or a hardware 827*ef5ccd6cSJohn Marino breakpoint. */ 828*ef5ccd6cSJohn Marino 829*ef5ccd6cSJohn Marino extern int is_breakpoint (const struct breakpoint *bpt); 830*ef5ccd6cSJohn Marino 831a45ae5f8SJohn Marino /* Returns true if BPT is really a watchpoint. */ 832a45ae5f8SJohn Marino 833a45ae5f8SJohn Marino extern int is_watchpoint (const struct breakpoint *bpt); 834a45ae5f8SJohn Marino 835a45ae5f8SJohn Marino /* An instance of this type is used to represent all kinds of 836a45ae5f8SJohn Marino tracepoints. It includes a "struct breakpoint" as a kind of base 837a45ae5f8SJohn Marino class; users downcast to "struct breakpoint *" when needed. */ 838a45ae5f8SJohn Marino 839a45ae5f8SJohn Marino struct tracepoint 840a45ae5f8SJohn Marino { 841a45ae5f8SJohn Marino /* The base class. */ 842a45ae5f8SJohn Marino struct breakpoint base; 843a45ae5f8SJohn Marino 844a45ae5f8SJohn Marino /* Number of times this tracepoint should single-step and collect 845a45ae5f8SJohn Marino additional data. */ 8465796c8dcSSimon Schubert long step_count; 8475796c8dcSSimon Schubert 8485796c8dcSSimon Schubert /* Number of times this tracepoint should be hit before 8495796c8dcSSimon Schubert disabling/ending. */ 8505796c8dcSSimon Schubert int pass_count; 8515796c8dcSSimon Schubert 852cf7f2e2dSJohn Marino /* The number of the tracepoint on the target. */ 853cf7f2e2dSJohn Marino int number_on_target; 854cf7f2e2dSJohn Marino 855a45ae5f8SJohn Marino /* The total space taken by all the trace frames for this 856a45ae5f8SJohn Marino tracepoint. */ 857a45ae5f8SJohn Marino ULONGEST traceframe_usage; 858a45ae5f8SJohn Marino 859cf7f2e2dSJohn Marino /* The static tracepoint marker id, if known. */ 860cf7f2e2dSJohn Marino char *static_trace_marker_id; 861cf7f2e2dSJohn Marino 862cf7f2e2dSJohn Marino /* LTTng/UST allow more than one marker with the same ID string, 863cf7f2e2dSJohn Marino although it unadvised because it confuses tools. When setting 864cf7f2e2dSJohn Marino static tracepoints by marker ID, this will record the index in 865cf7f2e2dSJohn Marino the array of markers we found for the given marker ID for which 866a45ae5f8SJohn Marino this static tracepoint corresponds. When resetting breakpoints, 867a45ae5f8SJohn Marino we will use this index to try to find the same marker again. */ 868cf7f2e2dSJohn Marino int static_trace_marker_id_idx; 8695796c8dcSSimon Schubert }; 8705796c8dcSSimon Schubert 8715796c8dcSSimon Schubert typedef struct breakpoint *breakpoint_p; 8725796c8dcSSimon Schubert DEF_VEC_P(breakpoint_p); 8735796c8dcSSimon Schubert 8745796c8dcSSimon Schubert /* The following stuff is an abstract data type "bpstat" ("breakpoint 8755796c8dcSSimon Schubert status"). This provides the ability to determine whether we have 8765796c8dcSSimon Schubert stopped at a breakpoint, and what we should do about it. */ 8775796c8dcSSimon Schubert 8785796c8dcSSimon Schubert typedef struct bpstats *bpstat; 8795796c8dcSSimon Schubert 8805796c8dcSSimon Schubert /* Clears a chain of bpstat, freeing storage 8815796c8dcSSimon Schubert of each. */ 8825796c8dcSSimon Schubert extern void bpstat_clear (bpstat *); 8835796c8dcSSimon Schubert 8845796c8dcSSimon Schubert /* Return a copy of a bpstat. Like "bs1 = bs2" but all storage that 8855796c8dcSSimon Schubert is part of the bpstat is copied as well. */ 8865796c8dcSSimon Schubert extern bpstat bpstat_copy (bpstat); 8875796c8dcSSimon Schubert 888cf7f2e2dSJohn Marino extern bpstat bpstat_stop_status (struct address_space *aspace, 889*ef5ccd6cSJohn Marino CORE_ADDR pc, ptid_t ptid, 890*ef5ccd6cSJohn Marino const struct target_waitstatus *ws); 8915796c8dcSSimon Schubert 8925796c8dcSSimon Schubert /* This bpstat_what stuff tells wait_for_inferior what to do with a 893cf7f2e2dSJohn Marino breakpoint (a challenging task). 894cf7f2e2dSJohn Marino 895cf7f2e2dSJohn Marino The enum values order defines priority-like order of the actions. 896cf7f2e2dSJohn Marino Once you've decided that some action is appropriate, you'll never 897cf7f2e2dSJohn Marino go back and decide something of a lower priority is better. Each 898cf7f2e2dSJohn Marino of these actions is mutually exclusive with the others. That 899cf7f2e2dSJohn Marino means, that if you find yourself adding a new action class here and 900cf7f2e2dSJohn Marino wanting to tell GDB that you have two simultaneous actions to 901cf7f2e2dSJohn Marino handle, something is wrong, and you probably don't actually need a 902cf7f2e2dSJohn Marino new action type. 903cf7f2e2dSJohn Marino 904cf7f2e2dSJohn Marino Note that a step resume breakpoint overrides another breakpoint of 905cf7f2e2dSJohn Marino signal handling (see comment in wait_for_inferior at where we set 906cf7f2e2dSJohn Marino the step_resume breakpoint). */ 9075796c8dcSSimon Schubert 9085796c8dcSSimon Schubert enum bpstat_what_main_action 9095796c8dcSSimon Schubert { 9105796c8dcSSimon Schubert /* Perform various other tests; that is, this bpstat does not 9115796c8dcSSimon Schubert say to perform any action (e.g. failed watchpoint and nothing 9125796c8dcSSimon Schubert else). */ 9135796c8dcSSimon Schubert BPSTAT_WHAT_KEEP_CHECKING, 9145796c8dcSSimon Schubert 9155796c8dcSSimon Schubert /* Remove breakpoints, single step once, then put them back in and 916c50c785cSJohn Marino go back to what we were doing. It's possible that this should 917c50c785cSJohn Marino be removed from the main_action and put into a separate field, 918c50c785cSJohn Marino to more cleanly handle 919c50c785cSJohn Marino BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE. */ 9205796c8dcSSimon Schubert BPSTAT_WHAT_SINGLE, 9215796c8dcSSimon Schubert 9225796c8dcSSimon Schubert /* Set longjmp_resume breakpoint, remove all other breakpoints, 923c50c785cSJohn Marino and continue. The "remove all other breakpoints" part is 924c50c785cSJohn Marino required if we are also stepping over another breakpoint as 925c50c785cSJohn Marino well as doing the longjmp handling. */ 9265796c8dcSSimon Schubert BPSTAT_WHAT_SET_LONGJMP_RESUME, 9275796c8dcSSimon Schubert 9285796c8dcSSimon Schubert /* Clear longjmp_resume breakpoint, then handle as 9295796c8dcSSimon Schubert BPSTAT_WHAT_KEEP_CHECKING. */ 9305796c8dcSSimon Schubert BPSTAT_WHAT_CLEAR_LONGJMP_RESUME, 9315796c8dcSSimon Schubert 932a45ae5f8SJohn Marino /* Clear step resume breakpoint, and keep checking. */ 933a45ae5f8SJohn Marino BPSTAT_WHAT_STEP_RESUME, 934a45ae5f8SJohn Marino 935cf7f2e2dSJohn Marino /* Rather than distinguish between noisy and silent stops here, it 936cf7f2e2dSJohn Marino might be cleaner to have bpstat_print make that decision (also 937cf7f2e2dSJohn Marino taking into account stop_print_frame and source_only). But the 938c50c785cSJohn Marino implications are a bit scary (interaction with auto-displays, 939c50c785cSJohn Marino etc.), so I won't try it. */ 940cf7f2e2dSJohn Marino 941cf7f2e2dSJohn Marino /* Stop silently. */ 942cf7f2e2dSJohn Marino BPSTAT_WHAT_STOP_SILENT, 943cf7f2e2dSJohn Marino 944cf7f2e2dSJohn Marino /* Stop and print. */ 945cf7f2e2dSJohn Marino BPSTAT_WHAT_STOP_NOISY, 946cf7f2e2dSJohn Marino 947a45ae5f8SJohn Marino /* Clear step resume breakpoint, and keep checking. High-priority 948a45ae5f8SJohn Marino step-resume breakpoints are used when even if there's a user 949a45ae5f8SJohn Marino breakpoint at the current PC when we set the step-resume 950a45ae5f8SJohn Marino breakpoint, we don't want to re-handle any breakpoint other 951a45ae5f8SJohn Marino than the step-resume when it's hit; instead we want to move 952a45ae5f8SJohn Marino past the breakpoint. This is used in the case of skipping 953a45ae5f8SJohn Marino signal handlers. */ 954a45ae5f8SJohn Marino BPSTAT_WHAT_HP_STEP_RESUME, 955cf7f2e2dSJohn Marino }; 9565796c8dcSSimon Schubert 957cf7f2e2dSJohn Marino /* An enum indicating the kind of "stack dummy" stop. This is a bit 958cf7f2e2dSJohn Marino of a misnomer because only one kind of truly a stack dummy. */ 959cf7f2e2dSJohn Marino enum stop_stack_kind 960cf7f2e2dSJohn Marino { 961cf7f2e2dSJohn Marino /* We didn't stop at a stack dummy breakpoint. */ 962cf7f2e2dSJohn Marino STOP_NONE = 0, 9635796c8dcSSimon Schubert 964cf7f2e2dSJohn Marino /* Stopped at a stack dummy. */ 965cf7f2e2dSJohn Marino STOP_STACK_DUMMY, 9665796c8dcSSimon Schubert 967cf7f2e2dSJohn Marino /* Stopped at std::terminate. */ 968cf7f2e2dSJohn Marino STOP_STD_TERMINATE 9695796c8dcSSimon Schubert }; 9705796c8dcSSimon Schubert 9715796c8dcSSimon Schubert struct bpstat_what 9725796c8dcSSimon Schubert { 9735796c8dcSSimon Schubert enum bpstat_what_main_action main_action; 9745796c8dcSSimon Schubert 975c50c785cSJohn Marino /* Did we hit a call dummy breakpoint? This only goes with a 976c50c785cSJohn Marino main_action of BPSTAT_WHAT_STOP_SILENT or 977c50c785cSJohn Marino BPSTAT_WHAT_STOP_NOISY (the concept of continuing from a call 978c50c785cSJohn Marino dummy without popping the frame is not a useful one). */ 979cf7f2e2dSJohn Marino enum stop_stack_kind call_dummy; 980c50c785cSJohn Marino 981c50c785cSJohn Marino /* Used for BPSTAT_WHAT_SET_LONGJMP_RESUME and 982c50c785cSJohn Marino BPSTAT_WHAT_CLEAR_LONGJMP_RESUME. True if we are handling a 983c50c785cSJohn Marino longjmp, false if we are handling an exception. */ 984c50c785cSJohn Marino int is_longjmp; 9855796c8dcSSimon Schubert }; 9865796c8dcSSimon Schubert 9875796c8dcSSimon Schubert /* The possible return values for print_bpstat, print_it_normal, 9885796c8dcSSimon Schubert print_it_done, print_it_noop. */ 9895796c8dcSSimon Schubert enum print_stop_action 9905796c8dcSSimon Schubert { 991a45ae5f8SJohn Marino /* We printed nothing or we need to do some more analysis. */ 9925796c8dcSSimon Schubert PRINT_UNKNOWN = -1, 993a45ae5f8SJohn Marino 994a45ae5f8SJohn Marino /* We printed something, and we *do* desire that something to be 995a45ae5f8SJohn Marino followed by a location. */ 9965796c8dcSSimon Schubert PRINT_SRC_AND_LOC, 997a45ae5f8SJohn Marino 998a45ae5f8SJohn Marino /* We printed something, and we do *not* desire that something to 999a45ae5f8SJohn Marino be followed by a location. */ 10005796c8dcSSimon Schubert PRINT_SRC_ONLY, 1001a45ae5f8SJohn Marino 1002a45ae5f8SJohn Marino /* We already printed all we needed to print, don't print anything 1003a45ae5f8SJohn Marino else. */ 10045796c8dcSSimon Schubert PRINT_NOTHING 10055796c8dcSSimon Schubert }; 10065796c8dcSSimon Schubert 10075796c8dcSSimon Schubert /* Tell what to do about this bpstat. */ 10085796c8dcSSimon Schubert struct bpstat_what bpstat_what (bpstat); 10095796c8dcSSimon Schubert 10105796c8dcSSimon Schubert /* Find the bpstat associated with a breakpoint. NULL otherwise. */ 10115796c8dcSSimon Schubert bpstat bpstat_find_breakpoint (bpstat, struct breakpoint *); 10125796c8dcSSimon Schubert 10135796c8dcSSimon Schubert /* Nonzero if a signal that we got in wait() was due to circumstances 1014*ef5ccd6cSJohn Marino explained by the bpstat; and the signal should therefore not be 1015*ef5ccd6cSJohn Marino delivered. */ 1016*ef5ccd6cSJohn Marino extern enum bpstat_signal_value bpstat_explains_signal (bpstat, 1017*ef5ccd6cSJohn Marino enum gdb_signal); 10185796c8dcSSimon Schubert 1019cf7f2e2dSJohn Marino /* Nonzero is this bpstat causes a stop. */ 1020cf7f2e2dSJohn Marino extern int bpstat_causes_stop (bpstat); 1021cf7f2e2dSJohn Marino 10225796c8dcSSimon Schubert /* Nonzero if we should step constantly (e.g. watchpoints on machines 10235796c8dcSSimon Schubert without hardware support). This isn't related to a specific bpstat, 10245796c8dcSSimon Schubert just to things like whether watchpoints are set. */ 10255796c8dcSSimon Schubert extern int bpstat_should_step (void); 10265796c8dcSSimon Schubert 10275796c8dcSSimon Schubert /* Print a message indicating what happened. Returns nonzero to 10285796c8dcSSimon Schubert say that only the source line should be printed after this (zero 10295796c8dcSSimon Schubert return means print the frame as well as the source line). */ 1030a45ae5f8SJohn Marino extern enum print_stop_action bpstat_print (bpstat, int); 10315796c8dcSSimon Schubert 1032c50c785cSJohn Marino /* Put in *NUM the breakpoint number of the first breakpoint we are 1033c50c785cSJohn Marino stopped at. *BSP upon return is a bpstat which points to the 1034c50c785cSJohn Marino remaining breakpoints stopped at (but which is not guaranteed to be 1035c50c785cSJohn Marino good for anything but further calls to bpstat_num). 1036c50c785cSJohn Marino 10375796c8dcSSimon Schubert Return 0 if passed a bpstat which does not indicate any breakpoints. 10385796c8dcSSimon Schubert Return -1 if stopped at a breakpoint that has been deleted since 10395796c8dcSSimon Schubert we set it. 10405796c8dcSSimon Schubert Return 1 otherwise. */ 10415796c8dcSSimon Schubert extern int bpstat_num (bpstat *, int *); 10425796c8dcSSimon Schubert 10435796c8dcSSimon Schubert /* Perform actions associated with the stopped inferior. Actually, we 10445796c8dcSSimon Schubert just use this for breakpoint commands. Perhaps other actions will 10455796c8dcSSimon Schubert go here later, but this is executed at a late time (from the 10465796c8dcSSimon Schubert command loop). */ 10475796c8dcSSimon Schubert extern void bpstat_do_actions (void); 10485796c8dcSSimon Schubert 1049a45ae5f8SJohn Marino /* Modify all entries of STOP_BPSTAT of INFERIOR_PTID so that the actions will 1050a45ae5f8SJohn Marino not be performed. */ 1051a45ae5f8SJohn Marino extern void bpstat_clear_actions (void); 10525796c8dcSSimon Schubert 10535796c8dcSSimon Schubert /* Implementation: */ 10545796c8dcSSimon Schubert 1055c50c785cSJohn Marino /* Values used to tell the printing routine how to behave for this 1056c50c785cSJohn Marino bpstat. */ 10575796c8dcSSimon Schubert enum bp_print_how 10585796c8dcSSimon Schubert { 10595796c8dcSSimon Schubert /* This is used when we want to do a normal printing of the reason 10605796c8dcSSimon Schubert for stopping. The output will depend on the type of eventpoint 10615796c8dcSSimon Schubert we are dealing with. This is the default value, most commonly 10625796c8dcSSimon Schubert used. */ 10635796c8dcSSimon Schubert print_it_normal, 1064c50c785cSJohn Marino /* This is used when nothing should be printed for this bpstat 1065c50c785cSJohn Marino entry. */ 10665796c8dcSSimon Schubert print_it_noop, 10675796c8dcSSimon Schubert /* This is used when everything which needs to be printed has 10685796c8dcSSimon Schubert already been printed. But we still want to print the frame. */ 10695796c8dcSSimon Schubert print_it_done 10705796c8dcSSimon Schubert }; 10715796c8dcSSimon Schubert 10725796c8dcSSimon Schubert struct bpstats 10735796c8dcSSimon Schubert { 1074c50c785cSJohn Marino /* Linked list because there can be more than one breakpoint at 1075c50c785cSJohn Marino the same place, and a bpstat reflects the fact that all have 1076c50c785cSJohn Marino been hit. */ 10775796c8dcSSimon Schubert bpstat next; 1078c50c785cSJohn Marino 1079c50c785cSJohn Marino /* Location that caused the stop. Locations are refcounted, so 1080c50c785cSJohn Marino this will never be NULL. Note that this location may end up 1081c50c785cSJohn Marino detached from a breakpoint, but that does not necessary mean 1082c50c785cSJohn Marino that the struct breakpoint is gone. E.g., consider a 1083c50c785cSJohn Marino watchpoint with a condition that involves an inferior function 1084c50c785cSJohn Marino call. Watchpoint locations are recreated often (on resumes, 1085c50c785cSJohn Marino hence on infcalls too). Between creating the bpstat and after 1086c50c785cSJohn Marino evaluating the watchpoint condition, this location may hence 1087c50c785cSJohn Marino end up detached from its original owner watchpoint, even though 1088c50c785cSJohn Marino the watchpoint is still listed. If it's condition evaluates as 1089c50c785cSJohn Marino true, we still want this location to cause a stop, and we will 1090c50c785cSJohn Marino still need to know which watchpoint it was originally attached. 1091c50c785cSJohn Marino What this means is that we should not (in most cases) follow 1092c50c785cSJohn Marino the `bpstat->bp_location->owner' link, but instead use the 1093c50c785cSJohn Marino `breakpoint_at' field below. */ 1094c50c785cSJohn Marino struct bp_location *bp_location_at; 1095c50c785cSJohn Marino 1096c50c785cSJohn Marino /* Breakpoint that caused the stop. This is nullified if the 1097c50c785cSJohn Marino breakpoint ends up being deleted. See comments on 1098c50c785cSJohn Marino `bp_location_at' above for why do we need this field instead of 1099c50c785cSJohn Marino following the location's owner. */ 1100c50c785cSJohn Marino struct breakpoint *breakpoint_at; 1101c50c785cSJohn Marino 1102cf7f2e2dSJohn Marino /* The associated command list. */ 1103cf7f2e2dSJohn Marino struct counted_command_line *commands; 1104c50c785cSJohn Marino 11055796c8dcSSimon Schubert /* Old value associated with a watchpoint. */ 11065796c8dcSSimon Schubert struct value *old_val; 11075796c8dcSSimon Schubert 11085796c8dcSSimon Schubert /* Nonzero if this breakpoint tells us to print the frame. */ 11095796c8dcSSimon Schubert char print; 11105796c8dcSSimon Schubert 11115796c8dcSSimon Schubert /* Nonzero if this breakpoint tells us to stop. */ 11125796c8dcSSimon Schubert char stop; 11135796c8dcSSimon Schubert 11145796c8dcSSimon Schubert /* Tell bpstat_print and print_bp_stop_message how to print stuff 11155796c8dcSSimon Schubert associated with this element of the bpstat chain. */ 11165796c8dcSSimon Schubert enum bp_print_how print_it; 11175796c8dcSSimon Schubert }; 11185796c8dcSSimon Schubert 11195796c8dcSSimon Schubert enum inf_context 11205796c8dcSSimon Schubert { 11215796c8dcSSimon Schubert inf_starting, 11225796c8dcSSimon Schubert inf_running, 11235796c8dcSSimon Schubert inf_exited, 11245796c8dcSSimon Schubert inf_execd 11255796c8dcSSimon Schubert }; 11265796c8dcSSimon Schubert 11275796c8dcSSimon Schubert /* The possible return values for breakpoint_here_p. 11285796c8dcSSimon Schubert We guarantee that zero always means "no breakpoint here". */ 11295796c8dcSSimon Schubert enum breakpoint_here 11305796c8dcSSimon Schubert { 11315796c8dcSSimon Schubert no_breakpoint_here = 0, 11325796c8dcSSimon Schubert ordinary_breakpoint_here, 11335796c8dcSSimon Schubert permanent_breakpoint_here 11345796c8dcSSimon Schubert }; 11355796c8dcSSimon Schubert 11365796c8dcSSimon Schubert 11375796c8dcSSimon Schubert /* Prototypes for breakpoint-related functions. */ 11385796c8dcSSimon Schubert 1139c50c785cSJohn Marino extern enum breakpoint_here breakpoint_here_p (struct address_space *, 1140c50c785cSJohn Marino CORE_ADDR); 11415796c8dcSSimon Schubert 1142cf7f2e2dSJohn Marino extern int moribund_breakpoint_here_p (struct address_space *, CORE_ADDR); 11435796c8dcSSimon Schubert 1144cf7f2e2dSJohn Marino extern int breakpoint_inserted_here_p (struct address_space *, CORE_ADDR); 11455796c8dcSSimon Schubert 1146c50c785cSJohn Marino extern int regular_breakpoint_inserted_here_p (struct address_space *, 1147c50c785cSJohn Marino CORE_ADDR); 11485796c8dcSSimon Schubert 1149c50c785cSJohn Marino extern int software_breakpoint_inserted_here_p (struct address_space *, 1150c50c785cSJohn Marino CORE_ADDR); 11515796c8dcSSimon Schubert 1152cf7f2e2dSJohn Marino /* Returns true if there's a hardware watchpoint or access watchpoint 1153cf7f2e2dSJohn Marino inserted in the range defined by ADDR and LEN. */ 1154cf7f2e2dSJohn Marino extern int hardware_watchpoint_inserted_in_range (struct address_space *, 1155cf7f2e2dSJohn Marino CORE_ADDR addr, 1156cf7f2e2dSJohn Marino ULONGEST len); 1157cf7f2e2dSJohn Marino 1158c50c785cSJohn Marino extern int breakpoint_thread_match (struct address_space *, 1159c50c785cSJohn Marino CORE_ADDR, ptid_t); 11605796c8dcSSimon Schubert 11615796c8dcSSimon Schubert extern void until_break_command (char *, int, int); 11625796c8dcSSimon Schubert 1163a45ae5f8SJohn Marino /* Initialize a struct bp_location. */ 1164a45ae5f8SJohn Marino 1165a45ae5f8SJohn Marino extern void init_bp_location (struct bp_location *loc, 1166a45ae5f8SJohn Marino const struct bp_location_ops *ops, 1167a45ae5f8SJohn Marino struct breakpoint *owner); 1168a45ae5f8SJohn Marino 1169c50c785cSJohn Marino extern void update_breakpoint_locations (struct breakpoint *b, 1170c50c785cSJohn Marino struct symtabs_and_lines sals, 1171c50c785cSJohn Marino struct symtabs_and_lines sals_end); 1172c50c785cSJohn Marino 11735796c8dcSSimon Schubert extern void breakpoint_re_set (void); 11745796c8dcSSimon Schubert 11755796c8dcSSimon Schubert extern void breakpoint_re_set_thread (struct breakpoint *); 11765796c8dcSSimon Schubert 11775796c8dcSSimon Schubert extern struct breakpoint *set_momentary_breakpoint 11785796c8dcSSimon Schubert (struct gdbarch *, struct symtab_and_line, struct frame_id, enum bptype); 11795796c8dcSSimon Schubert 11805796c8dcSSimon Schubert extern struct breakpoint *set_momentary_breakpoint_at_pc 11815796c8dcSSimon Schubert (struct gdbarch *, CORE_ADDR pc, enum bptype type); 11825796c8dcSSimon Schubert 11835796c8dcSSimon Schubert extern struct breakpoint *clone_momentary_breakpoint (struct breakpoint *bpkt); 11845796c8dcSSimon Schubert 11855796c8dcSSimon Schubert extern void set_ignore_count (int, int, int); 11865796c8dcSSimon Schubert 11875796c8dcSSimon Schubert extern void breakpoint_init_inferior (enum inf_context); 11885796c8dcSSimon Schubert 11895796c8dcSSimon Schubert extern struct cleanup *make_cleanup_delete_breakpoint (struct breakpoint *); 11905796c8dcSSimon Schubert 11915796c8dcSSimon Schubert extern void delete_breakpoint (struct breakpoint *); 11925796c8dcSSimon Schubert 11935796c8dcSSimon Schubert extern void breakpoint_auto_delete (bpstat); 11945796c8dcSSimon Schubert 1195*ef5ccd6cSJohn Marino typedef void (*walk_bp_location_callback) (struct bp_location *, void *); 1196*ef5ccd6cSJohn Marino 1197*ef5ccd6cSJohn Marino extern void iterate_over_bp_locations (walk_bp_location_callback); 1198*ef5ccd6cSJohn Marino 1199cf7f2e2dSJohn Marino /* Return the chain of command lines to execute when this breakpoint 1200cf7f2e2dSJohn Marino is hit. */ 1201cf7f2e2dSJohn Marino extern struct command_line *breakpoint_commands (struct breakpoint *b); 1202cf7f2e2dSJohn Marino 1203c50c785cSJohn Marino /* Return a string image of DISP. The string is static, and thus should 1204c50c785cSJohn Marino NOT be deallocated after use. */ 1205c50c785cSJohn Marino const char *bpdisp_text (enum bpdisp disp); 1206c50c785cSJohn Marino 12075796c8dcSSimon Schubert extern void break_command (char *, int); 12085796c8dcSSimon Schubert 12095796c8dcSSimon Schubert extern void hbreak_command_wrapper (char *, int); 12105796c8dcSSimon Schubert extern void thbreak_command_wrapper (char *, int); 12115796c8dcSSimon Schubert extern void rbreak_command_wrapper (char *, int); 1212c50c785cSJohn Marino extern void watch_command_wrapper (char *, int, int); 1213c50c785cSJohn Marino extern void awatch_command_wrapper (char *, int, int); 1214c50c785cSJohn Marino extern void rwatch_command_wrapper (char *, int, int); 12155796c8dcSSimon Schubert extern void tbreak_command (char *, int); 12165796c8dcSSimon Schubert 1217*ef5ccd6cSJohn Marino extern struct breakpoint_ops base_breakpoint_ops; 1218a45ae5f8SJohn Marino extern struct breakpoint_ops bkpt_breakpoint_ops; 1219*ef5ccd6cSJohn Marino extern struct breakpoint_ops tracepoint_breakpoint_ops; 1220a45ae5f8SJohn Marino 1221a45ae5f8SJohn Marino extern void initialize_breakpoint_ops (void); 1222a45ae5f8SJohn Marino 1223a45ae5f8SJohn Marino /* Arguments to pass as context to some catch command handlers. */ 1224a45ae5f8SJohn Marino #define CATCH_PERMANENT ((void *) (uintptr_t) 0) 1225a45ae5f8SJohn Marino #define CATCH_TEMPORARY ((void *) (uintptr_t) 1) 1226a45ae5f8SJohn Marino 1227a45ae5f8SJohn Marino /* Like add_cmd, but add the command to both the "catch" and "tcatch" 1228a45ae5f8SJohn Marino lists, and pass some additional user data to the command 1229a45ae5f8SJohn Marino function. */ 1230a45ae5f8SJohn Marino 1231a45ae5f8SJohn Marino extern void 1232a45ae5f8SJohn Marino add_catch_command (char *name, char *docstring, 1233a45ae5f8SJohn Marino void (*sfunc) (char *args, int from_tty, 1234a45ae5f8SJohn Marino struct cmd_list_element *command), 1235*ef5ccd6cSJohn Marino completer_ftype *completer, 1236a45ae5f8SJohn Marino void *user_data_catch, 1237a45ae5f8SJohn Marino void *user_data_tcatch); 1238a45ae5f8SJohn Marino 1239a45ae5f8SJohn Marino /* Initialize a breakpoint struct for Ada exception catchpoints. */ 1240a45ae5f8SJohn Marino 1241a45ae5f8SJohn Marino extern void 1242a45ae5f8SJohn Marino init_ada_exception_breakpoint (struct breakpoint *b, 1243a45ae5f8SJohn Marino struct gdbarch *gdbarch, 1244a45ae5f8SJohn Marino struct symtab_and_line sal, 1245a45ae5f8SJohn Marino char *addr_string, 1246a45ae5f8SJohn Marino const struct breakpoint_ops *ops, 1247a45ae5f8SJohn Marino int tempflag, 1248a45ae5f8SJohn Marino int from_tty); 1249a45ae5f8SJohn Marino 1250*ef5ccd6cSJohn Marino extern void init_catchpoint (struct breakpoint *b, 1251*ef5ccd6cSJohn Marino struct gdbarch *gdbarch, int tempflag, 1252*ef5ccd6cSJohn Marino char *cond_string, 1253*ef5ccd6cSJohn Marino const struct breakpoint_ops *ops); 1254*ef5ccd6cSJohn Marino 1255a45ae5f8SJohn Marino /* Add breakpoint B on the breakpoint list, and notify the user, the 1256a45ae5f8SJohn Marino target and breakpoint_created observers of its existence. If 1257a45ae5f8SJohn Marino INTERNAL is non-zero, the breakpoint number will be allocated from 1258a45ae5f8SJohn Marino the internal breakpoint count. If UPDATE_GLL is non-zero, 1259a45ae5f8SJohn Marino update_global_location_list will be called. */ 1260a45ae5f8SJohn Marino 1261a45ae5f8SJohn Marino extern void install_breakpoint (int internal, struct breakpoint *b, 1262a45ae5f8SJohn Marino int update_gll); 1263a45ae5f8SJohn Marino 1264a45ae5f8SJohn Marino /* Flags that can be passed down to create_breakpoint, etc., to affect 1265a45ae5f8SJohn Marino breakpoint creation in several ways. */ 1266a45ae5f8SJohn Marino 1267a45ae5f8SJohn Marino enum breakpoint_create_flags 1268a45ae5f8SJohn Marino { 1269a45ae5f8SJohn Marino /* We're adding a breakpoint to our tables that is already 1270a45ae5f8SJohn Marino inserted in the target. */ 1271a45ae5f8SJohn Marino CREATE_BREAKPOINT_FLAGS_INSERTED = 1 << 0 1272a45ae5f8SJohn Marino }; 1273a45ae5f8SJohn Marino 1274cf7f2e2dSJohn Marino extern int create_breakpoint (struct gdbarch *gdbarch, char *arg, 1275cf7f2e2dSJohn Marino char *cond_string, int thread, 1276*ef5ccd6cSJohn Marino char *extra_string, 1277cf7f2e2dSJohn Marino int parse_condition_and_thread, 1278cf7f2e2dSJohn Marino int tempflag, enum bptype wanted_type, 1279cf7f2e2dSJohn Marino int ignore_count, 1280cf7f2e2dSJohn Marino enum auto_boolean pending_break_support, 1281a45ae5f8SJohn Marino const struct breakpoint_ops *ops, 1282cf7f2e2dSJohn Marino int from_tty, 1283c50c785cSJohn Marino int enabled, 1284a45ae5f8SJohn Marino int internal, unsigned flags); 12855796c8dcSSimon Schubert 12865796c8dcSSimon Schubert extern void insert_breakpoints (void); 12875796c8dcSSimon Schubert 12885796c8dcSSimon Schubert extern int remove_breakpoints (void); 12895796c8dcSSimon Schubert 1290cf7f2e2dSJohn Marino extern int remove_breakpoints_pid (int pid); 1291cf7f2e2dSJohn Marino 12925796c8dcSSimon Schubert /* This function can be used to physically insert eventpoints from the 12935796c8dcSSimon Schubert specified traced inferior process, without modifying the breakpoint 1294c50c785cSJohn Marino package's state. This can be useful for those targets which 1295c50c785cSJohn Marino support following the processes of a fork() or vfork() system call, 1296c50c785cSJohn Marino when both of the resulting two processes are to be followed. */ 12975796c8dcSSimon Schubert extern int reattach_breakpoints (int); 12985796c8dcSSimon Schubert 12995796c8dcSSimon Schubert /* This function can be used to update the breakpoint package's state 13005796c8dcSSimon Schubert after an exec() system call has been executed. 13015796c8dcSSimon Schubert 13025796c8dcSSimon Schubert This function causes the following: 13035796c8dcSSimon Schubert 13045796c8dcSSimon Schubert - All eventpoints are marked "not inserted". 13055796c8dcSSimon Schubert - All eventpoints with a symbolic address are reset such that 13065796c8dcSSimon Schubert the symbolic address must be reevaluated before the eventpoints 13075796c8dcSSimon Schubert can be reinserted. 13085796c8dcSSimon Schubert - The solib breakpoints are explicitly removed from the breakpoint 13095796c8dcSSimon Schubert list. 13105796c8dcSSimon Schubert - A step-resume breakpoint, if any, is explicitly removed from the 13115796c8dcSSimon Schubert breakpoint list. 13125796c8dcSSimon Schubert - All eventpoints without a symbolic address are removed from the 13135796c8dcSSimon Schubert breakpoint list. */ 13145796c8dcSSimon Schubert extern void update_breakpoints_after_exec (void); 13155796c8dcSSimon Schubert 13165796c8dcSSimon Schubert /* This function can be used to physically remove hardware breakpoints 13175796c8dcSSimon Schubert and watchpoints from the specified traced inferior process, without 13185796c8dcSSimon Schubert modifying the breakpoint package's state. This can be useful for 13195796c8dcSSimon Schubert those targets which support following the processes of a fork() or 13205796c8dcSSimon Schubert vfork() system call, when one of the resulting two processes is to 13215796c8dcSSimon Schubert be detached and allowed to run free. 13225796c8dcSSimon Schubert 13235796c8dcSSimon Schubert It is an error to use this function on the process whose id is 13245796c8dcSSimon Schubert inferior_ptid. */ 1325*ef5ccd6cSJohn Marino extern int detach_breakpoints (ptid_t ptid); 13265796c8dcSSimon Schubert 1327cf7f2e2dSJohn Marino /* This function is called when program space PSPACE is about to be 1328cf7f2e2dSJohn Marino deleted. It takes care of updating breakpoints to not reference 1329cf7f2e2dSJohn Marino this PSPACE anymore. */ 1330cf7f2e2dSJohn Marino extern void breakpoint_program_space_exit (struct program_space *pspace); 1331cf7f2e2dSJohn Marino 1332c50c785cSJohn Marino extern void set_longjmp_breakpoint (struct thread_info *tp, 1333c50c785cSJohn Marino struct frame_id frame); 13345796c8dcSSimon Schubert extern void delete_longjmp_breakpoint (int thread); 13355796c8dcSSimon Schubert 1336*ef5ccd6cSJohn Marino /* Mark all longjmp breakpoints from THREAD for later deletion. */ 1337*ef5ccd6cSJohn Marino extern void delete_longjmp_breakpoint_at_next_stop (int thread); 1338*ef5ccd6cSJohn Marino 1339*ef5ccd6cSJohn Marino extern struct breakpoint *set_longjmp_breakpoint_for_call_dummy (void); 1340*ef5ccd6cSJohn Marino extern void check_longjmp_breakpoint_for_call_dummy (int thread); 1341*ef5ccd6cSJohn Marino 13425796c8dcSSimon Schubert extern void enable_overlay_breakpoints (void); 13435796c8dcSSimon Schubert extern void disable_overlay_breakpoints (void); 13445796c8dcSSimon Schubert 1345cf7f2e2dSJohn Marino extern void set_std_terminate_breakpoint (void); 1346cf7f2e2dSJohn Marino extern void delete_std_terminate_breakpoint (void); 1347cf7f2e2dSJohn Marino 13485796c8dcSSimon Schubert /* These functions respectively disable or reenable all currently 13495796c8dcSSimon Schubert enabled watchpoints. When disabled, the watchpoints are marked 1350a45ae5f8SJohn Marino call_disabled. When re-enabled, they are marked enabled. 13515796c8dcSSimon Schubert 13525796c8dcSSimon Schubert The intended client of these functions is call_function_by_hand. 13535796c8dcSSimon Schubert 13545796c8dcSSimon Schubert The inferior must be stopped, and all breakpoints removed, when 13555796c8dcSSimon Schubert these functions are used. 13565796c8dcSSimon Schubert 13575796c8dcSSimon Schubert The need for these functions is that on some targets (e.g., HP-UX), 13585796c8dcSSimon Schubert gdb is unable to unwind through the dummy frame that is pushed as 13595796c8dcSSimon Schubert part of the implementation of a call command. Watchpoints can 13605796c8dcSSimon Schubert cause the inferior to stop in places where this frame is visible, 13615796c8dcSSimon Schubert and that can cause execution control to become very confused. 13625796c8dcSSimon Schubert 13635796c8dcSSimon Schubert Note that if a user sets breakpoints in an interactively called 1364a45ae5f8SJohn Marino function, the call_disabled watchpoints will have been re-enabled 13655796c8dcSSimon Schubert when the first such breakpoint is reached. However, on targets 13665796c8dcSSimon Schubert that are unable to unwind through the call dummy frame, watches 13675796c8dcSSimon Schubert of stack-based storage may then be deleted, because gdb will 13685796c8dcSSimon Schubert believe that their watched storage is out of scope. (Sigh.) */ 13695796c8dcSSimon Schubert extern void disable_watchpoints_before_interactive_call_start (void); 13705796c8dcSSimon Schubert 13715796c8dcSSimon Schubert extern void enable_watchpoints_after_interactive_call_stop (void); 13725796c8dcSSimon Schubert 13735796c8dcSSimon Schubert /* These functions disable and re-enable all breakpoints during 13745796c8dcSSimon Schubert inferior startup. They are intended to be called from solib 13755796c8dcSSimon Schubert code where necessary. This is needed on platforms where the 13765796c8dcSSimon Schubert main executable is relocated at some point during startup 13775796c8dcSSimon Schubert processing, making breakpoint addresses invalid. 13785796c8dcSSimon Schubert 13795796c8dcSSimon Schubert If additional breakpoints are created after the routine 13805796c8dcSSimon Schubert disable_breakpoints_before_startup but before the routine 13815796c8dcSSimon Schubert enable_breakpoints_after_startup was called, they will also 13825796c8dcSSimon Schubert be marked as disabled. */ 13835796c8dcSSimon Schubert extern void disable_breakpoints_before_startup (void); 13845796c8dcSSimon Schubert extern void enable_breakpoints_after_startup (void); 13855796c8dcSSimon Schubert 13865796c8dcSSimon Schubert /* For script interpreters that need to define breakpoint commands 1387c50c785cSJohn Marino after they've already read the commands into a struct 1388c50c785cSJohn Marino command_line. */ 13895796c8dcSSimon Schubert extern enum command_control_type commands_from_control_command 13905796c8dcSSimon Schubert (char *arg, struct command_line *cmd); 13915796c8dcSSimon Schubert 13925796c8dcSSimon Schubert extern void clear_breakpoint_hit_counts (void); 13935796c8dcSSimon Schubert 13945796c8dcSSimon Schubert extern struct breakpoint *get_breakpoint (int num); 13955796c8dcSSimon Schubert 1396c50c785cSJohn Marino /* The following are for displays, which aren't really breakpoints, 1397c50c785cSJohn Marino but here is as good a place as any for them. */ 13985796c8dcSSimon Schubert 13995796c8dcSSimon Schubert extern void disable_current_display (void); 14005796c8dcSSimon Schubert 14015796c8dcSSimon Schubert extern void do_displays (void); 14025796c8dcSSimon Schubert 14035796c8dcSSimon Schubert extern void disable_display (int); 14045796c8dcSSimon Schubert 14055796c8dcSSimon Schubert extern void clear_displays (void); 14065796c8dcSSimon Schubert 14075796c8dcSSimon Schubert extern void disable_breakpoint (struct breakpoint *); 14085796c8dcSSimon Schubert 14095796c8dcSSimon Schubert extern void enable_breakpoint (struct breakpoint *); 14105796c8dcSSimon Schubert 14115796c8dcSSimon Schubert extern void breakpoint_set_commands (struct breakpoint *b, 14125796c8dcSSimon Schubert struct command_line *commands); 14135796c8dcSSimon Schubert 1414c50c785cSJohn Marino extern void breakpoint_set_silent (struct breakpoint *b, int silent); 1415c50c785cSJohn Marino 1416c50c785cSJohn Marino extern void breakpoint_set_thread (struct breakpoint *b, int thread); 1417c50c785cSJohn Marino 1418c50c785cSJohn Marino extern void breakpoint_set_task (struct breakpoint *b, int task); 1419c50c785cSJohn Marino 14205796c8dcSSimon Schubert /* Clear the "inserted" flag in all breakpoints. */ 14215796c8dcSSimon Schubert extern void mark_breakpoints_out (void); 14225796c8dcSSimon Schubert 14235796c8dcSSimon Schubert extern void make_breakpoint_permanent (struct breakpoint *); 14245796c8dcSSimon Schubert 14255796c8dcSSimon Schubert extern struct breakpoint *create_jit_event_breakpoint (struct gdbarch *, 14265796c8dcSSimon Schubert CORE_ADDR); 14275796c8dcSSimon Schubert 14285796c8dcSSimon Schubert extern struct breakpoint *create_solib_event_breakpoint (struct gdbarch *, 14295796c8dcSSimon Schubert CORE_ADDR); 14305796c8dcSSimon Schubert 14315796c8dcSSimon Schubert extern struct breakpoint *create_thread_event_breakpoint (struct gdbarch *, 14325796c8dcSSimon Schubert CORE_ADDR); 14335796c8dcSSimon Schubert 1434c50c785cSJohn Marino extern void remove_jit_event_breakpoints (void); 1435c50c785cSJohn Marino 14365796c8dcSSimon Schubert extern void remove_solib_event_breakpoints (void); 14375796c8dcSSimon Schubert 14385796c8dcSSimon Schubert extern void remove_thread_event_breakpoints (void); 14395796c8dcSSimon Schubert 14405796c8dcSSimon Schubert extern void disable_breakpoints_in_shlibs (void); 14415796c8dcSSimon Schubert 14425796c8dcSSimon Schubert /* This function returns TRUE if ep is a catchpoint. */ 1443*ef5ccd6cSJohn Marino extern int is_catchpoint (struct breakpoint *); 1444*ef5ccd6cSJohn Marino 1445*ef5ccd6cSJohn Marino /* Shared helper function (MI and CLI) for creating and installing 1446*ef5ccd6cSJohn Marino a shared object event catchpoint. */ 1447*ef5ccd6cSJohn Marino extern void add_solib_catchpoint (char *arg, int is_load, int is_temp, 1448*ef5ccd6cSJohn Marino int enabled); 14495796c8dcSSimon Schubert 14505796c8dcSSimon Schubert /* Enable breakpoints and delete when hit. Called with ARG == NULL 14515796c8dcSSimon Schubert deletes all breakpoints. */ 14525796c8dcSSimon Schubert extern void delete_command (char *arg, int from_tty); 14535796c8dcSSimon Schubert 1454c50c785cSJohn Marino /* Manage a software single step breakpoint (or two). Insert may be 1455c50c785cSJohn Marino called twice before remove is called. */ 1456cf7f2e2dSJohn Marino extern void insert_single_step_breakpoint (struct gdbarch *, 1457c50c785cSJohn Marino struct address_space *, 1458c50c785cSJohn Marino CORE_ADDR); 1459c50c785cSJohn Marino extern int single_step_breakpoints_inserted (void); 14605796c8dcSSimon Schubert extern void remove_single_step_breakpoints (void); 1461cf7f2e2dSJohn Marino extern void cancel_single_step_breakpoints (void); 14625796c8dcSSimon Schubert 14635796c8dcSSimon Schubert /* Manage manual breakpoints, separate from the normal chain of 14645796c8dcSSimon Schubert breakpoints. These functions are used in murky target-specific 14655796c8dcSSimon Schubert ways. Please do not add more uses! */ 1466cf7f2e2dSJohn Marino extern void *deprecated_insert_raw_breakpoint (struct gdbarch *, 1467c50c785cSJohn Marino struct address_space *, 1468c50c785cSJohn Marino CORE_ADDR); 14695796c8dcSSimon Schubert extern int deprecated_remove_raw_breakpoint (struct gdbarch *, void *); 14705796c8dcSSimon Schubert 14715796c8dcSSimon Schubert /* Check if any hardware watchpoints have triggered, according to the 14725796c8dcSSimon Schubert target. */ 14735796c8dcSSimon Schubert int watchpoints_triggered (struct target_waitstatus *); 14745796c8dcSSimon Schubert 1475a45ae5f8SJohn Marino /* Helper for transparent breakpoint hiding for memory read and write 1476a45ae5f8SJohn Marino routines. 1477a45ae5f8SJohn Marino 1478a45ae5f8SJohn Marino Update one of READBUF or WRITEBUF with either the shadows 1479a45ae5f8SJohn Marino (READBUF), or the breakpoint instructions (WRITEBUF) of inserted 1480a45ae5f8SJohn Marino breakpoints at the memory range defined by MEMADDR and extending 1481a45ae5f8SJohn Marino for LEN bytes. If writing, then WRITEBUF is a copy of WRITEBUF_ORG 1482a45ae5f8SJohn Marino on entry.*/ 1483a45ae5f8SJohn Marino extern void breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf, 1484a45ae5f8SJohn Marino const gdb_byte *writebuf_org, 1485a45ae5f8SJohn Marino ULONGEST memaddr, LONGEST len); 14865796c8dcSSimon Schubert 14875796c8dcSSimon Schubert extern int breakpoints_always_inserted_mode (void); 14885796c8dcSSimon Schubert 14895796c8dcSSimon Schubert /* Called each time new event from target is processed. 14905796c8dcSSimon Schubert Retires previously deleted breakpoint locations that 14915796c8dcSSimon Schubert in our opinion won't ever trigger. */ 14925796c8dcSSimon Schubert extern void breakpoint_retire_moribund (void); 14935796c8dcSSimon Schubert 1494cf7f2e2dSJohn Marino /* Set break condition of breakpoint B to EXP. */ 1495cf7f2e2dSJohn Marino extern void set_breakpoint_condition (struct breakpoint *b, char *exp, 1496cf7f2e2dSJohn Marino int from_tty); 1497cf7f2e2dSJohn Marino 14985796c8dcSSimon Schubert /* Checks if we are catching syscalls or not. 14995796c8dcSSimon Schubert Returns 0 if not, greater than 0 if we are. */ 15005796c8dcSSimon Schubert extern int catch_syscall_enabled (void); 15015796c8dcSSimon Schubert 15025796c8dcSSimon Schubert /* Checks if we are catching syscalls with the specific 15035796c8dcSSimon Schubert syscall_number. Used for "filtering" the catchpoints. 15045796c8dcSSimon Schubert Returns 0 if not, greater than 0 if we are. */ 15055796c8dcSSimon Schubert extern int catching_syscall_number (int syscall_number); 15065796c8dcSSimon Schubert 15075796c8dcSSimon Schubert /* Return a tracepoint with the given number if found. */ 1508a45ae5f8SJohn Marino extern struct tracepoint *get_tracepoint (int num); 15095796c8dcSSimon Schubert 1510a45ae5f8SJohn Marino extern struct tracepoint *get_tracepoint_by_number_on_target (int num); 1511cf7f2e2dSJohn Marino 15125796c8dcSSimon Schubert /* Find a tracepoint by parsing a number in the supplied string. */ 1513a45ae5f8SJohn Marino extern struct tracepoint * 1514c50c785cSJohn Marino get_tracepoint_by_number (char **arg, 1515c50c785cSJohn Marino struct get_number_or_range_state *state, 15165796c8dcSSimon Schubert int optional_p); 15175796c8dcSSimon Schubert 15185796c8dcSSimon Schubert /* Return a vector of all tracepoints currently defined. The vector 15195796c8dcSSimon Schubert is newly allocated; the caller should free when done with it. */ 15205796c8dcSSimon Schubert extern VEC(breakpoint_p) *all_tracepoints (void); 15215796c8dcSSimon Schubert 1522cf7f2e2dSJohn Marino extern int is_tracepoint (const struct breakpoint *b); 1523cf7f2e2dSJohn Marino 1524cf7f2e2dSJohn Marino /* Return a vector of all static tracepoints defined at ADDR. The 1525cf7f2e2dSJohn Marino vector is newly allocated; the caller should free when done with 1526cf7f2e2dSJohn Marino it. */ 1527cf7f2e2dSJohn Marino extern VEC(breakpoint_p) *static_tracepoints_here (CORE_ADDR addr); 1528cf7f2e2dSJohn Marino 1529cf7f2e2dSJohn Marino /* Function that can be passed to read_command_line to validate 1530cf7f2e2dSJohn Marino that each command is suitable for tracepoint command list. */ 1531cf7f2e2dSJohn Marino extern void check_tracepoint_command (char *line, void *closure); 1532cf7f2e2dSJohn Marino 1533cf7f2e2dSJohn Marino /* Call at the start and end of an "rbreak" command to register 1534cf7f2e2dSJohn Marino breakpoint numbers for a later "commands" command. */ 1535cf7f2e2dSJohn Marino extern void start_rbreak_breakpoints (void); 1536cf7f2e2dSJohn Marino extern void end_rbreak_breakpoints (void); 1537cf7f2e2dSJohn Marino 1538c50c785cSJohn Marino /* Breakpoint iterator function. 1539c50c785cSJohn Marino 1540c50c785cSJohn Marino Calls a callback function once for each breakpoint, so long as the 1541c50c785cSJohn Marino callback function returns false. If the callback function returns 1542c50c785cSJohn Marino true, the iteration will end and the current breakpoint will be 1543c50c785cSJohn Marino returned. This can be useful for implementing a search for a 1544c50c785cSJohn Marino breakpoint with arbitrary attributes, or for applying an operation 1545c50c785cSJohn Marino to every breakpoint. */ 1546c50c785cSJohn Marino extern struct breakpoint *iterate_over_breakpoints (int (*) (struct breakpoint *, 1547c50c785cSJohn Marino void *), void *); 1548c50c785cSJohn Marino 1549a45ae5f8SJohn Marino /* Nonzero if the specified PC cannot be a location where functions 1550a45ae5f8SJohn Marino have been inlined. */ 1551a45ae5f8SJohn Marino 1552a45ae5f8SJohn Marino extern int pc_at_non_inline_function (struct address_space *aspace, 1553*ef5ccd6cSJohn Marino CORE_ADDR pc, 1554*ef5ccd6cSJohn Marino const struct target_waitstatus *ws); 1555a45ae5f8SJohn Marino 1556c50c785cSJohn Marino extern int user_breakpoint_p (struct breakpoint *); 1557c50c785cSJohn Marino 1558a45ae5f8SJohn Marino /* Attempt to determine architecture of location identified by SAL. */ 1559a45ae5f8SJohn Marino extern struct gdbarch *get_sal_arch (struct symtab_and_line sal); 1560a45ae5f8SJohn Marino 1561*ef5ccd6cSJohn Marino extern void handle_solib_event (void); 1562*ef5ccd6cSJohn Marino 1563*ef5ccd6cSJohn Marino extern void breakpoint_free_objfile (struct objfile *objfile); 1564*ef5ccd6cSJohn Marino 15655796c8dcSSimon Schubert #endif /* !defined (BREAKPOINT_H) */ 1566