* breakpoint.h (bpstat_do_actions): Remove bpstat* argument.
* breakpoint.c (bpstat_do_actions): Rename to ...
(bpstat_do_actions_1): ... this. Make static. Change return type
to int. Return true if a breakpoint proceeded.
(bpstat_do_actions): New, as wrapper around bpstat_do_actions_1.
(delete_breakpoint): Don't reference the global stop_bpstat; it's
gone.
* gdbthread.h (struct thread_info): Add stop_bpstat.
(save_infrun_state, load_infrun_state): Remove stop_bpstat
argument.
* thread.c (load_infrun_state, save_infrun_state): Remove
stop_bpstat argument, and the code referencing it.
* infcall.c: Include "gdbthread.h".
(call_function_by_hand): Adjust.
* exceptions.c: Include "gdbthread.h".
(throw_exception): Adjust.
* infcmd.c (stop_bpstat): Delete.
(continue_command): In all-stop, set the ignore count on the
thread that reported the stop. In non-stop, set it on the current
thread.
(finish_command_continuation): Adjust.
(program_info): Adjust.
* infrun.c (clear_proceed_status): Adjust.
(context_switch): Don't context-switch stop_bpstat.
(handle_inferior_event): Adjust.
(normal_stop): Adjust.
(save_inferior_status, restore_inferior_status): Adjust.
* inf-loop.c (inferior_event_handler): Remove parameter to
bpstat_do_actions call.
* top.c (command_loop): Remove parameter to bpstat_do_actions
call. Call it unconditionally.
* event-top.c (command_handler): Ditto.
* python/python.c (execute_gdb_command): Ditto.
non-permanent breakpoints.
(bpstat_stop_status): Change enable_state to bp_disabled only for
non-permanent breakpoints.
(bp_loc_is_permanent): New function.
(create_breakpoint): Check if the location points to a permanent
breakpoint and if it does, make breakpoint permanent.
(update_breakpoint_locations): Make sure new locations of permanent
breakpoints are properly initialized.
* i386-tdep.c (i386_skip_permanent_breakpoint): New function.
(i386_gdbarch_init): Set gdbarch_skip_permanent_breakpoint.
* gdb.arch/i386-bp_permanent.exp: New test.
(create_overlay_event_breakpoint_1): ... this. Add OBJFILE parameter.
(create_overlay_event_breakpoint): Loop over all objfiles to install
multiple instances of the overlay event breakpoint if present.
* breakpoint.c (always_inserted_auto, always_inserted_on)
(always_inserted_off, always_inserted_enums): New.
(always_inserted_mode): Change type to char* and point to
always_inserted_auto.
(show_always_inserted_mode): In auto mode, also show the current
effect of the option.
(breakpoints_always_inserted_mode): Adjust for the new auto mode.
(_initialize_breakpoint): Make the "set breakpoints
always-inserted" command an enum command. Extend help to describe
the auto mode.
gdb/doc/
* gdb.texinfo (breakpoint always-inserted) Describe the auto mode
setting, and make it the default.
(Non-Stop Mode): Remove "set breakpoints always-inserted 1" from
non-stop script example.
Rewrite continuations internals on top of cleanups and plug
continuation arguments leaks.
* defs.h (struct continuation): Make it opaque.
(add_continuation, add_intermediate_continuation): Drop the int
argument of the continuation hook argument. Add
continuation_free_args argument.
(do_all_continuations, do_all_intermediate_continuations): Drop
the error_p argument.
* utils.c (add_continuation): Drop the int argument of the
continuation hook argument. Add continuation_free_args argument.
Reimplement on top of cleanups.
(do_all_continuations): Drop error argument. Reimplement on top
of cleanups.
(discard_all_continuations): Reimplement on top of cleanups.
(add_intermediate_continuation): Drop the int argument of the
continuation hook argument. Add continuation_free_args argument.
Reimplement on top of cleanups.
(do_all_intermediate_continuations): Drop error argument.
Reimplement on top of cleanups.
(discard_all_intermediate_continuations): Reimplement on top of
cleanups.
* breakpoint.c (until_break_command_continuation): Drop error
argument. Add xfree as continuation argument deleter.
* inf-loop.c (inferior_event_handler): On error, discard all
continuations. Adjust to new do_all_intermediate_continuations
and do_all_continuations interfaces.
* infcmd.c (step_1_continuation): Drop error_p argument. Adjust.
Pass xfree as continuation argument deleter.
(finish_command_continuation): Drop error_p argument. Adjust.
(finish_command_continuation_free_arg): New.
(finish_command): Pass finish_command_continuation_free_arg as
continuation argument deleter. Adjust to new do_all_continuations
interfaces.
(attach_command_continuation): Drop error_p argument.
(attach_command_continuation_free_args): New.
(attach_command): Pass attach_command_continuation_free_args as
continuation argument deleter.
* interps.c (interp_set): Adjust to new do_all_continuations
interfaces.
* event-top.c (stdin_event_handler): In error, also discard the
intermediate continuations.
* top.c (execute_command): Remove unused arg1 and arg2 locals.
* breakpoint.c (struct until_break_command_continuation_args):
New.
(until_break_command_continuation): Take a void* instead of a
continuations_arg. Adjust.
(until_break_command): Adjust to use struct
until_break_command_continuation_args instead of struct
continuation_arg.
* infcmd.c (struct step_1_continuation_args): New.
(step_1_continuation): Take a void* instead of a
continuations_arg. Adjust to use struct step_1_continuation_args.
(step_once): Adjust to use struct step_1_continuation_args.
(struct finish_command_continuation_args): New.
(finish_command_continuation): Take a void* instead of a
continuations_arg. Adjust to use struct
finish_command_continuation_args.
(finish_command): Adjust to use struct
finish_command_continuation_args.
(struct attach_command_continuation_args): New.
(attach_command_continuation): Take a void* instead of a
continuations_arg. Adjust to use struct
attach_command_continuation_args.
(attach_command): Adjust to use struct
attach_command_continuation_args.
* defs.h (struct continuation_arg): Delete.
(struct continuation): Replace the struct continuation_arg*
parameter of continuation_hook by a void*. Replace "arg_list"
member by a new "args" member with void* type.
(add_continuation, add_intermediate_continuation): Replace struct
continuation_arg type usages by void* usages.
* utils.c (add_continuation, do_all_continuations)
(add_intermediate_continuation)
(do_all_intermediate_continuations): Replace struct
continuation_arg type usages by void* usages. Pass "args" instead
of "arg_list".
* gdbthread.h: Remove unneeded forward declarations.
Include "inferior.h".
(struct thread_info): Add continuations,
intermediate_continuations, proceed_to_finish, step_over_calls,
stop_step, step_multi and stop_signal members.
(save_infrun_state): Add continuations,
intermediate_continuations, proceed_to_finish, step_over_calls,
stop_step, step_multi, stop_signal and stop_bpstat parameters.
(load_infrun_state): Add continuations,
intermediate_continuations, proceed_to_finish, step_over_calls,
stop_step, step_multi, stop_signal and stop_bpstat parameters.
* thread.c (load_infrun_state): In non-stop mode, load
continuations, intermediate_continuations, proceed_to_finish,
step_over_calls, stop_step, step_multi and stop_signal.
(save_infrun_state): Store continuations,
intermediate_continuations, proceed_to_finish, step_over_calls,
stop_step, step_multi, stop_signal and stop_bpstat.
(save_infrun_state): Store continuations,
intermediate_continuations, proceed_to_finish, step_over_calls,
stop_step, step_multi, stop_signal and stop_bpstat.
(free_thread): Clear The thread's stop_bpstat.
* inferior.h (context_switch_to): Declare.
* infrun.c (ecss): New global.
(context_switch): Context switch continuations,
intermediate_continuations, proceed_to_finish, step_over_calls,
stop_step, step_multi, stop_signal and stop_bpstat.
(wait_for_inferior): Use global ecss.
(async_ecss, async_ecs): Delete.
(fetch_inferior_event): Use global ecss.
(context_switch_to): New.
* top.c (execute_command): In non-stop, only check if the current
thread is running, in all-stop, check if there's any thread
running.
* breakpoint.c (bpstat_remove_breakpoint): New.
(bpstat_remove_breakpoint_callback): New.
(delete_breakpoint): Clear the stop_bpstats of all threads.
* mi/mi-main.c (mi_cmd_execute): In non-stop, only check if the
current thread is running, in all-stop, check if there's any
thread running.
* Makefile.in (gdbthread_h): Depend on $(inferior_h).
* target.h (struct target_waitstatus): Store related_pid as a ptid.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd):
Take a ptid_t.
* breakpoint.h (struct breakpoint): Change forked_inferior_pid
type to ptid.
* breakpoint.c (print_it_typical, bpstat_check_location)
(print_one_breakpoint_location, set_raw_breakpoint_without_location)
(create_fork_vfork_event_catchpoint): Adjust.
* infrun.c (fork_event): Change parent_pid and child_pid types to
ptid.
(follow_exec, inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): Take a ptid_t and don't trim it.
* linux-thread-db.c (thread_db_wait): Don't trim the returned ptid.
* linux-nat.c (linux_child_follow_fork): Adjust.
* inf-ptrace.c (inf_ptrace_wait): Adjust.
* inf-ttrace.c (inf_ttrace_wait): Adjust.
* win32-nat.c (get_win32_debug_event): Don't set related_pid.
* inferior.h (target_executing): Delete.
* gdbthread.h (struct thread_info): Add executing_ field.
(set_executing, is_executing): New.
* thread.c (main_thread_executing): New.
(init_thread_list): Clear it and also main_thread_running.
(is_running): Return false if target has no execution.
(any_running, is_executing, set_executing): New.
* top.c: Include "gdbthread.h".
(target_executing): Delete.
(execute_command): Replace target_executing check by any_running.
* event-top.c: Include "gdbthread.h".
(display_gdb_prompt, command_handler): Replace target_executing by
is_running.
* inf-loop.c: Include "gdbthread.h". Don't mark as not executing
here. Replace target_executing by is_running.
* infrun.c (handle_inferior_event): Mark all threads as
not-executing.
* linux-nat.c (linux_nat_resume): Don't mark thread as executing
here.
* stack.c (get_selected_block): Return null if inferior is
executing.
* target.c (target_resume): Mark resumed ptid as executing.
* breakpoint.c (until_break_command): Replace target_executing
check by is_executing.
* remote.c (remote_async_resume): Don't mark inferior as executing
here.
* mi/mi-interp.c (mi_cmd_interpreter_exec): Replace target_executing
by any_running.
* mi/mi-main.c (mi_cmd_exec_interrupt, mi_cmd_execute)
(mi_execute_async_cli_command): Replace target_executing by
is_running.
* frame.c (get_current_frame): Error out if the current thread is
executing.
(has_stack_frames): New.
(get_selected_frame, deprecated_safe_get_selected_frame): Check
has_stack_frames.
* Makefile.in (event-top.o, frame.o, inf-loop.o, top.o): Depend on
$(gdbthread_h).
* breakpoint.c (bpstat_copy): Call RELEASE_VALUE on the new OLD_VAL.
gdb/testsuite/
* gdb.base/value-double-free.exp, gdb.base/value-double-free.c: New.
(gdb_stdint_h, gdb_stdint.h, stamp-int): Delete. Remove
all dependencies on $(gdb_stdint_h).
(distclean): Do not delete gdb_stdint.h.
* acinclude.m4: Do not use stdint.m4.
* configure.ac: Set GNULIB_STDINT_H. Remove tests for stdint.h,
uintptr_t, and gdb_stdint.h.
* defs.h: Include <stdint.h>.
* gdb_thread_db.h: Assume stdint.h is already included.
* breakpoint.c, findcmd.c, hppa-tdep.c, inf-ptrace.c, proc-service.c,
rs6000-nat.c, spu-linux-nat.c, target.c, win32-nat.c: Do not
include gdb_stdint.h.
* configure, config.in: Regenerate.
* defs.h (make_cleanup_restore_integer): New declaration.
(struct cleanup): New field free_arg.
(make_my_cleanup_2): New.
* utils.c (restore_integer_closure, restore_integer)
(make_cleanup_restore_integer): New.
(make_my_cleanup): Initialize the free_arg field and
renamed to make_my_cleanup_2.
(do_my_cleanups): Call free_arg.
(discard_cleanups): Call free_arg.
* breakpoint.c (restore_always_inserted_mode): Remove.
(update_breakpoints_after_exec): Use make_cleanup_restore_integer.
temporary catchpoints. In MI add missing fields 'reason', 'disp',
'bkptno'.
(print_mention_exception_catchpoint): Add 'Temporary' for temporary
catchpoints.
(handle_gnu_v3_exceptions): Use tempflag.
to_watchpoint_addr_within_range.
(target_watchpoint_addr_within_range): New function.
* target.c (update_current_target): Inherit
to_watchpoint_addr_within_range, defaulting to
default_watchpoint_addr_within_range.
(default_watchpoint_addr_within_range): New function.
(debug_to_watchpoint_addr_within_range): New function.
(setup_target_debug): Set to_watchpoint_addr_within_range.
* ppc-linux-nat.c (ppc_linux_watchpoint_addr_within_range):
New function.
(_initialize_ppc_linux_nat): Set to_watchpoint_addr_within_range.
* breakpoint.c (watchpoints_triggered): Use
target_watchpoint_addr_within_range.
* gdbint.texinfo (Algorithms): Describe
target_watchpoint_addr_within_range.
* breakpoint.c (create_breakpoint): Add breakpoint_ops argument and
assign its value to the breakpoint created.
(create_breakpoints): Add breakpoint_ops argument and pass it
to create_breakpoint call.
(break_command_really): Add breakpoint_ops argument and pass/assign
appropriately.
(break_command_1): Pass NULL as ops argument.
(set_breakpoint): Pass NULL as ops argument.
(print_one_exception_catchpoint): Print <PENDING> if no loc available.
(handle_gnu_v3_exceptions): Call generic breakpoint code to insert
catch and throw catchpoints.
* breakpoint.c (until_break_command_continuation): Add
the 'error' parameter. Directly delete the breakoint as
opposed to running cleanups.
(until_break_command): Install continuation only
after starting the target. Don't use exec cleanups,
use ordinary cleanups. Discard cleanups is successfully
started the target in async mode.
(make_cleanup_delete_breakpoint): Remove.
* breakpoint.h (make_cleanup_delete_breakpoint): Remove
declaration.
* defs.h (do_exec_cleanups, make_exec_cleanup): Remove
declarations.
(struct continations): Add the 'error' parameter to the
continuation_hook field.
(add_continuation, do_all_continuations)
(add_intermediate_continuation)
(do_all_intermediate_continuations): Add the 'error' parameter.
* exceptions.c (throw_exception): Don't call do_exec_cleanups.
* inf-loop.c (inferior_event_handler): Instead of calling
discard_all_continuations, use do_all_continuations with 1 as
'error' parameter. Pass 0 as 'error' parameter in existing uses
of discard_all_continuations.
* infcmd.c (step_1): Do not use exec cleanup. For async case, discard
cleanups.
(step_once): Install continuation only after resuming the target.
(step_1_continuation): Disable longjmp breakpoint on error.
(finish_command_continuation): Add the error parameter. Delete
the finish breakpoint directly, do not use cleanups.
(finish_command): Do not use exec_cleanups. Always setup
continuation. For sync case, immediately run them.
(attach_command_continuation): Add the error parameter.
* infrun.c (fetch_inferior_event): Do not use exec cleanups to
remove step_resume_breakpoint -- adjust delete it directly.
* interps.c (interp_set): Adjust call to do_all_continations.
* mi/mi-interp.c (mi_interpreter_exec_continuation): Do not
do exec cleanups.
* mi/mi-main.c (mi_cmd_target_select): Do not do exec
cleanups.
(mi_cmd_execute): Do not use exec_cleanup.
(mi_execute_async_cli_command): Simplify the string concatenation
logic. Do no use exec cleanup.
(mi_exec_async_cli_cmd_continuation): New parameter error.
Free last_async_command.
* top.c (command_line_handler_continuation): New parameter error.
* utils.c (exec_cleanup_chain, make_exec_cleanup)
(do_exec_cleanups): Remove.
(add_continuation, do_all_continations)
(add_intermediate_continuation)
(do_all_intermediate_continuations): New parameter error.
* infrun.c (normal_stop) Move breakpoint_auto_delete further down
to allow printing to 'see' real reason of stop. This fixes PR 2424.
* breakpoint.c (bpdisp_texst): New function. The function takes over
the role of bpstats static array in print_one_breakpoint_location.
(print_it_typical): Print "Temporary breakpoint" instead
of just "Breakpoint" when breakpoint is, well, temporary. For mi-like
protocols, print disp field.
(print_one_breakpoint_location): Removed bpdisps static definition.
Call new bpstat_text function to get value for 'disp' field.
(mention): Print "Temporary breakpoint" instead of just "Breakpoint".
* Makefile.in (infcmd.o, inf-loop.o): Update dependencies.
* breakpoint.c (bpstat_do_actions): In async mode,
don't jump to top expecting stop_bpstat to be already
updated.
* event-loop.c (start_event_loop): Call async_enable_stdin
on exception.
* event-top.c (async_enable_stdin): Do nothing if sync_execution
is not set.
(command_handler): Do not setup continuation here.
(command_line_handler_continuation): Move to...
* top.c (command_line_handler_continuation): ... here.
(execute_command): In async mode, register continuation.
Don't check frame's language in running in async mode.
* exceptions.c (throw_exception): Don't do exec_error_cleanups.
* inf-loop.c (complete_execution): Inline into...
(inferior_event_handler): ... here. Clear target_executing before
doing any cleanups. Don't try to show prompt if the target was
resumed.
* infcmd.c (signal_command): Add support for async mode.
(finish_command): Only add continuation if the target was
successfully resumed.
* remote.c (init_async_opts): Register to_get_thread_local_address
handler.
* mi/mi-interp.c (mi_cmd_interpreter_exec): Don't mess
with sync_execution.
* tui/tui-interp.c (tui_command_loop): Call async_enable_stdin
on exception.
(update_watchpoint): Set and clear val_valid. Use
fetch_watchpoint_value. Handle unreadable values on the
value chain. Correct check for user-requested array watchpoints.
(breakpoint_init_inferior): Clear val_valid.
(watchpoint_value_print): New function.
(print_it_typical): Use it. Do not free or clear old_val. Print
watchpoints even if old_val == NULL.
(watchpoint_check): Use fetch_watchpoint_value. Check for values
becoming readable or unreadable.
(watch_command_1): Use fetch_watchpoint_value. Set val_valid.
(do_enable_watchpoint): Likewise.
* breakpoint.h (struct breakpoint): Update comment for val. Add
val_valid.
* NEWS: Mention watchpoints on inaccessible memory.
* gdb.base/watchpoint.c (global_ptr, func4): New.
(main): Call func4.
* gdb.base/watchpoint.exp: Call test_inaccessible_watchpoint.
(test_inaccessible_watchpoint): New.
* gdb.texinfo (Set Watchpoints): Mention watchpoints on
unreadable memory. Delete obsolete SPARClite reference.
(ambiguous_names_p): New fn.
(update_breakpoint_locations): When restoring bp enable status, don't
compare function names if any functions have same name.
* Makefile.in (breakpoint.o): Add hashtab.h dependency.
* gdb.cp/mb-inline.exp: New.
* gdb.cp/mb-inline.h: New.
* gdb.cp/mb-inline1.cc: New.
* gdb.cp/mb-inline2.cc: New.
about non-existent functions for -break-insert.
* breakpoint.c (break_command_really): Use throw_exception
for rethrowing. If rethrowing, don't print the exception.
This eliminates the need to traverse value chain, doing
various checks, in three different places.
* breakpoint.h (struct bp_location): New fields
lengths and watchpoint_type.
(struct breakpoint): Remove the val_chain field.
* breakpoint.c (is_hardware_watchpoint): New.
(free_valchain): Remove.
(update_watchpoint): New.
(insert_bp_location): For hardware watchpoint, just
directly insert it.
(insert_breakpoints): Call update_watchpoint_locations
on all watchpoints. If we have failed to insert
any location of a hardware watchpoint, remove all inserted
locations.
(remove_breakpoint): For hardware watchpoints, directly
remove location.
(watchpoints_triggered): Iterate over locations.
(bpstat_stop_status): Use only first location of
a resource watchpoint.
(delete_breakpoint): Don't call free_valchain.
(print_one_breakpoint): Don't print all
locations for watchpoints.
(breakpoint_re_set_one): Use update_watchpoint for
watchpoints.
* breakpoint.c (insert_bp_location): For watchpoints,
recompute condition.
(breakpoint_re_set_one): Instead of recomputing value
and condition for watchpoints, just reset value and
let insert_breakpoints/insert_bp_location recompute it.
Don't do anything about disabled watchpoint.
"thread" parameter to the watchpoint command and set the
"thread" member of the breakpoint struct.
* doc/gdb.texinfo: Add new parameter's description.
* testsuite/gdb.base/watch_thread_num.c: New testcase source file.
* testsuite/gdb.base/watch_thread_num.exp: New testcase expect file.
* gdb.h (gdb_breakpoint): Add parameter pending.
* breakpoint.c (gdb_breakpoint): Add parameter pending.
* mi/mi-cmd-break.c (mi_break_insert): Change
comment to refer to manual. Add support for
the -f flag, for pending breakpoint.
from break_command_1. New parameters COND_STRING, THREAD
PARSE_CONDITITION_AND_THREAD and PENDING_BREAK_SUPPORT.
The previous FLAG parameter split into TEMPFLAG and
HARDWAREFLAG.
When PARSE_CONDITION_AND_THREAD is not set, duplicate
the passed condition string.
(struct captured_breakpoint_args): Remove
(do_captured_breakpoint): Remove.
(break_command_1): Relay to break_command_really.
(gdb_breakpoint): Relay to break_command_really.
non-contiguous address ranges.
* addrmap.c, addrmap.h: New files.
* block.h (struct addrmap): New forward declaration.
(struct blockvector): New member, 'map'.
(BLOCKVECTOR_MAP): New accessor macro.
* block.c: #include "addrmap.h"
(blockvector_for_pc_sect): If the blockvector we've found has
an address map, use it instead of searching the blocks.
* buildsym.c: #include "addrmap.h"
(pending_addrmap_obstack, pending_addrmap_interesting): New static
variables.
(really_free_pendings): If we have a pending addrmap, free it too.
(record_block_range): New function.
(make_blockvector): If we have an interesting pending addrmap,
record it in the new blockvector.
(start_symtab, buildsym_init): Assert that there is no pending
addrmap now; we should have cleaned up any addrmaps we'd built
previously.
(end_symtab): If there is a pending addrmap left over that didn't
get included in the blockvector, free it.
* buildsym.h (struct addrmap): New forward declaration.
(record_block_range): New prototype.
* objfiles.c: #include "addrmap.h".
(objfile_relocate): Relocate the blockvector's address map, if
present.
* dwarf2read.c (dwarf2_record_block_ranges): New function.
(read_func_scope, read_lexical_block_scope): Call it.
* Makefile.in (SFILES): Add addrmap.c.
(addrmap_h): New header dependency variable.
(COMMON_OBS): Add addrmap.o.
(addrmap.o): New rule.l
(block.o, objfiles.o, buildsym.o): Depend on $(addrmap_h).
* block.c (blockvector_for_pc, blockvector_for_pc_sect): Return a
pointer to the block, not its index in the blockvector.
(block_for_pc_sect): Use the returned block, instead of looking it
up ourselves.
* block.h (blockvector_for_pc, blockvector_for_pc_sect): Update
declarations.
* breakpoint.c (resolve_sal_pc): Use returned block, instead of
looking it up ourselves.
* stack.c (print_frame_label_vars): Disable function, which
depends on the block's index.
* buildsym.c (finish_block): Return the block we've built.
* buildsym.h (finish_block): Update prototype.
* defs.h (CORE_ADDR_MAX): New constant.
* breakpoint.h (insert_breakpoints): Change
return type to void.
* breakpoint.c (insert_breakpoints): Change
return type to void. Rename local return_val
variable to error.
* infrun.c (keep_going): Instead of checking
return value from insert_breakpoints, catch exception.
The checks of breakpoints_inserted before calling
remove_breakpoints are removed, as remove_breakpoint
won't touch uninserted breakpoints. In a number of places,
we're interested if a breakpoint is inserted at particular
PC, and we now use breakpoint_inserted_here_p. In a few
places, insert_breakpoints can be called unconditionally,
since it won't try to insert already inserted breakpoint.
* breakpoint.h (regular_breakpoint_inserted_here_p): New
declaration.
* breakpoint.c (regular_breakpoint_inserted_here_p): New.
(breakpoint_inserted_here_p): Use
regular_breakpoint_inserted_here_p.
* infrun.c (breakpoints_inserted): Remove.
(resume): Don't check for breakpoints_inserted before
remove_hw_watchpoints. Use breakpoint_inserted_here_p.
(proceed, init_wait_for_inferior): Don't set breakpoints_inserted.
(handle_inferior_event): Don't use breakpoints_inserted.
Use breakpoints_meant_to_be_inserted and
breakpoints_inserted_here_p.
(insert_step_resume_breakpoint_at_sal, keep_going): Use
breakpoints_meant_to_be_inserted. Don't set breakpoints_inserted.
(normal_stop): Don't check for breakpoints_inserted. Don't
set breakpoints_inserted.
(keep_going): Don't check for breakpoints_inserted.
(insert_step_resume_breakpoint_at_sal): Don't insert
breakpoints
* breakpoint.h (struct breakpoint): Remove
from_tty and flag fields.
* breakpoint.c (break_command_1): Don't set
from_tty and flag field set of breakpoint.
(create_ada_exception_breakpoint): Don't set
the from_tty field.
* breakpoint.h (struct bpstats): Make
the breakpoint_at field point at const bp_location.
* breakpoint.c (bpstat_alloc): Accept const
bp_location.
(breakpoint_here_p, breakpoint_inserted_here_p)
(software_breakpoint_inserted_here_p)
(breakpoint_thread_match, bpstat_stop_status)
(read_memory_nobpt, bpstat_have_active_hw_watchpoints): Use
const bp_location for iteration.
(print_it_typical, print_bp_stop_message): Use
const bp_location variable.
* Makefile.in (breakpoint_h): Update dependency.
* breakpoint.c (clear_command): Do not remove
breakpoints from breakpoint_chain. Collect breakpoints
to delete in a vector.
* breakpoint.h (breakpoint_p): New typedef for pointer to
breakpoint. Register vector of breakpoint_p.
Jeff Johnston <jjohnstn@redhat.com>
* breakpoint.c (watchpoints_triggered): New.
(bpstat_stop_status): Remove STOPPED_BY_WATCHPOINT argument.
Check watchpoint_triggered instead. Combine handling for software
and hardware watchpoints. Do not use target_stopped_data_address
here. Always check a watchpoint if its scope breakpoint triggers.
Do not stop for thread or overlay events. Improve check for
triggered watchpoints without a value change.
(watch_command_1): Insert the scope breakpoint first. Link the
scope breakpoint to the watchpoint.
* breakpoint.h (enum watchpoint_triggered): New.
(struct breakpoint): Add watchpoint_triggered.
(bpstat_stop_status): Update prototype.
(watchpoints_triggered): Declare.
* infrun.c (enum infwait_status): Add infwait_step_watch_state.
(stepped_after_stopped_by_watchpoint): Delete.
(handle_inferior_event): Make stepped_after_stopped_by_watchpoint
local. Handle infwait_step_watch_state. Update calls to
bpstat_stop_status. Use watchpoints_triggered to check
watchpoints.
* remote.c (stepped_after_stopped_by_watchpoint): Remove extern.
(remote_stopped_data_address): Do not check it.
* gdb.texinfo (Setting Watchpoints): Adjust warning text about
multi-threaded watchpoints.
* gdbint.texinfo (Watchpoints): Describe how watchpoints are
checked. Describe sticky notification. Expand description
of steppable and continuable watchpoints.
(Watchpoints and Threads): New subsection.
* gdb.threads/watchthreads.c (thread_function): Sleep between
iterations.
* gdb.threads/watchthreads.exp: Allow two watchpoints to trigger
at once for S/390. Generate matching fails and passes.
bp_shlib_disabled enumerator.
(struct bp_location): New members shlib_disabled,
global_next, enabled and function_name.
Rename pending to condition_not_parsed.
* breakpoint.c (ALL_BP_LOCATIONS): Iterate over global_next.
(ALL_BP_LOCATIONS_SAFE): Likewise.
(breakpoint_enabled): Don't check for pending.
(condition_command): Free and update all locations of
a breakpoint.
(insert_bp_location): Adjust.
(software_breakpoint_inserted_here_p): Don't care
if breakpoint is enabled, as soon as it's inserted.
(print_it_typical): Print bpstat's location, not
bpstat's breakpoint's location.
(bpstat_stop_status): Iterate over all locations, not
all breakpoints.
(print_breakpoint_location): New.
(print_one_breakpoint): Renamed to
(print_one_breakpoint_location): ...this. Take
parameters to describe which location is being
printed. Modify code to properly print header
for several locations and individual locations.
(print_one_breakpoint): Print all locations.
(breakpoint_has_pc): New.
(describe_other_breakpoints): Use the above.
(check_duplicates): Renamed to...
(check_duplicates_for): .. this.
(check_duplicates): Use check_duplicates_for.
(allocate_bp_location): Adjust.
(set_raw_breakpoint_without_location): New,
extracted from set_raw_breakpoint.
(set_breakpoint_location_function): New.
(set_raw_breakpoint): Use
set_raw_breakpoint_without_location.
(make_breakpoint_permanent): Mark all locations
as inserted.
(disable_breakpoints_in_shlibs): Iterate over
locations.
(disable_breakpoints_in_unloaded_shlib): Likewise.
(re_enable_breakpoints_in_shlibs): Likewise.
(mention): Say "pending" when breakpoint has
zero locations. If breakpoint has more than one
location, say so.
(add_location_to_breakpoint): New.
(create_breakpoint): Accept symtabs_and_lines, not
symtab_and_line. Pass extra sals to
add_location_to_breakpoint.
(create_breakpoints): Pass symtabs_and_lines to
create_breakpoints.
(break_command_1): Make pending breakpoints
have zero locations.
(do_captured_breakpoint): Remove wrong allocation.
(clear_command): Iterate over all locations.
(unlink_locations_from_global_list): Renamed
from unlink_location_from_global_list. Remove
all locations.
(delete_breakpoint): Remove all locations.
Iterate over all locations when deciding which
other location to re-enable.
(all_locations_are_pending): New.
(update_breakpoint_locations): Renamed from
update_breakpoint_location. Try to match old
and new locations using names of containing
functions.
(breakpoint_re_set_one): Adjust.
(find_location_by_number): New.
(disable_command): Allow disabling individual location.
(enable_command): Allow enabling individual location.
* breakpoint.c: Adjust all uses of breakpoint's
enable state to for bp_shlib_disabled change.
(resolve_pending_breakpoint): Remove.
(re_enable_breakpoints_in_shlibs): Remove.
(unlink_locations_from_global_list): New.
(update_breakpoint_locations): New.
(breakpoint_re_set_one): Don't bail out on pending breakpoints.
Use parse_condition and update_breakpoint_location to
reset breakpoint. Ignore 'symbol not found' error from
decode_line_1.
(breakpoint_re_set): Don't emit newline before the
reason why breakpoint is not reset.
(do_enable_breakpoint): Don't specially process pending
breakpoints.
(free_bp_location): New.
(break_command_1): For pending breakpoints, initialize
all fields of a sal with zeroes.
* breakpoint.h (re_enable_breakpoints_in_shlibs): Remove.
* infcmd.c (post_create_inferior): Don't call
re_enable_breakpoints_in_shlibs.
* infrun.c (handle_inferior_event): Likewise.
* solib-irix.c (irix_solib_create_inferior_hook): Likewise.
* solib-osf.c (osf_solib_create_inferior_hook): Likewise.
* win32-nat.c (get_win32_debug_event): Likewise.
create_breakpoints, implementing most of its logic.
Take just a single sal, single address string and
single condition. Do not take parsed condition at
all.
(create_breakpoints): Just call create_breakpoint
for each sal.
(find_condition_and_thread): New.
(break_command_1): Use find_condition_and_thread.
Do not keep parsed conditions.
(do_captured_breakpoint): Don't convert
condition string to struct expression.
* breakpoint.h (breakpoint_at): Change type
to bp_location*.
* breakpoint.c (bpstat_alloc): Take bp_location,
not breakpoint.
(bpstat_find_breakpoint): Look at bpstat's location's
owner, not at bpstat->breakpoint_at.
(bpstat_find_step_resume_breakpoint): Likewise.
(bpstat_num): Likewise.
(print_it_typical): Likewise.
(print_bp_stop_message): Likewise.
(watchpoint_check): Likewise.
(bpstat_what): Likewise.
(bpstat_get_triggered_catchpoints): Likewise.
(breakpoint_auto_delete): Likewise.
(delete_breakpoint): Likewise.
(bpstat_stop_status): Pass location, not breakpoint,
to bpstat_alloc. Look at bpstat's location's
owner, not at bpstat->breakpoint_at.
(build_command_line): Require arguments only for if and while commands.
(get_command_line, execute_user_command, execute_control_command):
Fix wording of warning messages.
(print_command_lines): Print breakpoint commands.
(execute_control_command): Call commands_from_control_command to
handle the `commands' command inside a body of a flow-control command.
(read_next_line): Recognize the `commands' command and build a
command line structure for it.
(recurse_read_control_structure, read_command_lines): Handle
`commands' similarly to `if' and `while'.
* breakpoint.c (get_number_trailer): Document the special meaning
of NULL as the first argument PP.
(commands_from_control_command): New function.
* breakpoint.h (commands_from_control_command): Add prototype.
* defs.h (commands_control): New enumerated value for enum
command_control_type.
(ada_exception_catchpoint_p, ada_decode_exception_location)
(ada_decode_assert_location): Add declaration.
* ada-lang.c: Add include of annotate.h and valprint.h.
(exception_catchpoint_kind): New enum.
(function_name_from_pc, is_known_support_routine)
(ada_find_printable_frame, ada_unhandled_exception_name_addr)
(ada_exception_name_addr_1, ada_exception_name_addr)
(print_it_exception, print_one_exception, print_mention_exception)
(print_it_catch_exception, print_one_catch_exception)
(print_mention_catch_exception, catch_exception_breakpoint_ops)
(print_it_catch_exception_unhandled)
(print_one_catch_exception_unhandled)
(print_mention_catch_exception_unhandled, print_it_catch_assert)
(print_one_catch_assert, print_mention_catch_assert)
(ada_exception_catchpoint_p, error_breakpoint_runtime_sym_not_found)
(ada_get_next_arg, catch_ada_exception_command_split)
(ada_exception_sym_name, ada_exception_sym_name)
(ada_exception_breakption_ops, ada_exception_catchpoint_cond_string)
(ada_parse_catchpoint_condition, ada_exception_sal)
(ada_decode_exception_location)
(ada_decode_assert_location): New function.
(catch_exception_unhandled_breakpoint_ops): New global variable.
(catch_assert_breakpoint_ops): New global variable.
* breakpoint.c: Add include of ada-lang.h.
(print_one_breakpoint): Do not print the condition for Ada
exception catchpoints.
(create_ada_exception_breakpoint): New function.
(catch_ada_exception_command, catch_assert_command): New function.
(catch_command_1): Add support for the new "catch exception" and
"catch assert" commands.
(_initialize_breakpoint): Add help description for the new catch
commands.
* Makefile.in (ada-lang.o): Add dependency on annotate.h and
valprint.h.
(breakpoint.o): Add dependency on ada-lang.h.
* breakpoint.c (describe_other_breakpoints): Add thread parameter.
Annotate display with thread number where appropriate.
(create_breakpoints): Add thread parameter to call to
describe_other_breakpoints.
insert a single-step breakpoint an error instead of a warning.
* breakpoint.c (remove_single_step_breakpoints): Bail out early if
no breakpoints are inserted.
gdb/
* breakpoint.c (print_one_breakpoint): For MI-like UI, output
fullname field.
gdb/doc/
* gdb.texinfo (Breakpoint table commands): Document the fullname
field in -break-list output.
gdb/testsuite/
* gdb.mi/mi-break.exp, gdb.mi/mi2-break.exp: Test for the fullname
field.
* breakpoint.c (BREAK_ARGS_HELP): New mecro.
(_initialize_breakpoint): Enhance break, tbreak, hbreak and thbreak
commands' help by adding more information and using BREAK_ARGS_HELP
to duplicate the common parts. Remove now-redundant cross-references.
testsuite/
* gdb.base/help.exp (help b, help br, help bre, help brea)
(help break): Update the expected message.
* command.h (add_setshow_integer_cmd): Make VAR an integer.
* cli/cli-decode.c (add_setshow_integer_cmd): Update to match.
* valops.c (value_string): Add a cast.
* eval.c (evaluate_subexp_standard): Use gdb_byte for byte buffers.
* breakpoint.c (re_enable_breakpoints_in_shlibs): Use gdb_byte for
byte buffers.
* target.h (struct target_ops): For to_insert_hw_breakpoint and
to_remove_hw_breakpoint use gdb_byte for byte buffer parameters.
* breakpoint.h (struct bp_location): Make shadow_contents a
gdb_byte buffer.
* cli/cli-setshow.c (do_setshow_command): Fix cast.
* cli/cli-dump.c (restore_section_callback)
(restore_binary_file): Use gdb_byte for byte buffers.
* proc-service.c (ps_ptwrite, ps_ptread, ps_pdwrite): Fix casts.
(ps_xfer_memory): Use gdb_byte for byte buffers.
* tracepoint.c (mem2hex): Use gdb_byte for byte buffers, and char
for string buffers.
* ser-tcp.c (net_open): Make len a socklen_t.
* cp-valprint.c, c-valprint.c, infcall.c: Use value_contents or
value_contents_writeable, include note that there are problems.
* breakpoint.c, infcall.c: Use VALUE_LVAL.
* exceptions.h (exception_fprintf): Declare.
(exception_print): Drop pre_print parameter.
* mi/mi-main.c (mi_execute_command): Update exception_print call.
* cli/cli-interp.c (safe_execute_command): Update exception_print
call.
* remote.c (remote_open_1): Instead of passing an error prefix to
catch_exceptions, use catch_exceptions and exception_fprintf.
(remote_start_remote): Change return type to void.
* breakpoint.c (insert_bp_location): Instead of passing an error
prefix to catch_exceptions, use catch_exceptions and
exception_fprintf.
(insert_catchpoint): Change return type to void.
(break_command_1): Update exception_print call.
* exceptions.c (exception_fprintf): New function.
(print_exception): New function.
(exception_print): Use print_exception.
* target.h (to_stopped_data_address): Change prototype to
take a CORE_ADDR pointer and return an int.
* target.c (update_current_target): Change to_stopped_data_address
to match new prototype.
(debug_to_stopped_data_address): Change appropriately.
* breakpoint.c (bpstat_stop_status): Change call to
target_stopped_data_address to use new prototype.
* frv-tdep.c (frv_have_stopped_data_address): New function.
(frv_stopped_data_address): Change to new prototype and
functionality.
* ia64-linux-nat.c (ia64_stopped_data_address): Change to new
prototype and functionality.
(ia64_stopped_by_watchpoint): New function.
* i386-nat.c (i386_stopped_data_address): Change to new
prototype and functionality.
(i386_stopped_by_watchpoint): New function.
* remote.c (remote_stopped_data_address): Change to new prototype
and functionality.
* remote-m32r-sdi.c (m32r_stopped_data_address): Ditto.
* config/frv/tm-frv.h (frv_stopped_data_address): Change prototype.
(STOPPED_BY_WATCHPOINT): Change to use frv_have_stopped_data_address.
* config/i386/nm-i386.h (STOPPED_BY_WATCHPOINT): Change to use
new i386_stopped_by_watchpoint function.
(i386_stopped_by_watchpoint): New prototype.
(i386_stoppped_data_address): Change to new prototype.
* config/ia64/nm-linux.h (STOPPED_BY_WATCHPOINT): Change to use
new ia64_stopped_by_watchpoint function.
(ia64_stopped_by_watchpoint): New prototype.
(ia64_stopped_data_address): Ditto.
* observer.sh: Add struct so_list declaration.
* Makefile.in: Add dependencies on observer.h for solib.c and
breakpoint.c.
* breakpoint.c (disable_breakpoints_in_unloaded_shlib): New
function.
(_initialize_breakpoint): Register
disable_breakpoints_in_unloaded_shlib as an observer of the
"solib unloaded" observation event.
(re_enable_breakpoints_in_shlibs): For bp_shlib_disabled breakpoints,
call decode_line_1 so unfound breakpoint errors are silent.
* solib.c (update_solib_list): When a solib is discovered to have
been unloaded by the program, notify all observers of the
"solib unloaded" observation event.
* infrun.c (handle_inferior_event): Initialize stopped_by_watchpoint
to -1.
* breakpoint.c (bpstat_stop_status): Move check for ignoring
untriggered watchpoints to a separate if clause. Update function
comment regarding STOPPED_BY_WATCHPOINT argument.
STOPPED_BY_WATCHPOINT. Use it instead of testing
target_stopped_data_address agaist 0 to check whether
or not we stopped due to a hardware watchpoint.
* breakpoint.h (bpstat_stop_status): Adapt prototype.
* infrun.c (handle_inferior_event): Call bpstat_stop_status
with new argument.
From Paul Koning <pkoning@equallogic.com>:
* breakpoint.c (free_valchain): New function.
(insert_bp_location, delete_breakpoint): Use free_valchain.
(remove_breakpoint): Do not remove the valchain.
(bpstat_stop_status): If not stopped by watchpoint, skip
watchpoints when generating stop status list.
* infrun.c (handle_inferior_event): Make
stepped_after_stopped_by_watchpoint a global variable.
* remote.c (remote_stopped_data_address): Return watch data
address rather than zero if stepped_after_stopped_by_watchpoint is
set.
* defs.h (nquery, yquery): New prototypes.
* breakpoint.c (break_command_1): Use new nquery interface.
* utils.c (defaulted_query, nquery, yquery): New functions.
* breakpoint.h (struct breakpoint): Add new flag, from_tty,
and pending fields for pending breakpoint support.
* breakpoint.c (breakpoint_enabled): Add check for not pending.
(condition_command): Only parse condition if not a pending
breakpoint.
(print_one_breakpoint): Add support for pending breakpoints.
(describe_other_breakpoints): Add checks to verify we are not
dealing with pending breakpoints.
(check_duplicates): Don't check pending breakpoints.
(set_raw_breakpoint): Initialize pending flag.
(do_restore_lang_radix_cleanup): New cleanup routine.
(resolve_pending_breakpoint): New function.
(re_enable_breakpoints_in_shlibs): Try and resolve any
pending breakpoints via resolve_pending_breakpoint.
(mention): Add pending breakpoint support.
(parse_breakpoint_sals): Add new parameter to pass to
decode_line_1 to indicate silent errors when files or functions
are not found. Change all callers.
(do_captured_parse_breakpoint): New function.
(break_command_1): Change prototype to return an rc value and to
take an optional pending breakpoint pointer. Support creating
a pending breakpoint if a "not found" form of error occurs when
parsing the breakpoint. Also support resolving an existing pending
breakpoint and be silent if the resolution fails.
(create_breakpoints): Change prototype to take pending breakpoint
pointer. When resolving a pending breakpoint, use the new pointer
to provide a conditional or commands added by the end-user.
(delete_breakpoint): Add appropriate check for pending.
(breakpoint_re_set_one): Ditto.
(do_enable_breakpoint): Ditto.
and check the specified thread for each breakpoint.
* breakpoint.h (bpstat_stop_status): Update prototype.
* infrun.c (handle_inferior_event): Update calls to
bpstat_stop_status.
argument, and change first argument to a CORE_ADDR.
* breakpoint.h (bpstat_stop_status): Update prototype.
* infrun.c (adjust_pc_after_break): Add a new comment.
(handle_inferior_event): Update calls to bpstat_stop_status.
* breakpoint.c (breakpoint_re_set_one): Set b->cond, b->val, and
b->exp to NULL after freeing so that error during re-parsing or
evaluation of expressions associated with breakpoint don't
eventually lead to re-freeing of storage.
Committed by Andrew Cagney.