aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
AgeCommit message (Collapse)AuthorFilesLines
2022-05-20ranged_breakpoint: move initialization to ctorPedro Alves1-8/+19
Move initialization of ranged_breakpoint's fields to its ctor. Change-Id: If7b842861f3cc6a429ea329d45598b5852283ba3
2022-05-20ranged_breakpoint: use install_breakpointPedro Alves1-12/+5
This commit replaces a chunk of code in break_range_command by an equivalent call to install_breakpoint. Change-Id: I31c06cabd36f5be91740aab029265f678aa78e35
2022-05-20ranged_breakpoint: don't use init_raw_breakpointPedro Alves1-1/+1
ranged_breakpoint's ctor already sets the breakpoint's type to bp_hardware_breakpoint. Since this is a "regular" breakpoint, b->pspace should remain NULL. Thus, the only thing init_raw_breakpoint is needed for, is to add the breakpoint's location. Do that directly. Change-Id: I1505de94c3919881c2b300437e2c0da9b05f76bd
2022-05-20Make structs breakpoint/base_breakpoint/catchpoint be abstractPedro Alves1-0/+15
You should never instanciate these types directly. Change-Id: I8086c74c415eadbd44924bb0ef20f34b5b97ee6f
2022-05-20add_location_to_breakpoint -> breakpoint::add_locationPedro Alves1-37/+33
Make add_location_to_breakpoint be a method of struct breakpoint. A patch later in the series will move this to base_breakpoint, but for now, it needs to be here. Change-Id: I5bdc2ec1a7c2d66f26f51bf6f6adc8384a90b129
2022-05-06Introduce catchpoint classTom Tromey1-12/+7
This introduces a catchpoint class that is used as the base class for all catchpoints. init_catchpoint is rewritten to be a constructor instead. This changes the hierarchy a little -- some catchpoints now inherit from base_breakpoint whereas previously they did not. This isn't a problem, as long as re_set is redefined in catchpoint.
2022-05-06Remove init_raw_breakpoint_without_locationTom Tromey1-47/+48
This removes init_raw_breakpoint_without_location, replacing it with a constructor on 'breakpoint' itself. The subclasses and callers are all updated.
2022-05-06Constify breakpoint::print_recreateTom Tromey1-11/+11
This constifies breakpoint::print_recreate.
2022-05-06Constify breakpoint::print_mentionTom Tromey1-16/+16
This constifies breakpoint::print_mention.
2022-05-06Constify breakpoint::print_oneTom Tromey1-5/+5
This constifies breakpoint::print_one.
2022-05-06Constify breakpoint::print_itTom Tromey1-12/+12
This constifies breakpoint::print_it. Doing this pointed out some code in ada-lang.c that can be simplified a little as well.
2022-05-06Move works_in_software_mode to watchpointTom Tromey1-11/+5
works_in_software_mode is only useful for watchpoints. This patch moves it from breakpoint to watchpoint, and changes it to return bool.
2022-05-06Boolify breakpoint::explains_signalTom Tromey1-3/+3
This changes breakpoint::explains_signal to return bool.
2022-05-06Remove breakpoint::opsTom Tromey1-66/+33
The breakpoint::ops field is set but never used. This removes it.
2022-05-06Change print_recreate_thread to a methodTom Tromey1-11/+11
This changes print_recreate_thread to be a method on breakpoint. This function is only used as a helper by print_recreate methods, so I thought this transformation made sense.
2022-05-02gdb: remove type_wanted parameter from a few functionsSimon Marchi1-16/+10
The type_wanted value, passed down to the create_sals_from_location callback, is never used. Remove it. Change-Id: Ic363ee13f6af593a3e875ff7fe46de130cdc190c
2022-04-29Remove create_breakpoints_sal_defaultTom Tromey1-37/+12
create_breakpoints_sal_default is just a simple wrapper, so remove it.
2022-04-29Remove allocate_bp_locationTom Tromey1-15/+5
allocate_bp_location is just a small wrapper for a method call, so inline it everywhere.
2022-04-29Constify breakpoint_opsTom Tromey1-4/+4
Now that all breakpoint_ops are statically initialized, they can all be made const.
2022-04-29Remove breakpoint ops initializationTom Tromey1-39/+31
initialize_breakpoint_ops does not do much any more, so remove it in favor of statically-initialize objects.
2022-04-29Remove vtable_breakpoint_opsTom Tromey1-61/+30
There's no need to have vtable_breakpoint_ops any more, so remove it in favor of base_breakpoint_ops.
2022-04-29Remove most fields from breakpoint_opsTom Tromey1-210/+29
At this point, all implementations of breakpoints use the vtable. So, we can now remove most function pointers from breakpoint_ops and switch to using methods directly in the callers. Only the two "static virtual" methods remain in breakpoint_ops.
2022-04-29Remove breakpoint_ops from init_catchpointTom Tromey1-3/+3
init_catchpoint is only ever passed a single breakpoint_ops pointer, so remove the parameter.
2022-04-29Remove breakpoint_ops from init_ada_exception_breakpointTom Tromey1-2/+2
init_ada_exception_breakpoint is only ever passed a single breakpoint_ops structure, so remove the parameter.
2022-04-29Merge probe and ordinary tracepointsTom Tromey1-10/+3
Right now, probe tracepoints are handled by a separate ops object. However, they differ only in a small way from ordinary tracepoints, and furthermore can be distinguished by their event location. This patch merges the two cases, just as was done for breakpoints.
2022-04-29Merge probe and ordinary breakpointsTom Tromey1-32/+26
Right now, probe breakpoints are handled by a separate ops object. However, they differ only in a small way from ordinary breakpoints, and furthermore can be distinguished by their "probe" object. This patch merges the two cases. This avoids having to introduce a new bp_ constant (which can be quite subtle to do correctly) and a new subclass.
2022-04-29Remove bkpt_base_breakpoint_opsTom Tromey1-11/+0
An earlier patch removed the last use of bkpt_base_breakpoint_ops, so remove the object entirely.
2022-04-29Convert static marker tracepoints to vtable opsTom Tromey1-10/+18
This converts static marker tracepoints to use vtable_breakpoint_ops.
2022-04-29Add bp_static_marker_tracepointTom Tromey1-9/+23
Because the actual construction of a breakpoint is buried deep in create_breakpoint, at present it's necessary to have a new bp_ enumerator constant any time a new subclass is needed. Static marker tracepoints are one such case, so this patch introduces bp_static_marker_tracepoint and updates various spots to recognize it.
2022-04-29Convert ranged breakpoints to vtable opsTom Tromey1-66/+60
This converts ranged breakpoints to use vtable_breakpoint_ops. This requires introducing a new ranged_breakpoint type, but this is relatively simple because ranged breakpoints can only be created by break_range_command.
2022-04-29Convert dprintf to vtable opsTom Tromey1-34/+29
This converts dprintf to use vtable_breakpoint_ops.
2022-04-29Convert ordinary breakpoints to vtable opsTom Tromey1-54/+41
This converts "ordinary" breakpoint to use vtable_breakpoint_ops. Recall that an ordinary breakpoint is both the kind normally created by users, and also a base class used by other classes.
2022-04-29Change inheritance of dprintfTom Tromey1-5/+2
The dprintf breakpoint ops is mostly a copy of bpkt_breakpoint_ops, except it's written out explicitly -- and, importantly, there's nothing that bpkt_breakpoint_ops overrides that dprintf does not. This changes dprintf to simply inherit directly, and updates struct dprintf_breakpoint to reflect the change as well.
2022-04-29Convert momentary breakpoints to vtable opsTom Tromey1-26/+19
This converts momentary breakpoints to use vtable_breakpoint_ops.
2022-04-29Convert internal breakpoints to vtable opsTom Tromey1-36/+25
This converts internal breakpoints to use vtable_breakpoint_ops.
2022-04-29Convert base breakpoints to vtable opsTom Tromey1-31/+24
This converts base breakpoints to use vtable_breakpoint_ops.
2022-04-29Add some new subclasses of breakpointTom Tromey1-13/+70
This adds a few new subclasses of breakpoint. The inheritance hierarchy is chosen to reflect what's already present in initialize_breakpoint_ops -- it mirrors the way that the _ops structures are filled in. This patch also changes new_breakpoint_from_type to create the correct sublcass based on bptype. This is important due to the somewhat inverted way in which create_breakpoint works; and in particular later patches will change some of these entries.
2022-04-29Convert tracepoints to vtable opsTom Tromey1-61/+41
This converts tracepoints to use vtable_breakpoint_ops.
2022-04-29Convert watchpoints to vtable opsTom Tromey1-164/+116
This converts watchpoints and masked watchpoints. to use vtable_breakpoint_ops. For masked watchpoints, a new subclass must be introduced, and watch_command_1 is changed to create one.
2022-04-29Add a vtable-based breakpoint opsTom Tromey1-0/+110
This adds methods to struct breakpoint. Each method has a similar signature to a corresponding function in breakpoint_ops, with the exceptions of create_sals_from_location and create_breakpoints_sal, which can't be virtual methods on breakpoint -- they are only used during the construction of breakpoints. Then, this adds a new vtable_breakpoint_ops structure and populates it with functions that simply forward a call from breakpoint_ops to the corresponding virtual method. These are all done with lambdas, because they are just a stepping stone -- by the end of the series, this structure will be deleted.
2022-04-29Return bool from breakpoint_ops::print_oneTom Tromey1-10/+21
This changes breakpoint_ops::print_one to return bool, and updates all the implementations and the caller. The caller is changed so that a NULL check is no longer needed -- something that will be impossible with a real method.
2022-04-29Delete some unnecessary wrapper functionsTom Tromey1-64/+4
This patch deletes a few unnecessary wrapper functions from breakpoint.c.
2022-04-29Add an assertion to clone_momentary_breakpointTom Tromey1-0/+1
This adds an assertion to clone_momentary_breakpoint. This will eventually be removed, but in the meantime is is useful for helping convince oneself that momentary breakpoints will always use momentary_breakpoint_ops. This understanding will help when cleaning up the code later.
2022-04-29Boolify print_solib_eventTom Tromey1-3/+3
Change print_solib_event to accept a bool parameter and update the callers.
2022-04-29Move "catch load" to a new fileTom Tromey1-258/+2
The "catch load" code is reasonably self-contained, and so this patch moves it out of breakpoint.c and into a new file, break-catch-load.c. One function from breakpoint.c, print_solib_event, now has to be exposed, but this seems pretty reasonable.
2022-04-18gdb: fix using clear command to delete non-user breakpoints(PR cli/7161)Enze Li1-1/+2
The clear command shouldn't delete momentary and internal breakpoints, nor internal breakpoints created via Python's gdb.Breakpoint. This patch fixes this issue and adds a testcase. Regression tested on x86_64 openSUSE Tumbleweed(VERSION_ID="20220413"). Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7161
2022-04-11gdb: remove MSYMBOL_TYPE macroSimon Marchi1-4/+4
Add a getter and a setter for a minimal symbol's type. Remove the corresponding macro and adjust all callers. Change-Id: I89900df5ffa5687133fe1a16b2e0d4684e67a77d
2022-04-11gdb: remove symbol value macrosSimon Marchi1-6/+5
Remove all macros related to getting and setting some symbol value: #define SYMBOL_VALUE(symbol) (symbol)->value.ivalue #define SYMBOL_VALUE_ADDRESS(symbol) \ #define SET_SYMBOL_VALUE_ADDRESS(symbol, new_value) \ #define SYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes #define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->value.common_block #define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block #define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain #define MSYMBOL_VALUE(symbol) (symbol)->value.ivalue #define MSYMBOL_VALUE_RAW_ADDRESS(symbol) ((symbol)->value.address + 0) #define MSYMBOL_VALUE_ADDRESS(objfile, symbol) \ #define BMSYMBOL_VALUE_ADDRESS(symbol) \ #define SET_MSYMBOL_VALUE_ADDRESS(symbol, new_value) \ #define MSYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes #define MSYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block Replace them with equivalent methods on the appropriate objects. Change-Id: Iafdab3b8eefc6dc2fd895aa955bf64fafc59ed50
2022-04-07gdb: remove symtab::objfileSimon Marchi1-4/+5
Same idea as previous patch, but for symtab::objfile. I find it clearer without this wrapper, as it shows that the objfile is common to all symtabs of a given compunit. Otherwise, you could think that each symtab (of a given compunit) can have a specific objfile. Change-Id: Ifc0dbc7ec31a06eefa2787c921196949d5a6fcc6
2022-03-31Remove dbx modeTom Tromey1-99/+0
This patch removes gdb's dbx mode. Regression tested on x86-64 Fedora 34.