* breakpoint.c (bpstat_stop_status): Call the check_status
breakpoint_ops method.
(print_one_breakpoint_location): Also print the condition for Ada
exception catchpoints.
(allocate_bp_location): New, factored out from
allocate_bp_location.
(allocate_bp_location): Adjust. Call the owner breakpoint's
allocate_location method, if there is one.
(free_bp_location): Call the locations's dtor method, if there is
one.
(init_raw_breakpoint_without_location): New breakpoint_ops
parameter. Use it.
(set_raw_breakpoint_without_location): Adjust.
(init_raw_breakpoint): New breakpoint_ops parameter. Pass it down.
(set_raw_breakpoint): Adjust.
(catch_fork_breakpoint_ops, catch_vfork_breakpoint_ops)
(catch_syscall_breakpoint_ops): Install NULL allocate_location,
re_set and check_status methods.
(init_catchpoint): Don't memset, initialize thread, addr_string
and enable_state. Pass the ops down to init_raw_breakpoint.
(install_catchpoint): Rename to ...
(install_breakpoint): ... this, and make extern.
(create_fork_vfork_event_catchpoint): Adjust.
(catch_exec_breakpoint_ops): Install NULL allocate_location,
re_set and check_status methods.
(create_syscall_event_catchpoint): Adjust.
(ranged_breakpoint_ops, watchpoint_breakpoint_ops)
(masked_watchpoint_breakpoint_ops): Install NULL
allocate_location, re_set and check_status methods.
(catch_exec_command_1): Adjust.
(gnu_v3_exception_catchpoint_ops): Install NULL allocate_location,
re_set and check_status methods.
(create_ada_exception_breakpoint): Rename to ...
(init_ada_exception_breakpoint): ... this. Add a struct
breakpoint parameter, and delete the exp_string, cond_string and
cond parameters. Use init_raw_breakpoint, and don't install or
mention the breakpoint yet. Don't clear breakpoint fields that
init_raw_breakpoint already clears.
(re_set_breakpoint): Delete, split into ...
(breakpoint_re_set_default, prepare_re_set_context): ... these new
functions.
(breakpoint_re_set_one): Call the breakpoint's
breakpoint_ops->re_set implementation, if there's one. Adjust.
* breakpoint.h: Forward declare struct bpstats and struct bp_location.
(struct bp_location_ops): New type.
(struct bp_location): New field `ops'.
(struct breakpoint_ops): New `allocate_location', `re_set' and
`check_status' fields. Make `breakpoint_hit''s description match
reality.
(init_bp_location): Declare.
(breakpoint_re_set_default): Declare.
(create_ada_exception_breakpoint): Rename to ...
(init_ada_exception_breakpoint): ... this. Add a struct
breakpoint parameter, and delete the exp_string, cond_string and
cond parameters.
(install_breakpoint): Declare.
* ada-lang.c: Include exceptions.h.
<Ada exceptions description>: Update.
(struct ada_catchpoint_location): New type.
(ada_catchpoint_location_dtor): New function.
(ada_catchpoint_location_ops): New global.
(ada_catchpoint): New type.
(create_excep_cond_exprs): New function.
(dtor_exception, allocate_location_exception, re_set_exception)
(should_stop_exception, check_status_exception): New functions.
(print_one_exception, print_mention_exception)
(print_recreate_exception): Adjust.
(dtor_catch_exception, allocate_location_catch_exception)
(re_set_catch_exception, check_status_catch_exception): New
functions.
(catch_exception_breakpoint_ops): Install them.
(dtor_catch_exception_unhandled)
(allocate_location_catch_exception_unhandled)
(re_set_catch_exception_unhandled)
(check_status_catch_exception_unhandled): New functions.
(catch_exception_unhandled_breakpoint_ops): Install them.
(dtor_catch_assert, allocate_location_catch_assert)
(re_set_catch_assert, check_status_catch_assert): New functions.
(catch_assert_breakpoint_ops): Install them.
(ada_exception_catchpoint_p): Delete.
(catch_ada_exception_command_split)
(ada_exception_catchpoint_cond_string): Rename exp_string
parameter to excep_string. Adjust.
(ada_parse_catchpoint_condition): Delete.
(ada_exception_sal): Rename the exp_string parameter to
excep_string. Delete the cond_string and cond parameters.
Adjust.
(ada_decode_exception_location): Rename the exp_string parameter
to excep_string. Delete the cond_string and cond parameters.
Adjust.
(create_ada_exception_catchpoint): New function.
(catch_ada_exception_command, ada_decode_assert_location)
(catch_assert_command): Adjust.
* ada-lang.h (ada_exception_catchpoint_p): Delete declaration.
* ada-lang.c: Include arch-utils.h.
(ada_decode_exception_location): Make static.
(catch_ada_exception_command): Moved here from breakpoint.c.
(ada_decode_assert_location): Make static.
(catch_assert_command): Moved here from breakpoint.c.
(_initialize_ada_lang): Install the exception and assert
catchpoint commands here.
* ada-lang.h (ada_decode_exception_location)
(ada_decode_assert_location): Delete declarations.
* breakpoint.c (CATCH_PERMANENT, CATCH_TEMPORARY): Moved to
breakpoint.h.
(create_ada_exception_breakpoint): Make extern.
(catch_ada_exception_command, catch_assert_command): Moved to
ada-lang.c.
(add_catch_command): Make extern.
(_initilize_breakpoint): Don't install the exception and assert
catchpoint commands here.
* breakpoint.h (CATCH_PERMANENT, CATCH_TEMPORARY): Moved from
breakpoint.c
(add_catch_command, create_ada_exception_breakpoint): Declare.
* breakpoint.c (init_raw_breakpoint_without_location): Don't add
the breakpoint to the breakpoint chain here.
(set_raw_breakpoint_without_location): Add the breakpoint to the
breakpoint chain here.
(init_raw_breakpoint): Adjust comments.
(set_raw_breakpoint): Add the breakpoint to the breakpoint chain
here.
(init_catchpoint): Don't set the catchpoint's breakpoint number
here.
(install_catchpoint): New function.
(create_fork_vfork_event_catchpoint)
(create_syscall_event_catchpoint, catch_exec_command_1): Adjust to
use install_catchpoint.
* breakpoint.h (struct breakpoint_ops): New field `dtor'.
(struct breakpoint): Delete field `syscalls_to_be_caught'.
* breakpoint.c (init_raw_breakpoint_without_location): Remove
reference to syscalls_to_be_caught.
(catch_fork_breakpoint_ops, catch_vfork_breakpoint_ops): Install a
NULL `dtor'.
(struct syscall_catchpoint): New type.
(dtor_catch_syscall): New function.
(insert_catch_syscall, remove_catch_syscall)
(breakpoint_hit_catch_syscall, print_one_catch_syscall)
(print_recreate_catch_syscall): Adjust.
(catch_syscall_breakpoint_ops): Install dtor_catch_syscall.
(catch_exec_breakpoint_ops): Install a NULL `dtor'.
(create_syscall_event_catchpoint): Adjust to use init_catchpoint.
(ranged_breakpoint_ops, watchpoint_breakpoint_ops)
(masked_watchpoint_breakpoint_ops)
(gnu_v3_exception_catchpoint_ops): Install a NULL `dtor'.
(delete_breakpoint): Call the `dtor' breakpoint_ops method, if
there is one. Remove references to syscalls_to_be_caught.
(catching_syscall_number): Adjust.
* ada-lang.c (catch_exception_breakpoint_ops)
(catch_exception_unhandled_breakpoint_ops)
(catch_assert_breakpoint_ops): Install a NULL `dtor'.
* breakpoint.c (add_to_breakpoint_chain)
(init_raw_breakpoint_without_location): New functions, factored
out from ...
(set_raw_breakpoint_without_location): ... this one.
(init_raw_breakpoint): New function, factored out from
set_raw_breakpoint and adjusted to use
init_raw_breakpoint_without_location.
(set_raw_breakpoint): Adjust.
(init_catchpoint): New function, factored out from
create_catchpoint_without_mention and adjusted to use
init_raw_breakpoint.
(create_catchpoint_without_mention): Adjust.
(class_symtab): Remove.
(jv_dynamics_progspace_key): New global.
(jv_per_objfile_free): Reset program space data. Update assert.
Don't clear globals.
(get_dynamics_objfile): Use and set program space data.
(get_java_class_symtab): Use get_dynamics_objfile.
(add_class_symbol): Likewise.
(java_link_class_type): Likewise.
(java_object_type, jv_clear_object_type, set_java_object_type):
Remove.
(get_java_object_type): Update. Don't cache result.
(is_object_type): Don't call set_java_object_type.
(_initialize_java_language): Don't set jv_type_objfile_data_key;
initialize jv_dynamics_progspace_key.
get_frame_func instead of get_frame_pc to determine the code
address used to construct the frame ID.
(i386_epilogue_frame_unwind_stop_reason): Fix coding style.
(i386_epilogue_frame_this_id): Likewise.
(i386_epilogue_frame_prev_register): New function.
(i386_epilogue_frame_unwind): Use i386_epilogue_frame_prev_register.
(i386_stack_tramp_frame_sniffer): Fix coding style.
(i386_stack_tramp_frame_unwind): Use i386_epilogue_frame_prev_register.
(i386_gdbarch_init): Fix comments.
Code cleanup.
* dwarf2read.c (dw2_map_symbol_filenames): Use symbol_filename_ftype
for fun.
* psymtab.c (map_symbol_filenames_psymtab)
(map_partial_symbol_filenames): Likewise.
* psymtab.h: Include symfile.h.
(map_partial_symbol_filenames): Use symbol_filename_ftype for fun.
* symfile.h (symbol_filename_ftype): New.
(struct quick_symbol_functions): Use symbol_filename_ftype for fun of
map_symbol_filenames, clarify more the naming in comment.
The testcase, at some point, is trying to change the contents
of a string that was defined as follow:
char *str = "hello, testsuite";
The problem is that the string is constant, and str is never used
to change the contents of the string in the program, so the compiler
is free to allocate it in a read-only section. This is what happens
on x86-windows, for instance.
As a result, trying to change the contents of the string during
the `python gdb.inferiors()[0].write_memory (addr, str)' results
in the following error:
(gdb) python gdb.inferiors()[0].write_memory (addr, str)
gdb: write target memory, 5 bytes at 0x00403064
Traceback (most recent call last):
File "<string>", line 1, in <module>
gdb.MemoryError: Cannot access memory at address 0x403064
Error while executing Python code.
This patch prevents this from happening by declaring str as an
array rather than a pointer.
gdb/testsuite/ChangeLog:
* gdb.python/py-inferior.c (f2): Make str an array rather
than a pointer.
* gdb.python/py-inferior.exp: Adjust testcase accordingly.
gdb/ChangeLog:
From Stephen Kitt <steve@sk2.org>
* breakpoint.c, breakpoint.h, cli/cli-dump.c, dwarf2expr.c,
gdbarch.c, gdbarch.sh, remote.c: Various spelling fixes.
gdb/testsuite/ChangeLog:
From Stephen Kitt <steve@sk2.org>
* gdb.base/help.exp: Adjust following some spelling corrections
in GDB.
Since gdb sets up a nice sysroot path for us by default, automatically
pass it down to the sim target so it too gets a good default. This does
not override anything the user explicitly specifies of course.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* linespec.c (get_search_block): New function.
(find_methods): Add FILE_SYMTATB parameter and use it and
get_search_block to pass an appropriate block to
lookup_symbol_in_namespace.
(decode_line_1): Record if *ARGPTR is single-quote enclosed.
Check if *ARGPTR starts with a filename first.
If it does, call locate_first_half again to locate the next
"first half" of the linespec.
Pass FILE_SYMTATB to decode_objc and decode_compound.
Swallow the trailing single-quote if IS_SQUOTE_ENCLOSED.
(locate_first_half): Stop on the first colon seen.
(decode_compound): Add FILE_SYMTAB parameter.
Pass FILE_SYMTAB to lookup_prefix_sym and find_method.
(lookup_prefix_sym): Add FILE_SYMTAB parameter and use
get_search_block with lookup_symbol.
(find_method): Add FILE_SYMTAB parameter and pass it to
find_methods.
(decode_objc): Use get_search_block.
* cp-namespace.c (ANONYMOUS_NAMESPACE_LEN): Remove.
(cp_scan_for_anonymous_namespaces): Use CP_ANONYMOUS_NAMESPACE_STR
and CP_ANONYMOUS_NAMESPACE_LEN.
(cp_is_anonymous): Likewise.
* cp-support.h (CP_ANONYMOUS_NAMESPACE_STR): Define.
(CP_ANONYMOUS_NAMESPACE_LEN): Define.
* dwarf2read.c (namespace_name): Likewise.
(fixup_partial_die): Likewise.
* linespec.c (decode_compound): If CP_ANONYMOUS_NAMESPACE_STR is
seen in the input, keep it.
gdb/gdbserver/
* linux-x86-low.c (i386_dr_low_get_addr): Fix off by one in
assertion.
* win32-i386-low.c (i386_dr_low_get_addr): Ditto.
gdb/testsuite/
* gdb.arch/i386-dr3-watch.c: New file.
* gdb.arch/i386-dr3-watch.exp: New file.
gdb/
* continuations.h (continuation_ftype): Add `err' parameter.
Document parameters.
(do_all_continuations, do_all_continuations_thread)
(do_all_intermediate_continuations)
(do_all_intermediate_continuations_thread)
(do_all_inferior_continuations): Add `err' parameter.
* continuations.c (do_my_continuations_1, do_my_continuations)
(do_all_inferior_continuations, do_all_continuations_ptid)
(do_all_continuations_thread_callback)
(do_all_continuations_thread, do_all_continuations)
(do_all_intermediate_continuations_thread_callback)
(do_all_intermediate_continuations_thread)
(do_all_intermediate_continuations): Add `err' parameter, and pass
it down all the way to the continuations proper.
* inf-loop.c (inferior_event_handler): If fetching an inferior
event throws an error, don't pop the target, and still call the
continuations, but with `err' set. Adjust all other continuation
calls.
* breakpoint.c (until_break_command_continuation): Add `err'
parameter.
* infcmd.c (step_1_continuation): Add `err' parameter. Don't
issue another step if `err' is set.
(struct until_next_continuation_args): New.
(until_next_continuation): Add `err' parameter. Adjust.
(until_next_command): Adjust.
(struct finish_command_continuation_args): Add `thread' field.
(finish_command_continuation): Add `err' parameter. Handle it.
(finish_forward): Adjust.
(attach_command_continuation): Add `err' parameter. Handle it.
* infrun.c (infrun_thread_stop_requested_callback): Adjust to
cancel the continuations.
* interps.c (interp_set): Adjust to cancel the continuations.
* thread.c (clear_thread_inferior_resources): Adjust to cancel the
continuations rather than discarding.
(free_thread): Don't clear thread inferior resources here.
(delete_thread_1): Do it here instead. And do it before removing
the thread from the threads list. Tag the thread as exited before
clearing thread inferior resources.
Fix PR 10970, PR 12702.
* linux-nat.c (linux_lwp_is_zombie): New function.
(wait_lwp): Initialize status. New variable prev_mask. Block signals.
Check for linux_lwp_is_zombie. Use WNOHANG and sigsuspend.
gdb/testsuite/
* gdb.threads/leader-exit.c: New file.
* gdb.threads/leader-exit.exp: New file.
gdb/
* record.c: Include event-loop.h, inf-loop.h.
(record_beneath_to_async): New global.
(tmp_to_async): New global.
(record_async_inferior_event_token): New global.
(record_open_1): Don't error out if async is enabled.
(record_open): Handle to_async. Create an async event source in
the event loop.
(record_close): Delete the async event source.
(record_resumed): New global.
(record_execution_dir): New global.
(record_resume, record_core_resume): Set them. Register the
target on the event loop.
(record_wait): Rename to ...
(record_wait_1): ... this. Add more debug output. Handle
TARGET_WNOHANG, and the target beneath returning
TARGET_WAITKIND_IGNORE.
(record_wait): Reimplement on top of record_wait_1.
(record_async_mask_value): New global.
(record_async, record_async_mask, record_can_async_p)
(record_is_async_p, record_execution_direction): New functions.
(init_record_ops, init_record_core_ops): Install new methods.
* infrun.c (fetch_inferior_event): Temporarily switch the global
execution direction to the direction the target was going.
(execution_direction): Change type to int.
* target.c (default_execution_direction): New function.
(update_current_target): Inherit and de_fault
to_execution_direction.
* target.h (struct target_ops) <to_execution_direction>: New
field.
(target_execution_direction): New macro.
* inferior.h (execution_direction): Change type to int.
gdb/
* infcmd.c (finish_backward): Set a step-resume breakpoint at the
function's entry point instead of a manually managed momentary
breakpoint, and only ever issue one proceed call.
* infrun.c (handle_inferior_event) <BPSTAT_WHAT_STEP_RESUME>: If
doing a reverse-finish, switch to stepi mode, to do another step.
(insert_step_resume_breakpoint_at_sal): Make public.
(normal_stop): No need to save function value return registers if
going reverse.
* inferior.h (insert_step_resume_breakpoint_at_sal): Declare.
gdb/testsuite/
* gdb.reverse/finish-reverse-bkpt.exp: New test.
for ALPHA_ZERO_REGNUM.
(alpha_supply_int_regs): Explicitly supply zero as the value for
ALPHA_ZERO_REGNUM in the register cache.
* alpha-nat.c (fetch_osf_core_registers): Ditto.
gdb/
* breakpoint.c (watchpoint_check): If the watchpoint went out of
scope, clear its command list.
(map_breakpoint_numbers): Don't walk the related breakpoints list
of each breakpoint.
gdb/testsuite/
* gdb.base/commands.exp (watchpoint_command_test): Check that the
watchpoint's command list didn't execute when the watchpoint went
out of scope.
* symfile.h (enum dwarf2_section_enum): New type.
(dwarf2_get_section_info): New prototype.
* dwarf2read.c (dwarf2_get_section_info): Replace parameter
section_name by sect. Use a switch to select the info.
* dwarf2-frame.c (warf2_get_section_info): Remove prototype.
(dwarf2_build_frame_info): Adjust calls to dwarf2_get_section_info.
gdb/
* solib-svr4.c (svr4_solib_create_inferior_hook): Skip setting
shared library event breakpoint if there's no execution.
gdb/testsuite/
* gdb.trace/tfile.exp: Add test that opening the basic.tf trace
file doesn't error, using MI.
* c-lang.c (evaluate_subexp_c): Use expect_type if it is not
NULL.
gdb/testsuite
* gdb.base/charset.exp (string_display): Add tests to assign to
arrays.
* gdb.base/charset.c (short_array, int_array, long_array): New.
zero as the value for %g0 in the register cache.
* sparc-tdep.c (sparc32_supply_gregset): Likewise.
* sparc64-tdep.c (sparc64_supply_gregset): Likewise.
gdb/
* infcmd.c: Include "inf-loop.h".
(step_once): When stepping into an inline subroutine, pretend the
target has run. If the target can async, switch the inferior
event loop to INF_EXEC_COMPLETE.
* inferior.h (user_visible_resume_ptid): Declare.
* infrun.c (user_visible_resume_ptid): New function, factored out
from `resume'.
(resume): Use it.
* mi/mi-main.c (mi_execute_async_cli_command): Remove assertion
that the current thread is running. Merge async and sync
branches.
gdb/
* tracepoint.c: Include exceptions.h.
(TFILE_PID): Move higher in file.
(tfile_open): Delay pushing the tfile target until we're assured
the tfile header is present in the file. Wrap reading the initial
newline-terminated lines in TRY_CATCH. Pop the target if the
initial setup failed. Add the tfile's thread immediately
aftwards, before any non-essential setup. Don't skip
post_create_inferior if there are no traceframes present in the
file.
(tfile_close): Remove redundant check for null before xfree call.
(tfile_thread_alive): New function.
(init_tfile_ops): Register it as to_thread_alive callback.
quote pattern to avoid problems with Cygwin/mingw expect versions.
* gdb.base/default.exp (show convenience): Use double
quote pattern for regular expressions.
Fix -readnow for -gdwarf-4 unused type units.
* dwarf2read.c (struct signatured_type): Remove the field offset.
(create_signatured_type_table_from_index): Remove its initialization.
(create_debug_types_hash_table): Likewise. Initialize per_cu.offset
instead. Add a complaint call.
(process_psymtab_comp_unit): Change assignment to gdb_assert.
(process_type_comp_unit, lookup_die_type, dump_die_shallow)
(lookup_signatured_type_at_offset, read_signatured_type)
(write_one_signatured_type): Update the field for per_cu.
gdb/testsuite/
Fix -readnow for -gdwarf-4 unused type units.
* gdb.dwarf2/dw4-sig-type-unused.S: New file.
* gdb.dwarf2/dw4-sig-type-unused.exp: New file.