Commit Graph

11 Commits

Author SHA1 Message Date
Joel Brobecker e2882c8578 Update copyright year range in all GDB files
gdb/ChangeLog:

        Update copyright year range in all GDB files
2018-01-02 07:38:06 +04:00
Simon Marchi 229d26fc9e Add enum for result of fast_tracepoint_collecting
I got confused by the result value of fast_tracepoint_collecting, while
it sounds like it would return true/false (whether the thread is
collecting or not), it actually returns:

  0: not collecting
  1: in the jump pad, before the relocated instruction
  2: in the jump pad, at or after the relocated instruction

To avoid confusion, I think it would be nice to make it return an enum.
If you can help find a shorter but still relavant name, it would be
awesome.  Otherwise, we'll go with that, fast_tpoint_collect_result,
which is at least consistent with the existing
fast_tpoint_collect_status.

gdb/gdbserver/ChangeLog:

	* tracepoint.h (enum class fast_tpoint_collect_result): New
	enumeration.
	(fast_tracepoint_collecting): Change return type to
	fast_tpoint_collect_result.
	* tracepoint.c (fast_tracepoint_collecting): Likewise.
	* linux-low.h: Include tracepoint.h.
	(struct lwp_info) <collecting_fast_tracepoint>: Change type to
	fast_tpoint_collect_result.
	* linux-low.c (handle_tracepoints): Adjust.
	(linux_fast_tracepoint_collecting): Change return type to
	fast_tpoint_collect_result.
	(maybe_move_out_of_jump_pad, linux_wait_for_event_filtered,
	linux_wait_1, stuck_in_jump_pad_callback,
	lwp_signal_can_be_delivered, linux_resume_one_lwp_throw,
	proceed_one_lwp): Adjust to type change.
2017-07-26 10:57:07 +02:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Marcin Kościelnicki a13c46966d IPA: Add alloc_jump_pad_buffer target hook.
Targets may have various requirements on the required location of the jump
pad area.  Currently IPA allocates it at the lowest possible address,
so that it is reachable by branches from the executable.  However, this
fails on powerpc, which has executable link address (0x10000000) much
larger than branch reach (+/- 32MiB).

This makes jump pad buffer allocation a target hook instead.  The current
implementations are as follows:

- i386 and s390: Branches can reach anywhere, so just mmap it.  This
  avoids the linear search dance.
- x86_64: Branches have +/-2GiB of reach, and executable is loaded low,
  so just call mmap with MAP_32BIT.  Likewise avoids the linear search.
- aarch64: Branches have +-128MiB of reach, executable loaded at 4MiB.
  Do a linear search from 4MiB-size downwards to page_size.
- s390x: Branches have +-4GiB of reach, executable loaded at 2GiB.
  Do like on aarch64.

gdb/gdbserver/ChangeLog:

	* linux-aarch64-ipa.c: Add <sys/mman.h> and <sys/auxv.h> includes.
	(alloc_jump_pad_buffer): New function.
	* linux-amd64-ipa.c: Add <sys/mman.h> include.
	(alloc_jump_pad_buffer): New function.
	* linux-i386-ipa.c (alloc_jump_pad_buffer): New function.
	* linux-s390-ipa.c: Add <sys/mman.h> and <sys/auxv.h> includes.
	(alloc_jump_pad_buffer): New function.
	* tracepoint.c (getauxval) [!HAVE_GETAUXVAL]: New function.
	(initialize_tracepoint): Delegate to alloc_jump_pad_buffer.
	* tracepoint.h (alloc_jump_pad_buffer): New prototype.
	(getauxval) [!HAVE_GETAUXVAL]: New prototype.
2016-03-31 15:36:38 +02:00
Marcin Kościelnicki 1cda151268 gdbserver/IPA: Export some functions via global function pointers.
On powerpc64, qSymbol for a function returns the function code address,
and not the descriptor address.  Since we emit code calling gdb_collect
and some other functions, we need the descriptor (no way to know the
proper TOC address without it).  To get the descriptor address, make
global function pointer variables in the IPA pointing to the relevant
functions and read them instead of asking for them directly via qSymbol.

gdb/gdbserver/ChangeLog:

	* linux-aarch64-ipa.c: Rename gdb_agent_get_raw_reg to get_raw_reg.
	* linux-amd64-ipa.c: Likewise.
	* linux-i386-ipa.c: Likewise.
	* linux-s390-ipa.c: Likewise.
	* tracepoint.c: IPA-export gdb_collect_ptr instead of gdb_collect,
	ditto for get_raw_reg_ptr, get_trace_state_variable_value_ptr,
	set_trace_state_variable_value_ptr.
	(struct ipa_sym_addresses): Likewise.
	(symbol_list): Likewise.
	(install_fast_tracepoint): Dereference gdb_collect_ptr instead of
	accessing gdb_collect directly.
	(gdb_collect_ptr_type): New typedef.
	(get_raw_reg_ptr_type): New typedef.
	(get_trace_state_variable_value_ptr_type): New typedef.
	(set_trace_state_variable_value_ptr_type): New typedef.
	(gdb_collect_ptr): New global.
	(get_raw_reg_ptr): New global.
	(get_trace_state_variable_value_ptr): New global.
	(set_trace_state_variable_value_ptr): New global.
	(get_raw_reg_func_addr): Dereference get_raw_reg_ptr instead of
	accessing get_raw_reg directly.
	(get_get_tsv_func_addr): Likewise for
	get_trace_state_variable_value_ptr.
	(get_set_tsv_func_addr): Likewise for
	set_trace_state_variable_value_ptr.
	* tracepoint.h: Rename gdb_agent_get_raw_reg to get_raw_reg.
2016-03-30 23:48:47 +02:00
Marcin Kościelnicki ae91f62539 [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.
If gdbserver and IPA are using different tdesc, they will disagree
about 'R' trace packet size.  This results in mangled traces.

To make sure they pick the same tdesc, gdbserver pokes the tdesc
(specified as an index in a target-specific list) into a global
variable in IPA.  In theory, IPA could find out the tdesc on its
own, but that may be complex (in particular, I don't know how to
tell whether we have LAST_BREAK on s390 without messing with ptrace),
and we'd have to duplicate the logic.

Tested on i386 and x86_64.  On i386, it fixes two FAILs in ftrace.exp.
On x86_64, these failures have been KFAILed - one of them works now,
but the other now fails due to an unrelated reason (ugh).

gdb/gdbserver/ChangeLog:

	PR gdb/13808
	* Makefile.in: Add i386-*-linux-ipa.o and amd64-*-linux-ipa.o.
	* configure.srv: Ditto.
	* linux-aarch64-ipa.c (get_ipa_tdesc): New function.
	(initialize_low_tracepoint): Remove ipa_tdesc assignment.
	* linux-amd64-ipa.c: Add "linux-x86-tdesc.h" include.
	(init_registers_amd64_linux): Remove prototype.
	(tdesc_amd64_linux): Remove declaration.
	(get_ipa_tdesc): New function.
	(initialize_low_tracepoint): Remove ipa_tdesc assignment,
	initialize remaining tdescs.
	* linux-i386-ipa.c: Add "linux-x86-tdesc.h" include.
	(init_registers_i386_linux): Remove prototype.
	(tdesc_i386_linux): Remove declaration.
	(get_ipa_tdesc): New function.
	(initialize_low_tracepoint): Remove ipa_tdesc assignment,
	initialize remaining tdescs.
	* linux-low.c (linux_get_ipa_tdesc_idx): New function.
	(linux_target_ops): wire in linux_get_ipa_tdesc_idx.
	* linux-low.h (struct linux_target_ops): Add get_ipa_tdesc_idx.
	* linux-x86-low.c: Move tdesc declarations to linux-x86-tdesc.h.
	(x86_get_ipa_tdesc_idx): New function.
	(the_low_target): Wire in x86_get_ipa_tdesc_idx.
	* linux-x86-tdesc.h: New file.
	* target.h (struct target_ops): Add get_ipa_tdesc_idx.
	(target_get_ipa_tdesc_idx): New macro.
	* tracepoint.c (ipa_tdesc_idx): New macro.
	(struct ipa_sym_addresses): Add addr_ipa_tdesc_idx.
	(symbol_list): Add ipa_tdesc_idx.
	(cmd_qtstart): Write ipa_tdesc_idx in the target.
	(ipa_tdesc): Remove.
	(ipa_tdesc_idx): New variable.
	(get_context_regcache): Use get_ipa_tdesc.
	(gdb_collect): Ditto.
	(gdb_probe): Ditto.
	* tracepoint.h (get_ipa_tdesc): New prototype.
	(ipa_tdesc): Remove.

gdb/testsuite/ChangeLog:

	PR gdb/13808
	* gdb.trace/ftrace.exp (test_fast_tracepoints): Remove kfail.
2016-02-25 17:57:28 +01:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Pedro Alves 3c14e5a39b Make functions and variables exported by the IPA be extern "C"
Functions and variables that are exported by the IPA DSO (that
GDBserver needs to look up) should have "C" mangling, thus be declared
with extern "C".

Function and variable declarations need the extern "C" marker, but
variable definitions can't be marked extern, so the patch splits
IP_AGENT_EXPORT into three.

Building in C++ mode revealed that a few variables were missing
IP_AGENT_EXPORT, thus the IPA has been broken when stripped, even in C
mode...  So this ends being a bug fix as well.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

	* common/agent.h (IPA_SYM_EXPORTED_NAME): New.
	(IPA_SYM): Use it.
	* common/common-defs.h (EXTERN_C_PUSH, EXTERN_C_POP): New macros.

gdb/gdbserver/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

	* linux-amd64-ipa.c (gdb_agent_get_raw_reg): Use
	IP_AGENT_EXPORT_FUNC.
	* linux-i386-ipa.c (gdb_agent_get_raw_reg): Use
	IP_AGENT_EXPORT_FUNC.
	* tracepoint.c (ATTR_USED, ATTR_NOINLINE, ATTR_CONSTRUCTOR)
	(IP_AGENT_EXPORT): Delete.
	(gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end)
	(gdb_trampoline_buffer, gdb_trampoline_buffer_end)
	(gdb_trampoline_buffer_error, collecting, gdb_collect)
	(stop_tracing, flush_trace_buffer, about_to_request_buffer_space)
	(trace_buffer_is_full, stopping_tracepoint, expr_eval_result)
	(error_tracepoint, tracepoints, tracing, trace_buffer_ctrl)
	(trace_buffer_ctrl_curr, trace_buffer_lo, trace_buffer_hi)
	(traceframe_read_count, traceframe_write_count)
	(traceframes_created, trace_state_variables, get_raw_reg)
	(get_trace_state_variable_value, set_trace_state_variable_value)
	(ust_loaded, helper_thread_id, cmd_buf): Use
	IPA_SYM_EXPORTED_NAME.
	(stop_tracing, flush_trace_buffer): Use IP_AGENT_EXPORT_FUNC.
	(tracepoints) Use IP_AGENT_EXPORT_VAR.
	(stopping_tracepoint, trace_buffer_is_full, expr_eval_result): Use
	IP_AGENT_EXPORT_VAR and wrap in EXTERN_C_PUSH/EXTERN_C_POP.
	(last_tracepoint): Move into !IN_PROCESS_AGENT block.
	(error_tracepoint): Use IP_AGENT_EXPORT_VAR and wrap in
	EXTERN_C_PUSH/EXTERN_C_POP.
	(trace_state_variables): Use IP_AGENT_EXPORT_VAR.
	(trace_buffer_lo, trace_buffer_hi): Use IP_AGENT_EXPORT_VAR and
	wrap in EXTERN_C_PUSH/EXTERN_C_POP.
	(trace_buffer_ctrl, trace_buffer_ctrl_curr)
	(traceframe_write_count, traceframe_read_count)
	(traceframes_created, tracing): Use IP_AGENT_EXPORT_VAR.
	(about_to_request_buffer_space, get_trace_state_variable_value)
	(set_trace_state_variable_value): Use IP_AGENT_EXPORT_FUNC.
	(collecting): Use IP_AGENT_EXPORT_VAR and wrap in
	EXTERN_C_PUSH/EXTERN_C_POP.
	(gdb_collect): Use IP_AGENT_EXPORT_FUNC.
	(ust_loaded, cmd_buf): Use IP_AGENT_EXPORT_VAR.
	(helper_thread_id, gdb_agent_capability): Use IP_AGENT_EXPORT_VAR
	and wrap in EXTERN_C_PUSH/EXTERN_C_POP.
	(gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end)
	(gdb_trampoline_buffer, gdb_trampoline_buffer_end)
	(gdb_trampoline_buffer_error): Use IP_AGENT_EXPORT_VAR.
	* tracepoint.h (ATTR_USED, ATTR_NOINLINE, EXPORTED_SYMBOL):
	Define.
	(IP_AGENT_EXPORT_FUNC, IP_AGENT_EXPORT_VAR)
	(IP_AGENT_EXPORT_VAR_DECL): Define.
	(tracing): Declare.
	(gdb_agent_get_raw_reg): Declare.
2015-02-27 17:27:29 +00:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Pedro Alves 270c6aeaf2 Add missing new files from these previous commits:
2013-09-05  Pedro Alves  <palves@redhat.com>

	* server.h (handle_vFile, hostio_last_error_from_errno): Move
	to ...
	* hostio.h: ... this new file.
	* hostio.c, server.c, linux-low.c, nto-low.c, spu-low,
	win32-low.c: Include hostio.h.

2013-09-05  Pedro Alves  <palves@redhat.com>

	* server.h (gdb_client_data, handler_func, callback_handler_func)
	(delete_file_handler, add_file_handler, append_callback_event)
	(delete_callback_event, start_event_loop, initialize_event_loop):
	Move to event-loop.h and include it.
	* event-loop.h: New file.

2013-09-05  Pedro Alves  <palves@redhat.com>

	* dll.c, inferiors.c, remote-utils.c, server.c: Include "dll.h".
	* server.h (struct dll_info, all_dlls, dlls_changed, clear_dlls)
	(loaded_dll, unloaded_dll): Move to ...
	* dll.h: ... this new file.
	* inferiors.c, remote-utils.c, win32-low.c: Include "dll.h".

2013-09-05  Pedro Alves  <palves@redhat.com>

	* server.h (current_process, get_thread_process, all_processes)
	(add_inferior_to_list, for_each_inferior, current_inferior)
	(remove_inferior, add_process, remove_process, find_process_pid)
	(have_started_inferiors_p, have_attached_inferiors_p)
	(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id)
	(clear_inferiors, find_inferior, find_inferior_id)
	(inferior_target_data, set_inferior_target_data)
	(inferior_regcache_data, set_inferior_regcache_data): Move to
	inferiors.h, and include it.
	* inferiors.h: New file.

2013-09-05  Pedro Alves  <palves@redhat.com>

	* ax.c, linux-low.c, linux-x86-low.c, server.c: Include
	tracepoint.h.
	* server.h (IPA_BUFSIZ, initialize_tracepoint, tracing)
	(disconnected_tracing, tracepoint_look_up_symbols, stop_tracing
	(handle_tracepoint_general_set, handle_tracepoint_query)
	(tracepoint_finished_step, tracepoint_was_hit)
	(release_while_stepping_state_list, current_traceframe)
	(in_readonly_region, traceframe_read_mem)
	(fetch_traceframe_registers, traceframe_read_sdata)
	(traceframe_read_info, struct fast_tpoint_collect_status)
	(fast_tracepoint_collecting, force_unlock_trace_buffer)
	(handle_tracepoit_bkpts, initialize_low_tracepoint)
	(supply_fast_tracepoint_registers)
	(supply_static_tracepoint_registers, set_trampoline_buffer_space)
	(ipa_tdesc, claim_trampoline_space)
	(have_fast_tracepoint_trampoline_buffer, gdb_agent_about_to_close)
	(agent_mem_read, agent_get_trace_state_variable_value)
	(agent_set_trace_state_variable_value, agent_tsv_read)
	(agent_mem_read_string, get_raw_reg_func_addr)
	(get_get_tsv_func_addr, get_set_tsv_func_addr): Move to ...
	* tracepoint.h: ... this new file.

2013-09-05  Pedro Alves  <palves@redhat.com>

	* server.h (perror_with_name, error, fatal, warning, paddress)
	(pulongest, plongest, phex_nz, pfildes): Move to utils.h, and
	include it.
	* utils.h: New file.

2013-09-05  Pedro Alves  <palves@redhat.com>

	* server.h (remote_debug, noack_mode, transport_is_reliable)
	(gdb_connected, STDIO_CONNECTION_NAME, remote_connection_is_stdio)
	(read_ptid, write_ptid, putpkt, putpkt_binary, putpkt_notif)
	(getpkt, remote_prepare, remote_open, remote_close, write_ok)
	(write_enn, initialize_async_io, enable_async_io)
	(disable_async_io, check_remote_input_interrupt_request)
	(convert_ascii_to_int, convert_int_to_ascii, new_thread_notify)
	(dead_thread_notify, prepare_resume_reply)
	(decode_address_to_semicolon, decode_address, decode_m_packet)
	(decode_M_packet, decode_X_packet, decode_xfer_write)
	(decode_search_memory_packet, unhexify, hexify)
	(remote_escape_output, unpack_varlen_hex, clear_symbol_cache)
	(look_up_one_symbol, relocate_instruction)
	(monitor_output): Move to remote-utils.h, and include it.
	* remote-utils.h: New file.
2013-09-05 22:18:48 +00:00