binutils-gdb/gdb/remote-notif.h

135 lines
3.8 KiB
C
Raw Normal View History

gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
/* Remote notification in GDB protocol
Copyright (C) 1988-2020 Free Software Foundation, Inc.
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef REMOTE_NOTIF_H
#define REMOTE_NOTIF_H
#include <list>
#include <memory>
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
/* An event of a type of async remote notification. */
struct notif_event
{
virtual ~notif_event ()
{
}
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
};
/* A unique pointer holding a notif_event. */
typedef std::unique_ptr<notif_event> notif_event_up;
Move pending_event to remote_notif_state. This patch moves pending_event to remote_notif_state. All pending events are destroyed in remote_notif_state_xfree. However, discard_pending_stop_replies release pending event too, so the pending event of stop notification is released twice, we need some refactor here. We add a new function discard_pending_stop_replies_in_queue which only discard events in stop_reply_queue, and let remote_notif_state_xfree release pending event for all notif_client. After this change, discard_pending_stop_replies is only attached to ifnerior_exit observer, so the INF can't be NULL any more. The NULL checking is removed too. gdb: 2013-10-04 Yao Qi <yao@codesourcery.com> * remote-notif.h (REMOTE_NOTIF_ID): New enum. (struct notif_client) <pending_event>: Moved to struct remote_notif_state. <id>: New field. (struct remote_notif_state) <pending_event>: New field. (notif_event_xfree): Declare. * remote-notif.c (handle_notification): Adjust. (notif_event_xfree): New function. (do_notif_event_xfree): Call notif_event_xfree. (remote_notif_state_xfree): Call notif_event_xfree to free each element in field pending_event. * remote.c (discard_pending_stop_replies): Remove declaration. (discard_pending_stop_replies_in_queue): Declare. (remote_close): Call discard_pending_stop_replies_in_queue instead of discard_pending_stop_replies. (remote_start_remote): Adjust. (stop_reply_xfree): Call notif_event_xfree. (notif_client_stop): Adjust initialization. (remote_notif_remove_all): Rename it to ... (remove_stop_reply_for_inferior): ... this. Update comments. Don't check INF is NULL. (discard_pending_stop_replies): Return early if notif_state is NULL. Adjust. Don't check INF is NULL. (remote_notif_get_pending_events): Adjust. (discard_pending_stop_replies_in_queue): New function. (remote_wait_ns): Likewise.
2013-10-04 09:42:06 +02:00
/* ID of the notif_client. */
enum REMOTE_NOTIF_ID
{
REMOTE_NOTIF_STOP = 0,
REMOTE_NOTIF_LAST,
};
remote: one struct remote_state per struct remote_target 'struct remote_state' today contains per-connection state, however there's only a single global instance of that type. In order to support multiple connections, we must have one such object per connection. Thus this patch eliminates the 'remote_state' global in favor of having a remote_state instance per remote_target instance. The get_remote_state free function is eliminated as well, by making it a remote_target method instead. The patch then fixes the fallout by making all free functions that refer to get_remote_state() directly or indirectly be methods of remote_target too. Likewise, remote-fileio.c and remote-notif.c routines are parameterized with a remote_target pointer too, so they can call into the right remote_target instance. References to the global 'get_remote_state ()->remote_desc' to tell whether the remote target is open (!= nullptr) must be replaced with something else: - Command implementations use a new get_current_remote_target free function. - remote_target::open_1 checks the exception type instead. Finally, remote_target and extended_remote_target are made heap-allocated targets. As with the earlier core target patches, it still won't be possible to have more than one remote_target instance in practice, but this puts us closer. gdb/ChangeLog: 2018-05-22 Pedro Alves <palves@redhat.com> * remote-fileio.c (remote_fileio_reply, remote_fileio_ioerror) (remote_fileio_badfd, remote_fileio_return_errno) (remote_fileio_return_success, remote_fileio_func_open) (remote_fileio_func_open, remote_fileio_func_close) (remote_fileio_func_read, remote_fileio_func_write) (remote_fileio_func_lseek, remote_fileio_func_rename) (remote_fileio_func_unlink, remote_fileio_func_stat) (remote_fileio_func_fstat, remote_fileio_func_gettimeofday) (remote_fileio_func_isatty, remote_fileio_func_system): Add remote_target parameter. (remote_fio_func_map) <func>: Add remote_target parameter. (do_remote_fileio_request, remote_fileio_request): * remote-fileio.h (remote_fileio_request): * remote-notif.c (remote_notif_ack, remote_notif_parse, ): Add remote_target parameter. (remote_notif_process, handle_notification): Adjust to pass down the remote. (remote_notif_state_allocate): Add remote_target parameter. Save it. * remote-notif.h (struct remote_target): Forward declare. (struct notif_client) <parse, ack, can_get_pending_events>: Add remote_target parameter. (struct remote_notif_state) <remote>: New field. (remote_notif_ack, remote_notif_parse): Add remote_target parameter. (remote_notif_state_allocate, remote_notif_state_allocate): Add remote_target parameter. * remote.c (OPAQUETHREADBYTES, threadref, gdb_ext_thread_info) (threads_listing_context, rmt_thread_action, protocol_feature) (packet_reg, stop_reply, stop_reply_p, enum packet_support) (packet_result, struct threads_listing_context, remote_state): Move definitions and declarations higher up. (remote_target) <~remote_target>: Declare. (remote_download_command_source, remote_file_put, remote_file_get) (remote_file_delete, remote_hostio_pread, remote_hostio_pwrite) (remote_hostio_pread_vFile, remote_hostio_send_command) (remote_hostio_set_filesystem, remote_hostio_open) (remote_hostio_close, remote_hostio_unlink, remote_state) (get_remote_state, get_remote_packet_size, get_memory_packet_size) (get_memory_write_packet_size, get_memory_read_packet_size) (append_pending_thread_resumptions, remote_detach_1) (append_resumption, remote_resume_with_vcont) (add_current_inferior_and_thread, wait_ns, wait_as) (process_stop_reply, remote_notice_new_inferior) (process_initial_stop_replies, remote_add_thread) (btrace_sync_conf, remote_btrace_maybe_reopen) (remove_new_fork_children, kill_new_fork_children) (discard_pending_stop_replies, stop_reply_queue_length) (check_pending_events_prevent_wildcard_vcont) (discard_pending_stop_replies_in_queue, stop_reply) (remote_notif_remove_queued_reply, stop_reply *queued_stop_reply) (peek_stop_reply, remote_parse_stop_reply, remote_stop_ns) (remote_interrupt_as, remote_interrupt_ns) (remote_get_noisy_reply, remote_query_attached) (remote_add_inferior, remote_current_thread, get_current_thread) (set_thread, set_general_thread, set_continue_thread) (set_general_process, write_ptid) (remote_unpack_thread_info_response, remote_get_threadinfo) (parse_threadlist_response, remote_get_threadlist) (remote_threadlist_iterator, remote_get_threads_with_ql) (remote_get_threads_with_qxfer) (remote_get_threads_with_qthreadinfo, extended_remote_restart) (get_offsets, remote_check_symbols, remote_supported_packet) (remote_query_supported, remote_packet_size) (remote_serial_quit_handler, remote_detach_pid) (remote_vcont_probe, remote_resume_with_hc) (send_interrupt_sequence, interrupt_query) (remote_notif_get_pending_events, fetch_register_using_p) (send_g_packet, process_g_packet, fetch_registers_using_g) (store_register_using_P, store_registers_using_G) (set_remote_traceframe, check_binary_download) (remote_write_bytes_aux, remote_write_bytes, remote_read_bytes_1) (remote_xfer_live_readonly_partial, remote_read_bytes) (remote_send_printf, remote_flash_write, readchar) (remote_serial_write, putpkt, putpkt_binary, skip_frame) (read_frame, getpkt, getpkt_or_notif_sane_1, getpkt_sane) (getpkt_or_notif_sane, remote_vkill, remote_kill_k) (extended_remote_disable_randomization, extended_remote_run) (send_environment_packet, extended_remote_environment_support) (extended_remote_set_inferior_cwd, remote_write_qxfer) (remote_read_qxfer, push_stop_reply, vcont_r_supported) (packet_command): Now methods of ... (remote_target): ... this class. (m_remote_state) <remote_target>: New field. (struct remote_state) <stop_reply_queue, remote_async_inferior_event_token, wait_forever_enabled_p>: New fields. (remote_state::remote_state): Allocate stop_reply_queue. (remote_state): Delete global. (get_remote_state_raw): Delete. (remote_target::get_remote_state): Allocate m_remote_state on demand. (get_current_remote_target): New. (remote_ops, extended_remote_ops): Delete. (wait_forever_enabled_p, remote_async_inferior_event_token): Delete, moved to struct remote_state. (remote_target::close): Delete self. Destruction bits split to ... (remote_target::~remote_target): ... this. (show_memory_packet_size): Adjust to use get_current_remote_target. (struct protocol_feature) <func>: Add remote_target parameter. All callers adjusted. (curr_quit_handler_target): New. (remote_serial_quit_handler): Reimplement. (remote_target::open_1): Adjust to use get_current_remote_target. Heap-allocate remote_target/extended_remote_target instances. (vcont_builder::vcont_builder): Add remote_target parameter, and save it in m_remote. All callers adjusted. (vcont_builder::m_remote): New field. (vcont_builder::restart, vcont_builder::flush) (vcont_builder::push_action): Use it. (remote_target::commit_resume): Use it. (struct queue_iter_param) <remote>: New field. (remote_target::remove_new_fork_children): Fill in 'remote' field. (check_pending_event_prevents_wildcard_vcont_callback_data): New. (check_pending_event_prevents_wildcard_vcont_callback) (remote_target::check_pending_events_prevent_wildcard_vcont) (remote_target::discard_pending_stop_replies) (remote_target::discard_pending_stop_replies_in_queue) (remote_target::remote_notif_remove_queued_reply): Fill in 'remote' field. (remote_notif_get_pending_events): New. (remote_target::readchar, remote_target::remote_serial_write): Save/restore curr_quit_handler_target. (putpkt): New. (kill_new_fork_children): Fill in 'remote' field. (packet_command): Use get_current_remote_target, defer to remote_target method of same name. (scoped_remote_fd::scoped_remote_fd): Add 'remote_target' parameter, and save it in m_remote. All callers adjusted. (scoped_remote_fd::release): Use m_remote. (scoped_remote_fd::m_remote): New field. (remote_file_put, remote_file_get, remote_file_delete): Use get_current_remote_target, defer to remote_target method of same name. (remote_btrace_reset): Add remote_state paremeter. Update all callers. (remote_async_inferior_event_handler). Pass down 'data'. (remote_new_objfile): Use get_current_remote_target. (remote_target::vcont_r_supported): New. (set_range_stepping): Use get_current_remote_target and remote_target::vcont_r_supported. (_initialize_remote): Don't allocate 'remote_state' and 'stop_reply_queue' globals. * remote.h (struct remote_target): Forward declare. (getpkt, putpkt, remote_notif_get_pending_events): Add 'remote_target' parameter.
2018-05-22 19:22:11 +02:00
struct remote_target;
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
/* A client to a sort of async remote notification. */
struct notif_client
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
{
/* The name of notification packet. */
const char *name;
/* The packet to acknowledge a previous reply. */
const char *ack_command;
/* Parse BUF to get the expected event and update EVENT. This
function may throw exception if contents in BUF is not the
expected event. */
remote: one struct remote_state per struct remote_target 'struct remote_state' today contains per-connection state, however there's only a single global instance of that type. In order to support multiple connections, we must have one such object per connection. Thus this patch eliminates the 'remote_state' global in favor of having a remote_state instance per remote_target instance. The get_remote_state free function is eliminated as well, by making it a remote_target method instead. The patch then fixes the fallout by making all free functions that refer to get_remote_state() directly or indirectly be methods of remote_target too. Likewise, remote-fileio.c and remote-notif.c routines are parameterized with a remote_target pointer too, so they can call into the right remote_target instance. References to the global 'get_remote_state ()->remote_desc' to tell whether the remote target is open (!= nullptr) must be replaced with something else: - Command implementations use a new get_current_remote_target free function. - remote_target::open_1 checks the exception type instead. Finally, remote_target and extended_remote_target are made heap-allocated targets. As with the earlier core target patches, it still won't be possible to have more than one remote_target instance in practice, but this puts us closer. gdb/ChangeLog: 2018-05-22 Pedro Alves <palves@redhat.com> * remote-fileio.c (remote_fileio_reply, remote_fileio_ioerror) (remote_fileio_badfd, remote_fileio_return_errno) (remote_fileio_return_success, remote_fileio_func_open) (remote_fileio_func_open, remote_fileio_func_close) (remote_fileio_func_read, remote_fileio_func_write) (remote_fileio_func_lseek, remote_fileio_func_rename) (remote_fileio_func_unlink, remote_fileio_func_stat) (remote_fileio_func_fstat, remote_fileio_func_gettimeofday) (remote_fileio_func_isatty, remote_fileio_func_system): Add remote_target parameter. (remote_fio_func_map) <func>: Add remote_target parameter. (do_remote_fileio_request, remote_fileio_request): * remote-fileio.h (remote_fileio_request): * remote-notif.c (remote_notif_ack, remote_notif_parse, ): Add remote_target parameter. (remote_notif_process, handle_notification): Adjust to pass down the remote. (remote_notif_state_allocate): Add remote_target parameter. Save it. * remote-notif.h (struct remote_target): Forward declare. (struct notif_client) <parse, ack, can_get_pending_events>: Add remote_target parameter. (struct remote_notif_state) <remote>: New field. (remote_notif_ack, remote_notif_parse): Add remote_target parameter. (remote_notif_state_allocate, remote_notif_state_allocate): Add remote_target parameter. * remote.c (OPAQUETHREADBYTES, threadref, gdb_ext_thread_info) (threads_listing_context, rmt_thread_action, protocol_feature) (packet_reg, stop_reply, stop_reply_p, enum packet_support) (packet_result, struct threads_listing_context, remote_state): Move definitions and declarations higher up. (remote_target) <~remote_target>: Declare. (remote_download_command_source, remote_file_put, remote_file_get) (remote_file_delete, remote_hostio_pread, remote_hostio_pwrite) (remote_hostio_pread_vFile, remote_hostio_send_command) (remote_hostio_set_filesystem, remote_hostio_open) (remote_hostio_close, remote_hostio_unlink, remote_state) (get_remote_state, get_remote_packet_size, get_memory_packet_size) (get_memory_write_packet_size, get_memory_read_packet_size) (append_pending_thread_resumptions, remote_detach_1) (append_resumption, remote_resume_with_vcont) (add_current_inferior_and_thread, wait_ns, wait_as) (process_stop_reply, remote_notice_new_inferior) (process_initial_stop_replies, remote_add_thread) (btrace_sync_conf, remote_btrace_maybe_reopen) (remove_new_fork_children, kill_new_fork_children) (discard_pending_stop_replies, stop_reply_queue_length) (check_pending_events_prevent_wildcard_vcont) (discard_pending_stop_replies_in_queue, stop_reply) (remote_notif_remove_queued_reply, stop_reply *queued_stop_reply) (peek_stop_reply, remote_parse_stop_reply, remote_stop_ns) (remote_interrupt_as, remote_interrupt_ns) (remote_get_noisy_reply, remote_query_attached) (remote_add_inferior, remote_current_thread, get_current_thread) (set_thread, set_general_thread, set_continue_thread) (set_general_process, write_ptid) (remote_unpack_thread_info_response, remote_get_threadinfo) (parse_threadlist_response, remote_get_threadlist) (remote_threadlist_iterator, remote_get_threads_with_ql) (remote_get_threads_with_qxfer) (remote_get_threads_with_qthreadinfo, extended_remote_restart) (get_offsets, remote_check_symbols, remote_supported_packet) (remote_query_supported, remote_packet_size) (remote_serial_quit_handler, remote_detach_pid) (remote_vcont_probe, remote_resume_with_hc) (send_interrupt_sequence, interrupt_query) (remote_notif_get_pending_events, fetch_register_using_p) (send_g_packet, process_g_packet, fetch_registers_using_g) (store_register_using_P, store_registers_using_G) (set_remote_traceframe, check_binary_download) (remote_write_bytes_aux, remote_write_bytes, remote_read_bytes_1) (remote_xfer_live_readonly_partial, remote_read_bytes) (remote_send_printf, remote_flash_write, readchar) (remote_serial_write, putpkt, putpkt_binary, skip_frame) (read_frame, getpkt, getpkt_or_notif_sane_1, getpkt_sane) (getpkt_or_notif_sane, remote_vkill, remote_kill_k) (extended_remote_disable_randomization, extended_remote_run) (send_environment_packet, extended_remote_environment_support) (extended_remote_set_inferior_cwd, remote_write_qxfer) (remote_read_qxfer, push_stop_reply, vcont_r_supported) (packet_command): Now methods of ... (remote_target): ... this class. (m_remote_state) <remote_target>: New field. (struct remote_state) <stop_reply_queue, remote_async_inferior_event_token, wait_forever_enabled_p>: New fields. (remote_state::remote_state): Allocate stop_reply_queue. (remote_state): Delete global. (get_remote_state_raw): Delete. (remote_target::get_remote_state): Allocate m_remote_state on demand. (get_current_remote_target): New. (remote_ops, extended_remote_ops): Delete. (wait_forever_enabled_p, remote_async_inferior_event_token): Delete, moved to struct remote_state. (remote_target::close): Delete self. Destruction bits split to ... (remote_target::~remote_target): ... this. (show_memory_packet_size): Adjust to use get_current_remote_target. (struct protocol_feature) <func>: Add remote_target parameter. All callers adjusted. (curr_quit_handler_target): New. (remote_serial_quit_handler): Reimplement. (remote_target::open_1): Adjust to use get_current_remote_target. Heap-allocate remote_target/extended_remote_target instances. (vcont_builder::vcont_builder): Add remote_target parameter, and save it in m_remote. All callers adjusted. (vcont_builder::m_remote): New field. (vcont_builder::restart, vcont_builder::flush) (vcont_builder::push_action): Use it. (remote_target::commit_resume): Use it. (struct queue_iter_param) <remote>: New field. (remote_target::remove_new_fork_children): Fill in 'remote' field. (check_pending_event_prevents_wildcard_vcont_callback_data): New. (check_pending_event_prevents_wildcard_vcont_callback) (remote_target::check_pending_events_prevent_wildcard_vcont) (remote_target::discard_pending_stop_replies) (remote_target::discard_pending_stop_replies_in_queue) (remote_target::remote_notif_remove_queued_reply): Fill in 'remote' field. (remote_notif_get_pending_events): New. (remote_target::readchar, remote_target::remote_serial_write): Save/restore curr_quit_handler_target. (putpkt): New. (kill_new_fork_children): Fill in 'remote' field. (packet_command): Use get_current_remote_target, defer to remote_target method of same name. (scoped_remote_fd::scoped_remote_fd): Add 'remote_target' parameter, and save it in m_remote. All callers adjusted. (scoped_remote_fd::release): Use m_remote. (scoped_remote_fd::m_remote): New field. (remote_file_put, remote_file_get, remote_file_delete): Use get_current_remote_target, defer to remote_target method of same name. (remote_btrace_reset): Add remote_state paremeter. Update all callers. (remote_async_inferior_event_handler). Pass down 'data'. (remote_new_objfile): Use get_current_remote_target. (remote_target::vcont_r_supported): New. (set_range_stepping): Use get_current_remote_target and remote_target::vcont_r_supported. (_initialize_remote): Don't allocate 'remote_state' and 'stop_reply_queue' globals. * remote.h (struct remote_target): Forward declare. (getpkt, putpkt, remote_notif_get_pending_events): Add 'remote_target' parameter.
2018-05-22 19:22:11 +02:00
void (*parse) (remote_target *remote,
struct notif_client *self, const char *buf,
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
struct notif_event *event);
/* Send field <ack_command> to remote, and do some checking. If
something wrong, throw an exception. */
remote: one struct remote_state per struct remote_target 'struct remote_state' today contains per-connection state, however there's only a single global instance of that type. In order to support multiple connections, we must have one such object per connection. Thus this patch eliminates the 'remote_state' global in favor of having a remote_state instance per remote_target instance. The get_remote_state free function is eliminated as well, by making it a remote_target method instead. The patch then fixes the fallout by making all free functions that refer to get_remote_state() directly or indirectly be methods of remote_target too. Likewise, remote-fileio.c and remote-notif.c routines are parameterized with a remote_target pointer too, so they can call into the right remote_target instance. References to the global 'get_remote_state ()->remote_desc' to tell whether the remote target is open (!= nullptr) must be replaced with something else: - Command implementations use a new get_current_remote_target free function. - remote_target::open_1 checks the exception type instead. Finally, remote_target and extended_remote_target are made heap-allocated targets. As with the earlier core target patches, it still won't be possible to have more than one remote_target instance in practice, but this puts us closer. gdb/ChangeLog: 2018-05-22 Pedro Alves <palves@redhat.com> * remote-fileio.c (remote_fileio_reply, remote_fileio_ioerror) (remote_fileio_badfd, remote_fileio_return_errno) (remote_fileio_return_success, remote_fileio_func_open) (remote_fileio_func_open, remote_fileio_func_close) (remote_fileio_func_read, remote_fileio_func_write) (remote_fileio_func_lseek, remote_fileio_func_rename) (remote_fileio_func_unlink, remote_fileio_func_stat) (remote_fileio_func_fstat, remote_fileio_func_gettimeofday) (remote_fileio_func_isatty, remote_fileio_func_system): Add remote_target parameter. (remote_fio_func_map) <func>: Add remote_target parameter. (do_remote_fileio_request, remote_fileio_request): * remote-fileio.h (remote_fileio_request): * remote-notif.c (remote_notif_ack, remote_notif_parse, ): Add remote_target parameter. (remote_notif_process, handle_notification): Adjust to pass down the remote. (remote_notif_state_allocate): Add remote_target parameter. Save it. * remote-notif.h (struct remote_target): Forward declare. (struct notif_client) <parse, ack, can_get_pending_events>: Add remote_target parameter. (struct remote_notif_state) <remote>: New field. (remote_notif_ack, remote_notif_parse): Add remote_target parameter. (remote_notif_state_allocate, remote_notif_state_allocate): Add remote_target parameter. * remote.c (OPAQUETHREADBYTES, threadref, gdb_ext_thread_info) (threads_listing_context, rmt_thread_action, protocol_feature) (packet_reg, stop_reply, stop_reply_p, enum packet_support) (packet_result, struct threads_listing_context, remote_state): Move definitions and declarations higher up. (remote_target) <~remote_target>: Declare. (remote_download_command_source, remote_file_put, remote_file_get) (remote_file_delete, remote_hostio_pread, remote_hostio_pwrite) (remote_hostio_pread_vFile, remote_hostio_send_command) (remote_hostio_set_filesystem, remote_hostio_open) (remote_hostio_close, remote_hostio_unlink, remote_state) (get_remote_state, get_remote_packet_size, get_memory_packet_size) (get_memory_write_packet_size, get_memory_read_packet_size) (append_pending_thread_resumptions, remote_detach_1) (append_resumption, remote_resume_with_vcont) (add_current_inferior_and_thread, wait_ns, wait_as) (process_stop_reply, remote_notice_new_inferior) (process_initial_stop_replies, remote_add_thread) (btrace_sync_conf, remote_btrace_maybe_reopen) (remove_new_fork_children, kill_new_fork_children) (discard_pending_stop_replies, stop_reply_queue_length) (check_pending_events_prevent_wildcard_vcont) (discard_pending_stop_replies_in_queue, stop_reply) (remote_notif_remove_queued_reply, stop_reply *queued_stop_reply) (peek_stop_reply, remote_parse_stop_reply, remote_stop_ns) (remote_interrupt_as, remote_interrupt_ns) (remote_get_noisy_reply, remote_query_attached) (remote_add_inferior, remote_current_thread, get_current_thread) (set_thread, set_general_thread, set_continue_thread) (set_general_process, write_ptid) (remote_unpack_thread_info_response, remote_get_threadinfo) (parse_threadlist_response, remote_get_threadlist) (remote_threadlist_iterator, remote_get_threads_with_ql) (remote_get_threads_with_qxfer) (remote_get_threads_with_qthreadinfo, extended_remote_restart) (get_offsets, remote_check_symbols, remote_supported_packet) (remote_query_supported, remote_packet_size) (remote_serial_quit_handler, remote_detach_pid) (remote_vcont_probe, remote_resume_with_hc) (send_interrupt_sequence, interrupt_query) (remote_notif_get_pending_events, fetch_register_using_p) (send_g_packet, process_g_packet, fetch_registers_using_g) (store_register_using_P, store_registers_using_G) (set_remote_traceframe, check_binary_download) (remote_write_bytes_aux, remote_write_bytes, remote_read_bytes_1) (remote_xfer_live_readonly_partial, remote_read_bytes) (remote_send_printf, remote_flash_write, readchar) (remote_serial_write, putpkt, putpkt_binary, skip_frame) (read_frame, getpkt, getpkt_or_notif_sane_1, getpkt_sane) (getpkt_or_notif_sane, remote_vkill, remote_kill_k) (extended_remote_disable_randomization, extended_remote_run) (send_environment_packet, extended_remote_environment_support) (extended_remote_set_inferior_cwd, remote_write_qxfer) (remote_read_qxfer, push_stop_reply, vcont_r_supported) (packet_command): Now methods of ... (remote_target): ... this class. (m_remote_state) <remote_target>: New field. (struct remote_state) <stop_reply_queue, remote_async_inferior_event_token, wait_forever_enabled_p>: New fields. (remote_state::remote_state): Allocate stop_reply_queue. (remote_state): Delete global. (get_remote_state_raw): Delete. (remote_target::get_remote_state): Allocate m_remote_state on demand. (get_current_remote_target): New. (remote_ops, extended_remote_ops): Delete. (wait_forever_enabled_p, remote_async_inferior_event_token): Delete, moved to struct remote_state. (remote_target::close): Delete self. Destruction bits split to ... (remote_target::~remote_target): ... this. (show_memory_packet_size): Adjust to use get_current_remote_target. (struct protocol_feature) <func>: Add remote_target parameter. All callers adjusted. (curr_quit_handler_target): New. (remote_serial_quit_handler): Reimplement. (remote_target::open_1): Adjust to use get_current_remote_target. Heap-allocate remote_target/extended_remote_target instances. (vcont_builder::vcont_builder): Add remote_target parameter, and save it in m_remote. All callers adjusted. (vcont_builder::m_remote): New field. (vcont_builder::restart, vcont_builder::flush) (vcont_builder::push_action): Use it. (remote_target::commit_resume): Use it. (struct queue_iter_param) <remote>: New field. (remote_target::remove_new_fork_children): Fill in 'remote' field. (check_pending_event_prevents_wildcard_vcont_callback_data): New. (check_pending_event_prevents_wildcard_vcont_callback) (remote_target::check_pending_events_prevent_wildcard_vcont) (remote_target::discard_pending_stop_replies) (remote_target::discard_pending_stop_replies_in_queue) (remote_target::remote_notif_remove_queued_reply): Fill in 'remote' field. (remote_notif_get_pending_events): New. (remote_target::readchar, remote_target::remote_serial_write): Save/restore curr_quit_handler_target. (putpkt): New. (kill_new_fork_children): Fill in 'remote' field. (packet_command): Use get_current_remote_target, defer to remote_target method of same name. (scoped_remote_fd::scoped_remote_fd): Add 'remote_target' parameter, and save it in m_remote. All callers adjusted. (scoped_remote_fd::release): Use m_remote. (scoped_remote_fd::m_remote): New field. (remote_file_put, remote_file_get, remote_file_delete): Use get_current_remote_target, defer to remote_target method of same name. (remote_btrace_reset): Add remote_state paremeter. Update all callers. (remote_async_inferior_event_handler). Pass down 'data'. (remote_new_objfile): Use get_current_remote_target. (remote_target::vcont_r_supported): New. (set_range_stepping): Use get_current_remote_target and remote_target::vcont_r_supported. (_initialize_remote): Don't allocate 'remote_state' and 'stop_reply_queue' globals. * remote.h (struct remote_target): Forward declare. (getpkt, putpkt, remote_notif_get_pending_events): Add 'remote_target' parameter.
2018-05-22 19:22:11 +02:00
void (*ack) (remote_target *remote,
struct notif_client *self, const char *buf,
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
struct notif_event *event);
/* Check this notification client can get pending events in
'remote_notif_process'. */
remote: one struct remote_state per struct remote_target 'struct remote_state' today contains per-connection state, however there's only a single global instance of that type. In order to support multiple connections, we must have one such object per connection. Thus this patch eliminates the 'remote_state' global in favor of having a remote_state instance per remote_target instance. The get_remote_state free function is eliminated as well, by making it a remote_target method instead. The patch then fixes the fallout by making all free functions that refer to get_remote_state() directly or indirectly be methods of remote_target too. Likewise, remote-fileio.c and remote-notif.c routines are parameterized with a remote_target pointer too, so they can call into the right remote_target instance. References to the global 'get_remote_state ()->remote_desc' to tell whether the remote target is open (!= nullptr) must be replaced with something else: - Command implementations use a new get_current_remote_target free function. - remote_target::open_1 checks the exception type instead. Finally, remote_target and extended_remote_target are made heap-allocated targets. As with the earlier core target patches, it still won't be possible to have more than one remote_target instance in practice, but this puts us closer. gdb/ChangeLog: 2018-05-22 Pedro Alves <palves@redhat.com> * remote-fileio.c (remote_fileio_reply, remote_fileio_ioerror) (remote_fileio_badfd, remote_fileio_return_errno) (remote_fileio_return_success, remote_fileio_func_open) (remote_fileio_func_open, remote_fileio_func_close) (remote_fileio_func_read, remote_fileio_func_write) (remote_fileio_func_lseek, remote_fileio_func_rename) (remote_fileio_func_unlink, remote_fileio_func_stat) (remote_fileio_func_fstat, remote_fileio_func_gettimeofday) (remote_fileio_func_isatty, remote_fileio_func_system): Add remote_target parameter. (remote_fio_func_map) <func>: Add remote_target parameter. (do_remote_fileio_request, remote_fileio_request): * remote-fileio.h (remote_fileio_request): * remote-notif.c (remote_notif_ack, remote_notif_parse, ): Add remote_target parameter. (remote_notif_process, handle_notification): Adjust to pass down the remote. (remote_notif_state_allocate): Add remote_target parameter. Save it. * remote-notif.h (struct remote_target): Forward declare. (struct notif_client) <parse, ack, can_get_pending_events>: Add remote_target parameter. (struct remote_notif_state) <remote>: New field. (remote_notif_ack, remote_notif_parse): Add remote_target parameter. (remote_notif_state_allocate, remote_notif_state_allocate): Add remote_target parameter. * remote.c (OPAQUETHREADBYTES, threadref, gdb_ext_thread_info) (threads_listing_context, rmt_thread_action, protocol_feature) (packet_reg, stop_reply, stop_reply_p, enum packet_support) (packet_result, struct threads_listing_context, remote_state): Move definitions and declarations higher up. (remote_target) <~remote_target>: Declare. (remote_download_command_source, remote_file_put, remote_file_get) (remote_file_delete, remote_hostio_pread, remote_hostio_pwrite) (remote_hostio_pread_vFile, remote_hostio_send_command) (remote_hostio_set_filesystem, remote_hostio_open) (remote_hostio_close, remote_hostio_unlink, remote_state) (get_remote_state, get_remote_packet_size, get_memory_packet_size) (get_memory_write_packet_size, get_memory_read_packet_size) (append_pending_thread_resumptions, remote_detach_1) (append_resumption, remote_resume_with_vcont) (add_current_inferior_and_thread, wait_ns, wait_as) (process_stop_reply, remote_notice_new_inferior) (process_initial_stop_replies, remote_add_thread) (btrace_sync_conf, remote_btrace_maybe_reopen) (remove_new_fork_children, kill_new_fork_children) (discard_pending_stop_replies, stop_reply_queue_length) (check_pending_events_prevent_wildcard_vcont) (discard_pending_stop_replies_in_queue, stop_reply) (remote_notif_remove_queued_reply, stop_reply *queued_stop_reply) (peek_stop_reply, remote_parse_stop_reply, remote_stop_ns) (remote_interrupt_as, remote_interrupt_ns) (remote_get_noisy_reply, remote_query_attached) (remote_add_inferior, remote_current_thread, get_current_thread) (set_thread, set_general_thread, set_continue_thread) (set_general_process, write_ptid) (remote_unpack_thread_info_response, remote_get_threadinfo) (parse_threadlist_response, remote_get_threadlist) (remote_threadlist_iterator, remote_get_threads_with_ql) (remote_get_threads_with_qxfer) (remote_get_threads_with_qthreadinfo, extended_remote_restart) (get_offsets, remote_check_symbols, remote_supported_packet) (remote_query_supported, remote_packet_size) (remote_serial_quit_handler, remote_detach_pid) (remote_vcont_probe, remote_resume_with_hc) (send_interrupt_sequence, interrupt_query) (remote_notif_get_pending_events, fetch_register_using_p) (send_g_packet, process_g_packet, fetch_registers_using_g) (store_register_using_P, store_registers_using_G) (set_remote_traceframe, check_binary_download) (remote_write_bytes_aux, remote_write_bytes, remote_read_bytes_1) (remote_xfer_live_readonly_partial, remote_read_bytes) (remote_send_printf, remote_flash_write, readchar) (remote_serial_write, putpkt, putpkt_binary, skip_frame) (read_frame, getpkt, getpkt_or_notif_sane_1, getpkt_sane) (getpkt_or_notif_sane, remote_vkill, remote_kill_k) (extended_remote_disable_randomization, extended_remote_run) (send_environment_packet, extended_remote_environment_support) (extended_remote_set_inferior_cwd, remote_write_qxfer) (remote_read_qxfer, push_stop_reply, vcont_r_supported) (packet_command): Now methods of ... (remote_target): ... this class. (m_remote_state) <remote_target>: New field. (struct remote_state) <stop_reply_queue, remote_async_inferior_event_token, wait_forever_enabled_p>: New fields. (remote_state::remote_state): Allocate stop_reply_queue. (remote_state): Delete global. (get_remote_state_raw): Delete. (remote_target::get_remote_state): Allocate m_remote_state on demand. (get_current_remote_target): New. (remote_ops, extended_remote_ops): Delete. (wait_forever_enabled_p, remote_async_inferior_event_token): Delete, moved to struct remote_state. (remote_target::close): Delete self. Destruction bits split to ... (remote_target::~remote_target): ... this. (show_memory_packet_size): Adjust to use get_current_remote_target. (struct protocol_feature) <func>: Add remote_target parameter. All callers adjusted. (curr_quit_handler_target): New. (remote_serial_quit_handler): Reimplement. (remote_target::open_1): Adjust to use get_current_remote_target. Heap-allocate remote_target/extended_remote_target instances. (vcont_builder::vcont_builder): Add remote_target parameter, and save it in m_remote. All callers adjusted. (vcont_builder::m_remote): New field. (vcont_builder::restart, vcont_builder::flush) (vcont_builder::push_action): Use it. (remote_target::commit_resume): Use it. (struct queue_iter_param) <remote>: New field. (remote_target::remove_new_fork_children): Fill in 'remote' field. (check_pending_event_prevents_wildcard_vcont_callback_data): New. (check_pending_event_prevents_wildcard_vcont_callback) (remote_target::check_pending_events_prevent_wildcard_vcont) (remote_target::discard_pending_stop_replies) (remote_target::discard_pending_stop_replies_in_queue) (remote_target::remote_notif_remove_queued_reply): Fill in 'remote' field. (remote_notif_get_pending_events): New. (remote_target::readchar, remote_target::remote_serial_write): Save/restore curr_quit_handler_target. (putpkt): New. (kill_new_fork_children): Fill in 'remote' field. (packet_command): Use get_current_remote_target, defer to remote_target method of same name. (scoped_remote_fd::scoped_remote_fd): Add 'remote_target' parameter, and save it in m_remote. All callers adjusted. (scoped_remote_fd::release): Use m_remote. (scoped_remote_fd::m_remote): New field. (remote_file_put, remote_file_get, remote_file_delete): Use get_current_remote_target, defer to remote_target method of same name. (remote_btrace_reset): Add remote_state paremeter. Update all callers. (remote_async_inferior_event_handler). Pass down 'data'. (remote_new_objfile): Use get_current_remote_target. (remote_target::vcont_r_supported): New. (set_range_stepping): Use get_current_remote_target and remote_target::vcont_r_supported. (_initialize_remote): Don't allocate 'remote_state' and 'stop_reply_queue' globals. * remote.h (struct remote_target): Forward declare. (getpkt, putpkt, remote_notif_get_pending_events): Add 'remote_target' parameter.
2018-05-22 19:22:11 +02:00
int (*can_get_pending_events) (remote_target *remote,
struct notif_client *self);
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
/* Allocate an event. */
notif_event_up (*alloc_event) ();
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
Move pending_event to remote_notif_state. This patch moves pending_event to remote_notif_state. All pending events are destroyed in remote_notif_state_xfree. However, discard_pending_stop_replies release pending event too, so the pending event of stop notification is released twice, we need some refactor here. We add a new function discard_pending_stop_replies_in_queue which only discard events in stop_reply_queue, and let remote_notif_state_xfree release pending event for all notif_client. After this change, discard_pending_stop_replies is only attached to ifnerior_exit observer, so the INF can't be NULL any more. The NULL checking is removed too. gdb: 2013-10-04 Yao Qi <yao@codesourcery.com> * remote-notif.h (REMOTE_NOTIF_ID): New enum. (struct notif_client) <pending_event>: Moved to struct remote_notif_state. <id>: New field. (struct remote_notif_state) <pending_event>: New field. (notif_event_xfree): Declare. * remote-notif.c (handle_notification): Adjust. (notif_event_xfree): New function. (do_notif_event_xfree): Call notif_event_xfree. (remote_notif_state_xfree): Call notif_event_xfree to free each element in field pending_event. * remote.c (discard_pending_stop_replies): Remove declaration. (discard_pending_stop_replies_in_queue): Declare. (remote_close): Call discard_pending_stop_replies_in_queue instead of discard_pending_stop_replies. (remote_start_remote): Adjust. (stop_reply_xfree): Call notif_event_xfree. (notif_client_stop): Adjust initialization. (remote_notif_remove_all): Rename it to ... (remove_stop_reply_for_inferior): ... this. Update comments. Don't check INF is NULL. (discard_pending_stop_replies): Return early if notif_state is NULL. Adjust. Don't check INF is NULL. (remote_notif_get_pending_events): Adjust. (discard_pending_stop_replies_in_queue): New function. (remote_wait_ns): Likewise.
2013-10-04 09:42:06 +02:00
/* Id of this notif_client. */
const enum REMOTE_NOTIF_ID id;
};
/* State on remote async notification. */
struct remote_notif_state
{
remote_notif_state () = default;
~remote_notif_state ();
DISABLE_COPY_AND_ASSIGN (remote_notif_state);
remote: one struct remote_state per struct remote_target 'struct remote_state' today contains per-connection state, however there's only a single global instance of that type. In order to support multiple connections, we must have one such object per connection. Thus this patch eliminates the 'remote_state' global in favor of having a remote_state instance per remote_target instance. The get_remote_state free function is eliminated as well, by making it a remote_target method instead. The patch then fixes the fallout by making all free functions that refer to get_remote_state() directly or indirectly be methods of remote_target too. Likewise, remote-fileio.c and remote-notif.c routines are parameterized with a remote_target pointer too, so they can call into the right remote_target instance. References to the global 'get_remote_state ()->remote_desc' to tell whether the remote target is open (!= nullptr) must be replaced with something else: - Command implementations use a new get_current_remote_target free function. - remote_target::open_1 checks the exception type instead. Finally, remote_target and extended_remote_target are made heap-allocated targets. As with the earlier core target patches, it still won't be possible to have more than one remote_target instance in practice, but this puts us closer. gdb/ChangeLog: 2018-05-22 Pedro Alves <palves@redhat.com> * remote-fileio.c (remote_fileio_reply, remote_fileio_ioerror) (remote_fileio_badfd, remote_fileio_return_errno) (remote_fileio_return_success, remote_fileio_func_open) (remote_fileio_func_open, remote_fileio_func_close) (remote_fileio_func_read, remote_fileio_func_write) (remote_fileio_func_lseek, remote_fileio_func_rename) (remote_fileio_func_unlink, remote_fileio_func_stat) (remote_fileio_func_fstat, remote_fileio_func_gettimeofday) (remote_fileio_func_isatty, remote_fileio_func_system): Add remote_target parameter. (remote_fio_func_map) <func>: Add remote_target parameter. (do_remote_fileio_request, remote_fileio_request): * remote-fileio.h (remote_fileio_request): * remote-notif.c (remote_notif_ack, remote_notif_parse, ): Add remote_target parameter. (remote_notif_process, handle_notification): Adjust to pass down the remote. (remote_notif_state_allocate): Add remote_target parameter. Save it. * remote-notif.h (struct remote_target): Forward declare. (struct notif_client) <parse, ack, can_get_pending_events>: Add remote_target parameter. (struct remote_notif_state) <remote>: New field. (remote_notif_ack, remote_notif_parse): Add remote_target parameter. (remote_notif_state_allocate, remote_notif_state_allocate): Add remote_target parameter. * remote.c (OPAQUETHREADBYTES, threadref, gdb_ext_thread_info) (threads_listing_context, rmt_thread_action, protocol_feature) (packet_reg, stop_reply, stop_reply_p, enum packet_support) (packet_result, struct threads_listing_context, remote_state): Move definitions and declarations higher up. (remote_target) <~remote_target>: Declare. (remote_download_command_source, remote_file_put, remote_file_get) (remote_file_delete, remote_hostio_pread, remote_hostio_pwrite) (remote_hostio_pread_vFile, remote_hostio_send_command) (remote_hostio_set_filesystem, remote_hostio_open) (remote_hostio_close, remote_hostio_unlink, remote_state) (get_remote_state, get_remote_packet_size, get_memory_packet_size) (get_memory_write_packet_size, get_memory_read_packet_size) (append_pending_thread_resumptions, remote_detach_1) (append_resumption, remote_resume_with_vcont) (add_current_inferior_and_thread, wait_ns, wait_as) (process_stop_reply, remote_notice_new_inferior) (process_initial_stop_replies, remote_add_thread) (btrace_sync_conf, remote_btrace_maybe_reopen) (remove_new_fork_children, kill_new_fork_children) (discard_pending_stop_replies, stop_reply_queue_length) (check_pending_events_prevent_wildcard_vcont) (discard_pending_stop_replies_in_queue, stop_reply) (remote_notif_remove_queued_reply, stop_reply *queued_stop_reply) (peek_stop_reply, remote_parse_stop_reply, remote_stop_ns) (remote_interrupt_as, remote_interrupt_ns) (remote_get_noisy_reply, remote_query_attached) (remote_add_inferior, remote_current_thread, get_current_thread) (set_thread, set_general_thread, set_continue_thread) (set_general_process, write_ptid) (remote_unpack_thread_info_response, remote_get_threadinfo) (parse_threadlist_response, remote_get_threadlist) (remote_threadlist_iterator, remote_get_threads_with_ql) (remote_get_threads_with_qxfer) (remote_get_threads_with_qthreadinfo, extended_remote_restart) (get_offsets, remote_check_symbols, remote_supported_packet) (remote_query_supported, remote_packet_size) (remote_serial_quit_handler, remote_detach_pid) (remote_vcont_probe, remote_resume_with_hc) (send_interrupt_sequence, interrupt_query) (remote_notif_get_pending_events, fetch_register_using_p) (send_g_packet, process_g_packet, fetch_registers_using_g) (store_register_using_P, store_registers_using_G) (set_remote_traceframe, check_binary_download) (remote_write_bytes_aux, remote_write_bytes, remote_read_bytes_1) (remote_xfer_live_readonly_partial, remote_read_bytes) (remote_send_printf, remote_flash_write, readchar) (remote_serial_write, putpkt, putpkt_binary, skip_frame) (read_frame, getpkt, getpkt_or_notif_sane_1, getpkt_sane) (getpkt_or_notif_sane, remote_vkill, remote_kill_k) (extended_remote_disable_randomization, extended_remote_run) (send_environment_packet, extended_remote_environment_support) (extended_remote_set_inferior_cwd, remote_write_qxfer) (remote_read_qxfer, push_stop_reply, vcont_r_supported) (packet_command): Now methods of ... (remote_target): ... this class. (m_remote_state) <remote_target>: New field. (struct remote_state) <stop_reply_queue, remote_async_inferior_event_token, wait_forever_enabled_p>: New fields. (remote_state::remote_state): Allocate stop_reply_queue. (remote_state): Delete global. (get_remote_state_raw): Delete. (remote_target::get_remote_state): Allocate m_remote_state on demand. (get_current_remote_target): New. (remote_ops, extended_remote_ops): Delete. (wait_forever_enabled_p, remote_async_inferior_event_token): Delete, moved to struct remote_state. (remote_target::close): Delete self. Destruction bits split to ... (remote_target::~remote_target): ... this. (show_memory_packet_size): Adjust to use get_current_remote_target. (struct protocol_feature) <func>: Add remote_target parameter. All callers adjusted. (curr_quit_handler_target): New. (remote_serial_quit_handler): Reimplement. (remote_target::open_1): Adjust to use get_current_remote_target. Heap-allocate remote_target/extended_remote_target instances. (vcont_builder::vcont_builder): Add remote_target parameter, and save it in m_remote. All callers adjusted. (vcont_builder::m_remote): New field. (vcont_builder::restart, vcont_builder::flush) (vcont_builder::push_action): Use it. (remote_target::commit_resume): Use it. (struct queue_iter_param) <remote>: New field. (remote_target::remove_new_fork_children): Fill in 'remote' field. (check_pending_event_prevents_wildcard_vcont_callback_data): New. (check_pending_event_prevents_wildcard_vcont_callback) (remote_target::check_pending_events_prevent_wildcard_vcont) (remote_target::discard_pending_stop_replies) (remote_target::discard_pending_stop_replies_in_queue) (remote_target::remote_notif_remove_queued_reply): Fill in 'remote' field. (remote_notif_get_pending_events): New. (remote_target::readchar, remote_target::remote_serial_write): Save/restore curr_quit_handler_target. (putpkt): New. (kill_new_fork_children): Fill in 'remote' field. (packet_command): Use get_current_remote_target, defer to remote_target method of same name. (scoped_remote_fd::scoped_remote_fd): Add 'remote_target' parameter, and save it in m_remote. All callers adjusted. (scoped_remote_fd::release): Use m_remote. (scoped_remote_fd::m_remote): New field. (remote_file_put, remote_file_get, remote_file_delete): Use get_current_remote_target, defer to remote_target method of same name. (remote_btrace_reset): Add remote_state paremeter. Update all callers. (remote_async_inferior_event_handler). Pass down 'data'. (remote_new_objfile): Use get_current_remote_target. (remote_target::vcont_r_supported): New. (set_range_stepping): Use get_current_remote_target and remote_target::vcont_r_supported. (_initialize_remote): Don't allocate 'remote_state' and 'stop_reply_queue' globals. * remote.h (struct remote_target): Forward declare. (getpkt, putpkt, remote_notif_get_pending_events): Add 'remote_target' parameter.
2018-05-22 19:22:11 +02:00
/* The remote target. */
remote_target *remote;
/* Notification queue. */
std::list<notif_client *> notif_queue;
/* Asynchronous signal handle registered as event loop source for when
the remote sent us a notification. The registered callback
will do a ACK sequence to pull the rest of the events out of
the remote side into our event queue. */
struct async_event_handler *get_pending_events_token;
Move pending_event to remote_notif_state. This patch moves pending_event to remote_notif_state. All pending events are destroyed in remote_notif_state_xfree. However, discard_pending_stop_replies release pending event too, so the pending event of stop notification is released twice, we need some refactor here. We add a new function discard_pending_stop_replies_in_queue which only discard events in stop_reply_queue, and let remote_notif_state_xfree release pending event for all notif_client. After this change, discard_pending_stop_replies is only attached to ifnerior_exit observer, so the INF can't be NULL any more. The NULL checking is removed too. gdb: 2013-10-04 Yao Qi <yao@codesourcery.com> * remote-notif.h (REMOTE_NOTIF_ID): New enum. (struct notif_client) <pending_event>: Moved to struct remote_notif_state. <id>: New field. (struct remote_notif_state) <pending_event>: New field. (notif_event_xfree): Declare. * remote-notif.c (handle_notification): Adjust. (notif_event_xfree): New function. (do_notif_event_xfree): Call notif_event_xfree. (remote_notif_state_xfree): Call notif_event_xfree to free each element in field pending_event. * remote.c (discard_pending_stop_replies): Remove declaration. (discard_pending_stop_replies_in_queue): Declare. (remote_close): Call discard_pending_stop_replies_in_queue instead of discard_pending_stop_replies. (remote_start_remote): Adjust. (stop_reply_xfree): Call notif_event_xfree. (notif_client_stop): Adjust initialization. (remote_notif_remove_all): Rename it to ... (remove_stop_reply_for_inferior): ... this. Update comments. Don't check INF is NULL. (discard_pending_stop_replies): Return early if notif_state is NULL. Adjust. Don't check INF is NULL. (remote_notif_get_pending_events): Adjust. (discard_pending_stop_replies_in_queue): New function. (remote_wait_ns): Likewise.
2013-10-04 09:42:06 +02:00
/* One pending event for each notification client. This is where we
keep it until it is acknowledged. When there is a notification
packet, parse it, and create an object of 'struct notif_event' to
assign to it. This field is unchanged until GDB starts to ack
this notification (which is done by
remote.c:remote_notif_pending_replies). */
Move pending_event to remote_notif_state. This patch moves pending_event to remote_notif_state. All pending events are destroyed in remote_notif_state_xfree. However, discard_pending_stop_replies release pending event too, so the pending event of stop notification is released twice, we need some refactor here. We add a new function discard_pending_stop_replies_in_queue which only discard events in stop_reply_queue, and let remote_notif_state_xfree release pending event for all notif_client. After this change, discard_pending_stop_replies is only attached to ifnerior_exit observer, so the INF can't be NULL any more. The NULL checking is removed too. gdb: 2013-10-04 Yao Qi <yao@codesourcery.com> * remote-notif.h (REMOTE_NOTIF_ID): New enum. (struct notif_client) <pending_event>: Moved to struct remote_notif_state. <id>: New field. (struct remote_notif_state) <pending_event>: New field. (notif_event_xfree): Declare. * remote-notif.c (handle_notification): Adjust. (notif_event_xfree): New function. (do_notif_event_xfree): Call notif_event_xfree. (remote_notif_state_xfree): Call notif_event_xfree to free each element in field pending_event. * remote.c (discard_pending_stop_replies): Remove declaration. (discard_pending_stop_replies_in_queue): Declare. (remote_close): Call discard_pending_stop_replies_in_queue instead of discard_pending_stop_replies. (remote_start_remote): Adjust. (stop_reply_xfree): Call notif_event_xfree. (notif_client_stop): Adjust initialization. (remote_notif_remove_all): Rename it to ... (remove_stop_reply_for_inferior): ... this. Update comments. Don't check INF is NULL. (discard_pending_stop_replies): Return early if notif_state is NULL. Adjust. Don't check INF is NULL. (remote_notif_get_pending_events): Adjust. (discard_pending_stop_replies_in_queue): New function. (remote_wait_ns): Likewise.
2013-10-04 09:42:06 +02:00
struct notif_event *pending_event[REMOTE_NOTIF_LAST] {};
};
void remote_notif_ack (remote_target *remote, notif_client *nc,
const char *buf);
remote: one struct remote_state per struct remote_target 'struct remote_state' today contains per-connection state, however there's only a single global instance of that type. In order to support multiple connections, we must have one such object per connection. Thus this patch eliminates the 'remote_state' global in favor of having a remote_state instance per remote_target instance. The get_remote_state free function is eliminated as well, by making it a remote_target method instead. The patch then fixes the fallout by making all free functions that refer to get_remote_state() directly or indirectly be methods of remote_target too. Likewise, remote-fileio.c and remote-notif.c routines are parameterized with a remote_target pointer too, so they can call into the right remote_target instance. References to the global 'get_remote_state ()->remote_desc' to tell whether the remote target is open (!= nullptr) must be replaced with something else: - Command implementations use a new get_current_remote_target free function. - remote_target::open_1 checks the exception type instead. Finally, remote_target and extended_remote_target are made heap-allocated targets. As with the earlier core target patches, it still won't be possible to have more than one remote_target instance in practice, but this puts us closer. gdb/ChangeLog: 2018-05-22 Pedro Alves <palves@redhat.com> * remote-fileio.c (remote_fileio_reply, remote_fileio_ioerror) (remote_fileio_badfd, remote_fileio_return_errno) (remote_fileio_return_success, remote_fileio_func_open) (remote_fileio_func_open, remote_fileio_func_close) (remote_fileio_func_read, remote_fileio_func_write) (remote_fileio_func_lseek, remote_fileio_func_rename) (remote_fileio_func_unlink, remote_fileio_func_stat) (remote_fileio_func_fstat, remote_fileio_func_gettimeofday) (remote_fileio_func_isatty, remote_fileio_func_system): Add remote_target parameter. (remote_fio_func_map) <func>: Add remote_target parameter. (do_remote_fileio_request, remote_fileio_request): * remote-fileio.h (remote_fileio_request): * remote-notif.c (remote_notif_ack, remote_notif_parse, ): Add remote_target parameter. (remote_notif_process, handle_notification): Adjust to pass down the remote. (remote_notif_state_allocate): Add remote_target parameter. Save it. * remote-notif.h (struct remote_target): Forward declare. (struct notif_client) <parse, ack, can_get_pending_events>: Add remote_target parameter. (struct remote_notif_state) <remote>: New field. (remote_notif_ack, remote_notif_parse): Add remote_target parameter. (remote_notif_state_allocate, remote_notif_state_allocate): Add remote_target parameter. * remote.c (OPAQUETHREADBYTES, threadref, gdb_ext_thread_info) (threads_listing_context, rmt_thread_action, protocol_feature) (packet_reg, stop_reply, stop_reply_p, enum packet_support) (packet_result, struct threads_listing_context, remote_state): Move definitions and declarations higher up. (remote_target) <~remote_target>: Declare. (remote_download_command_source, remote_file_put, remote_file_get) (remote_file_delete, remote_hostio_pread, remote_hostio_pwrite) (remote_hostio_pread_vFile, remote_hostio_send_command) (remote_hostio_set_filesystem, remote_hostio_open) (remote_hostio_close, remote_hostio_unlink, remote_state) (get_remote_state, get_remote_packet_size, get_memory_packet_size) (get_memory_write_packet_size, get_memory_read_packet_size) (append_pending_thread_resumptions, remote_detach_1) (append_resumption, remote_resume_with_vcont) (add_current_inferior_and_thread, wait_ns, wait_as) (process_stop_reply, remote_notice_new_inferior) (process_initial_stop_replies, remote_add_thread) (btrace_sync_conf, remote_btrace_maybe_reopen) (remove_new_fork_children, kill_new_fork_children) (discard_pending_stop_replies, stop_reply_queue_length) (check_pending_events_prevent_wildcard_vcont) (discard_pending_stop_replies_in_queue, stop_reply) (remote_notif_remove_queued_reply, stop_reply *queued_stop_reply) (peek_stop_reply, remote_parse_stop_reply, remote_stop_ns) (remote_interrupt_as, remote_interrupt_ns) (remote_get_noisy_reply, remote_query_attached) (remote_add_inferior, remote_current_thread, get_current_thread) (set_thread, set_general_thread, set_continue_thread) (set_general_process, write_ptid) (remote_unpack_thread_info_response, remote_get_threadinfo) (parse_threadlist_response, remote_get_threadlist) (remote_threadlist_iterator, remote_get_threads_with_ql) (remote_get_threads_with_qxfer) (remote_get_threads_with_qthreadinfo, extended_remote_restart) (get_offsets, remote_check_symbols, remote_supported_packet) (remote_query_supported, remote_packet_size) (remote_serial_quit_handler, remote_detach_pid) (remote_vcont_probe, remote_resume_with_hc) (send_interrupt_sequence, interrupt_query) (remote_notif_get_pending_events, fetch_register_using_p) (send_g_packet, process_g_packet, fetch_registers_using_g) (store_register_using_P, store_registers_using_G) (set_remote_traceframe, check_binary_download) (remote_write_bytes_aux, remote_write_bytes, remote_read_bytes_1) (remote_xfer_live_readonly_partial, remote_read_bytes) (remote_send_printf, remote_flash_write, readchar) (remote_serial_write, putpkt, putpkt_binary, skip_frame) (read_frame, getpkt, getpkt_or_notif_sane_1, getpkt_sane) (getpkt_or_notif_sane, remote_vkill, remote_kill_k) (extended_remote_disable_randomization, extended_remote_run) (send_environment_packet, extended_remote_environment_support) (extended_remote_set_inferior_cwd, remote_write_qxfer) (remote_read_qxfer, push_stop_reply, vcont_r_supported) (packet_command): Now methods of ... (remote_target): ... this class. (m_remote_state) <remote_target>: New field. (struct remote_state) <stop_reply_queue, remote_async_inferior_event_token, wait_forever_enabled_p>: New fields. (remote_state::remote_state): Allocate stop_reply_queue. (remote_state): Delete global. (get_remote_state_raw): Delete. (remote_target::get_remote_state): Allocate m_remote_state on demand. (get_current_remote_target): New. (remote_ops, extended_remote_ops): Delete. (wait_forever_enabled_p, remote_async_inferior_event_token): Delete, moved to struct remote_state. (remote_target::close): Delete self. Destruction bits split to ... (remote_target::~remote_target): ... this. (show_memory_packet_size): Adjust to use get_current_remote_target. (struct protocol_feature) <func>: Add remote_target parameter. All callers adjusted. (curr_quit_handler_target): New. (remote_serial_quit_handler): Reimplement. (remote_target::open_1): Adjust to use get_current_remote_target. Heap-allocate remote_target/extended_remote_target instances. (vcont_builder::vcont_builder): Add remote_target parameter, and save it in m_remote. All callers adjusted. (vcont_builder::m_remote): New field. (vcont_builder::restart, vcont_builder::flush) (vcont_builder::push_action): Use it. (remote_target::commit_resume): Use it. (struct queue_iter_param) <remote>: New field. (remote_target::remove_new_fork_children): Fill in 'remote' field. (check_pending_event_prevents_wildcard_vcont_callback_data): New. (check_pending_event_prevents_wildcard_vcont_callback) (remote_target::check_pending_events_prevent_wildcard_vcont) (remote_target::discard_pending_stop_replies) (remote_target::discard_pending_stop_replies_in_queue) (remote_target::remote_notif_remove_queued_reply): Fill in 'remote' field. (remote_notif_get_pending_events): New. (remote_target::readchar, remote_target::remote_serial_write): Save/restore curr_quit_handler_target. (putpkt): New. (kill_new_fork_children): Fill in 'remote' field. (packet_command): Use get_current_remote_target, defer to remote_target method of same name. (scoped_remote_fd::scoped_remote_fd): Add 'remote_target' parameter, and save it in m_remote. All callers adjusted. (scoped_remote_fd::release): Use m_remote. (scoped_remote_fd::m_remote): New field. (remote_file_put, remote_file_get, remote_file_delete): Use get_current_remote_target, defer to remote_target method of same name. (remote_btrace_reset): Add remote_state paremeter. Update all callers. (remote_async_inferior_event_handler). Pass down 'data'. (remote_new_objfile): Use get_current_remote_target. (remote_target::vcont_r_supported): New. (set_range_stepping): Use get_current_remote_target and remote_target::vcont_r_supported. (_initialize_remote): Don't allocate 'remote_state' and 'stop_reply_queue' globals. * remote.h (struct remote_target): Forward declare. (getpkt, putpkt, remote_notif_get_pending_events): Add 'remote_target' parameter.
2018-05-22 19:22:11 +02:00
struct notif_event *remote_notif_parse (remote_target *remote,
notif_client *nc,
const char *buf);
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
void handle_notification (struct remote_notif_state *notif_state,
const char *buf);
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
void remote_notif_process (struct remote_notif_state *state,
struct notif_client *except);
remote: one struct remote_state per struct remote_target 'struct remote_state' today contains per-connection state, however there's only a single global instance of that type. In order to support multiple connections, we must have one such object per connection. Thus this patch eliminates the 'remote_state' global in favor of having a remote_state instance per remote_target instance. The get_remote_state free function is eliminated as well, by making it a remote_target method instead. The patch then fixes the fallout by making all free functions that refer to get_remote_state() directly or indirectly be methods of remote_target too. Likewise, remote-fileio.c and remote-notif.c routines are parameterized with a remote_target pointer too, so they can call into the right remote_target instance. References to the global 'get_remote_state ()->remote_desc' to tell whether the remote target is open (!= nullptr) must be replaced with something else: - Command implementations use a new get_current_remote_target free function. - remote_target::open_1 checks the exception type instead. Finally, remote_target and extended_remote_target are made heap-allocated targets. As with the earlier core target patches, it still won't be possible to have more than one remote_target instance in practice, but this puts us closer. gdb/ChangeLog: 2018-05-22 Pedro Alves <palves@redhat.com> * remote-fileio.c (remote_fileio_reply, remote_fileio_ioerror) (remote_fileio_badfd, remote_fileio_return_errno) (remote_fileio_return_success, remote_fileio_func_open) (remote_fileio_func_open, remote_fileio_func_close) (remote_fileio_func_read, remote_fileio_func_write) (remote_fileio_func_lseek, remote_fileio_func_rename) (remote_fileio_func_unlink, remote_fileio_func_stat) (remote_fileio_func_fstat, remote_fileio_func_gettimeofday) (remote_fileio_func_isatty, remote_fileio_func_system): Add remote_target parameter. (remote_fio_func_map) <func>: Add remote_target parameter. (do_remote_fileio_request, remote_fileio_request): * remote-fileio.h (remote_fileio_request): * remote-notif.c (remote_notif_ack, remote_notif_parse, ): Add remote_target parameter. (remote_notif_process, handle_notification): Adjust to pass down the remote. (remote_notif_state_allocate): Add remote_target parameter. Save it. * remote-notif.h (struct remote_target): Forward declare. (struct notif_client) <parse, ack, can_get_pending_events>: Add remote_target parameter. (struct remote_notif_state) <remote>: New field. (remote_notif_ack, remote_notif_parse): Add remote_target parameter. (remote_notif_state_allocate, remote_notif_state_allocate): Add remote_target parameter. * remote.c (OPAQUETHREADBYTES, threadref, gdb_ext_thread_info) (threads_listing_context, rmt_thread_action, protocol_feature) (packet_reg, stop_reply, stop_reply_p, enum packet_support) (packet_result, struct threads_listing_context, remote_state): Move definitions and declarations higher up. (remote_target) <~remote_target>: Declare. (remote_download_command_source, remote_file_put, remote_file_get) (remote_file_delete, remote_hostio_pread, remote_hostio_pwrite) (remote_hostio_pread_vFile, remote_hostio_send_command) (remote_hostio_set_filesystem, remote_hostio_open) (remote_hostio_close, remote_hostio_unlink, remote_state) (get_remote_state, get_remote_packet_size, get_memory_packet_size) (get_memory_write_packet_size, get_memory_read_packet_size) (append_pending_thread_resumptions, remote_detach_1) (append_resumption, remote_resume_with_vcont) (add_current_inferior_and_thread, wait_ns, wait_as) (process_stop_reply, remote_notice_new_inferior) (process_initial_stop_replies, remote_add_thread) (btrace_sync_conf, remote_btrace_maybe_reopen) (remove_new_fork_children, kill_new_fork_children) (discard_pending_stop_replies, stop_reply_queue_length) (check_pending_events_prevent_wildcard_vcont) (discard_pending_stop_replies_in_queue, stop_reply) (remote_notif_remove_queued_reply, stop_reply *queued_stop_reply) (peek_stop_reply, remote_parse_stop_reply, remote_stop_ns) (remote_interrupt_as, remote_interrupt_ns) (remote_get_noisy_reply, remote_query_attached) (remote_add_inferior, remote_current_thread, get_current_thread) (set_thread, set_general_thread, set_continue_thread) (set_general_process, write_ptid) (remote_unpack_thread_info_response, remote_get_threadinfo) (parse_threadlist_response, remote_get_threadlist) (remote_threadlist_iterator, remote_get_threads_with_ql) (remote_get_threads_with_qxfer) (remote_get_threads_with_qthreadinfo, extended_remote_restart) (get_offsets, remote_check_symbols, remote_supported_packet) (remote_query_supported, remote_packet_size) (remote_serial_quit_handler, remote_detach_pid) (remote_vcont_probe, remote_resume_with_hc) (send_interrupt_sequence, interrupt_query) (remote_notif_get_pending_events, fetch_register_using_p) (send_g_packet, process_g_packet, fetch_registers_using_g) (store_register_using_P, store_registers_using_G) (set_remote_traceframe, check_binary_download) (remote_write_bytes_aux, remote_write_bytes, remote_read_bytes_1) (remote_xfer_live_readonly_partial, remote_read_bytes) (remote_send_printf, remote_flash_write, readchar) (remote_serial_write, putpkt, putpkt_binary, skip_frame) (read_frame, getpkt, getpkt_or_notif_sane_1, getpkt_sane) (getpkt_or_notif_sane, remote_vkill, remote_kill_k) (extended_remote_disable_randomization, extended_remote_run) (send_environment_packet, extended_remote_environment_support) (extended_remote_set_inferior_cwd, remote_write_qxfer) (remote_read_qxfer, push_stop_reply, vcont_r_supported) (packet_command): Now methods of ... (remote_target): ... this class. (m_remote_state) <remote_target>: New field. (struct remote_state) <stop_reply_queue, remote_async_inferior_event_token, wait_forever_enabled_p>: New fields. (remote_state::remote_state): Allocate stop_reply_queue. (remote_state): Delete global. (get_remote_state_raw): Delete. (remote_target::get_remote_state): Allocate m_remote_state on demand. (get_current_remote_target): New. (remote_ops, extended_remote_ops): Delete. (wait_forever_enabled_p, remote_async_inferior_event_token): Delete, moved to struct remote_state. (remote_target::close): Delete self. Destruction bits split to ... (remote_target::~remote_target): ... this. (show_memory_packet_size): Adjust to use get_current_remote_target. (struct protocol_feature) <func>: Add remote_target parameter. All callers adjusted. (curr_quit_handler_target): New. (remote_serial_quit_handler): Reimplement. (remote_target::open_1): Adjust to use get_current_remote_target. Heap-allocate remote_target/extended_remote_target instances. (vcont_builder::vcont_builder): Add remote_target parameter, and save it in m_remote. All callers adjusted. (vcont_builder::m_remote): New field. (vcont_builder::restart, vcont_builder::flush) (vcont_builder::push_action): Use it. (remote_target::commit_resume): Use it. (struct queue_iter_param) <remote>: New field. (remote_target::remove_new_fork_children): Fill in 'remote' field. (check_pending_event_prevents_wildcard_vcont_callback_data): New. (check_pending_event_prevents_wildcard_vcont_callback) (remote_target::check_pending_events_prevent_wildcard_vcont) (remote_target::discard_pending_stop_replies) (remote_target::discard_pending_stop_replies_in_queue) (remote_target::remote_notif_remove_queued_reply): Fill in 'remote' field. (remote_notif_get_pending_events): New. (remote_target::readchar, remote_target::remote_serial_write): Save/restore curr_quit_handler_target. (putpkt): New. (kill_new_fork_children): Fill in 'remote' field. (packet_command): Use get_current_remote_target, defer to remote_target method of same name. (scoped_remote_fd::scoped_remote_fd): Add 'remote_target' parameter, and save it in m_remote. All callers adjusted. (scoped_remote_fd::release): Use m_remote. (scoped_remote_fd::m_remote): New field. (remote_file_put, remote_file_get, remote_file_delete): Use get_current_remote_target, defer to remote_target method of same name. (remote_btrace_reset): Add remote_state paremeter. Update all callers. (remote_async_inferior_event_handler). Pass down 'data'. (remote_new_objfile): Use get_current_remote_target. (remote_target::vcont_r_supported): New. (set_range_stepping): Use get_current_remote_target and remote_target::vcont_r_supported. (_initialize_remote): Don't allocate 'remote_state' and 'stop_reply_queue' globals. * remote.h (struct remote_target): Forward declare. (getpkt, putpkt, remote_notif_get_pending_events): Add 'remote_target' parameter.
2018-05-22 19:22:11 +02:00
remote_notif_state *remote_notif_state_allocate (remote_target *remote);
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
extern struct notif_client notif_client_stop;
Change boolean options to bool instead of int This is for add_setshow_boolean_cmd as well as the gdb::option interface. gdb/ChangeLog: 2019-09-17 Christian Biesinger <cbiesinger@google.com> * ada-lang.c (ada_ignore_descriptive_types_p): Change to bool. (print_signatures): Likewise. (trust_pad_over_xvs): Likewise. * arch/aarch64-insn.c (aarch64_debug): Likewise. * arch/aarch64-insn.h (aarch64_debug): Likewise. * arm-linux-nat.c (arm_apcs_32): Likewise. * arm-linux-tdep.c (arm_apcs_32): Likewise. * arm-nbsd-nat.c (arm_apcs_32): Likewise. * arm-tdep.c (arm_debug): Likewise. (arm_apcs_32): Likewise. * auto-load.c (debug_auto_load): Likewise. (auto_load_gdb_scripts): Likewise. (global_auto_load): Likewise. (auto_load_local_gdbinit): Likewise. (auto_load_local_gdbinit_loaded): Likewise. * auto-load.h (global_auto_load): Likewise. (auto_load_local_gdbinit): Likewise. (auto_load_local_gdbinit_loaded): Likewise. * breakpoint.c (disconnected_dprintf): Likewise. (breakpoint_proceeded): Likewise. (automatic_hardware_breakpoints): Likewise. (always_inserted_mode): Likewise. (target_exact_watchpoints): Likewise. (_initialize_breakpoint): Update. * breakpoint.h (target_exact_watchpoints): Change to bool. * btrace.c (maint_btrace_pt_skip_pad): Likewise. * cli/cli-cmds.c (trace_commands): Likewise. * cli/cli-cmds.h (trace_commands): Likewise. * cli/cli-decode.c (add_setshow_boolean_cmd): Change int* argument to bool*. * cli/cli-logging.c (logging_overwrite): Change to bool. (logging_redirect): Likewise. (debug_redirect): Likewise. * cli/cli-option.h (option_def) <boolean>: Change return type to bool*. (struct boolean_option_def) <get_var_address_cb_>: Change return type to bool. <boolean_option_def>: Update. (struct flag_option_def): Change default type of Context to bool from int. <flag_option_def>: Change return type of var_address_cb_ to bool*. * cli/cli-setshow.c (do_set_command): Cast to bool* instead of int*. (get_setshow_command_value_string): Likewise. * cli/cli-style.c (cli_styling): Change to bool. (source_styling): Likewise. * cli/cli-style.h (source_styling): Likewise. (cli_styling): Likewise. * cli/cli-utils.h (struct qcs_flags) <quiet, cont, silent>: Change to bool. * command.h (var_types): Update comment. (add_setshow_boolean_cmd): Change int* var argument to bool*. * compile/compile-cplus-types.c (debug_compile_cplus_types): Change to bool. (debug_compile_cplus_scopes): Likewise. * compile/compile-internal.h (compile_debug): Likewise. * compile/compile.c (compile_debug): Likewise. (struct compile_options) <raw>: Likewise. * cp-support.c (catch_demangler_crashes): Likewise. * cris-tdep.c (usr_cmd_cris_version_valid): Likewise. (usr_cmd_cris_dwarf2_cfi): Likewise. * csky-tdep.c (csky_debug): Likewise. * darwin-nat.c (enable_mach_exceptions): Likewise. * dcache.c (dcache_enabled_p): Likewise. * defs.h (info_verbose): Likewise. * demangle.c (demangle): Likewise. (asm_demangle): Likewise. * dwarf-index-cache.c (debug_index_cache): Likewise. * dwarf2-frame.c (dwarf2_frame_unwinders_enabled_p): Likewise. * dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Likewise. * dwarf2read.c (check_physname): Likewise. (use_deprecated_index_sections): Likewise. (dwarf_always_disassemble): Likewise. * eval.c (overload_resolution): Likewise. * event-top.c (set_editing_cmd_var): Likewise. (exec_done_display_p): Likewise. * event-top.h (set_editing_cmd_var): Likewise. (exec_done_display_p): Likewise. * exec.c (write_files): Likewise. * fbsd-nat.c (debug_fbsd_lwp): Likewise (debug_fbsd_nat): Likewise. * frame.h (struct frame_print_options) <print_raw_frame_arguments>: Likewise. (struct set_backtrace_options) <backtrace_past_main>: Likewise. <backtrace_past_entry> Likewise. * gdb-demangle.h (demangle): Likewise. (asm_demangle): Likewise. * gdb_bfd.c (bfd_sharing): Likewise. * gdbcore.h (write_files): Likewise. * gdbsupport/common-debug.c (show_debug_regs): Likewise. * gdbsupport/common-debug.h (show_debug_regs): Likewise. * gdbthread.h (print_thread_events): Likewise. * gdbtypes.c (opaque_type_resolution): Likewise. (strict_type_checking): Likewise. * gnu-nat.c (gnu_debug_flag): Likewise. * guile/scm-auto-load.c (auto_load_guile_scripts): Likewise. * guile/scm-param.c (pascm_variable): Add boolval. (add_setshow_generic): Update. (pascm_param_value): Update. (pascm_set_param_value_x): Update. * hppa-tdep.c (hppa_debug): Change to bool.. * infcall.c (may_call_functions_p): Likewise. (coerce_float_to_double_p): Likewise. (unwind_on_signal_p): Likewise. (unwind_on_terminating_exception_p): Likewise. * infcmd.c (startup_with_shell): Likewise. * inferior.c (print_inferior_events): Likewise. * inferior.h (startup_with_shell): Likewise. (print_inferior_events): Likewise. * infrun.c (step_stop_if_no_debug): Likewise. (detach_fork): Likewise. (debug_displaced): Likewise. (disable_randomization): Likewise. (non_stop): Likewise. (non_stop_1): Likewise. (observer_mode): Likewise. (observer_mode_1): Likewise. (set_observer_mode): Update. (sched_multi): Change to bool. * infrun.h (debug_displaced): Likewise. (sched_multi): Likewise. (step_stop_if_no_debug): Likewise. (non_stop): Likewise. (disable_randomization): Likewise. * linux-tdep.c (use_coredump_filter): Likewise. (dump_excluded_mappings): Likewise. * linux-thread-db.c (auto_load_thread_db): Likewise. (check_thread_db_on_load): Likewise. * main.c (captured_main_1): Update. * maint-test-options.c (struct test_options_opts) <flag_opt, xx1_opt, xx2_opt, boolean_opt>: Change to bool. * maint-test-settings.c (maintenance_test_settings_boolean): Likewise. * maint.c (maintenance_profile_p): Likewise. (per_command_time): Likewise. (per_command_space): Likewise. (per_command_symtab): Likewise. * memattr.c (inaccessible_by_default): Likewise. * mi/mi-main.c (mi_async): Likewise. (mi_async_1): Likewise. * mips-tdep.c (mips64_transfers_32bit_regs_p): Likewise. * nat/fork-inferior.h (startup_with_shell): Likewise. * nat/linux-namespaces.c (debug_linux_namespaces): Likewise. * nat/linux-namespaces.h (debug_linux_namespaces): Likewise. * nios2-tdep.c (nios2_debug): Likewise. * or1k-tdep.c (or1k_debug): Likewise. * parse.c (parser_debug): Likewise. * parser-defs.h (parser_debug): Likewise. * printcmd.c (print_symbol_filename): Likewise. * proc-api.c (procfs_trace): Likewise. * python/py-auto-load.c (auto_load_python_scripts): Likewise. * python/py-param.c (union parmpy_variable): Add "bool boolval" field. (set_parameter_value): Update. (add_setshow_generic): Update. * python/py-value.c (copy_py_bool_obj): Change argument from int* to bool*. * python/python.c (gdbpy_parameter_value): Cast to bool* instead of int*. * ravenscar-thread.c (ravenscar_task_support): Change to bool. * record-btrace.c (record_btrace_target::store_registers): Update. * record-full.c (record_full_memory_query): Change to bool. (record_full_stop_at_limit): Likewise. * record-full.h (record_full_memory_query): Likewise. * remote-notif.c (notif_debug): Likewise. * remote-notif.h (notif_debug): Likewise. * remote.c (use_range_stepping): Likewise. (interrupt_on_connect): Likewise. (remote_break): Likewise. * ser-tcp.c (tcp_auto_retry): Likewise. * ser-unix.c (serial_hwflow): Likewise. * skip.c (debug_skip): Likewise. * solib-aix.c (solib_aix_debug): Likewise. * spu-tdep.c (spu_stop_on_load_p): Likewise. (spu_auto_flush_cache_p): Likewise. * stack.c (struct backtrace_cmd_options) <full, no_filters, hide>: Likewise. (struct info_print_options) <quiet>: Likewise. * symfile-debug.c (debug_symfile): Likewise. * symfile.c (auto_solib_add): Likewise. (separate_debug_file_debug): Likewise. * symfile.h (auto_solib_add): Likewise. (separate_debug_file_debug): Likewise. * symtab.c (basenames_may_differ): Likewise. (struct filename_partial_match_opts) <dirname, basename>: Likewise. (struct info_print_options) <quiet, exclude_minsyms>: Likewise. (struct info_types_options) <quiet>: Likewise. * symtab.h (demangle): Likewise. (basenames_may_differ): Likewise. * target-dcache.c (stack_cache_enabled_1): Likewise. (code_cache_enabled_1): Likewise. * target.c (trust_readonly): Likewise. (may_write_registers): Likewise. (may_write_memory): Likewise. (may_insert_breakpoints): Likewise. (may_insert_tracepoints): Likewise. (may_insert_fast_tracepoints): Likewise. (may_stop): Likewise. (auto_connect_native_target): Likewise. (target_stop_and_wait): Update. (target_async_permitted): Change to bool. (target_async_permitted_1): Likewise. (may_write_registers_1): Likewise. (may_write_memory_1): Likewise. (may_insert_breakpoints_1): Likewise. (may_insert_tracepoints_1): Likewise. (may_insert_fast_tracepoints_1): Likewise. (may_stop_1): Likewise. * target.h (target_async_permitted): Likewise. (may_write_registers): Likewise. (may_write_memory): Likewise. (may_insert_breakpoints): Likewise. (may_insert_tracepoints): Likewise. (may_insert_fast_tracepoints): Likewise. (may_stop): Likewise. * thread.c (struct info_threads_opts) <show_global_ids>: Likewise. (make_thread_apply_all_options_def_group): Change argument from int* to bool*. (thread_apply_all_command): Update. (print_thread_events): Change to bool. * top.c (confirm): Likewise. (command_editing_p): Likewise. (history_expansion_p): Likewise. (write_history_p): Likewise. (info_verbose): Likewise. * top.h (confirm): Likewise. (history_expansion_p): Likewise. * tracepoint.c (disconnected_tracing): Likewise. (circular_trace_buffer): Likewise. * typeprint.c (print_methods): Likewise. (print_typedefs): Likewise. * utils.c (debug_timestamp): Likewise. (sevenbit_strings): Likewise. (pagination_enabled): Likewise. * utils.h (sevenbit_strings): Likewise. (pagination_enabled): Likewise. * valops.c (overload_resolution): Likewise. * valprint.h (struct value_print_options) <prettyformat_arrays, prettyformat_structs, vtblprint, unionprint, addressprint, objectprint, stop_print_at_null, print_array_indexes, deref_ref, static_field_print, pascal_static_field_print, raw, summary, symbol_print, finish_print>: Likewise. * windows-nat.c (new_console): Likewise. (cygwin_exceptions): Likewise. (new_group): Likewise. (debug_exec): Likewise. (debug_events): Likewise. (debug_memory): Likewise. (debug_exceptions): Likewise. (useshell): Likewise. * windows-tdep.c (maint_display_all_tib): Likewise. * xml-support.c (debug_xml): Likewise.
2019-09-14 21:36:58 +02:00
extern bool notif_debug;
gdb/ 2012-12-15 Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add "remote-notif.o". (SFILES): Add "remote-notif.c". (HFILES_NO_SRCDIR): Add "remote-notif.h" and "common/queue.h". * remote-notif.c: New. Factored out from remote.c. * remote-notif.h: New. * remote.c: Include "remote-notif.h". (stop_reply_xmalloc, do_stop_reply_xfree): (remote_parse_stop_reply, remote_get_pending_stop_replies): (remote_async_get_pending_events_handler): Remove declarations. (remote_parse_stop_reply): Declare. (pending_stop_reply): Remove. (remote_async_get_pending_events_token): Move to remote-notif.c. (remote_close): Replace 'delete_async_event_handler' with remote_notif_unregister_async_event_handler. Don't call discard_pending_stop_replies. (remote_start_remote): Replace code with remote_notif_parse and remote_notif_get_pending_replies. (remote_open_1): Replace 'create_async_event_handler' with remote_notif_register_async_event_handler. (extended_remote_attach_1): Call remote_notif_parse and notif_stop_reply_push. (struct stop_reply) <next>: Remove. <base>: New field. Callers update. (stop_reply_queue): Change its type. (stop_reply_xmalloc, do_stop_reply_xfree): Remove. (remote_notif_remove_all): New. (discard_pending_stop_replies): Update. (remote_notif_stop_ack, stop_reply_dtr): New. (remote_notif_stop_alloc_event): New. (notif_client_stop): New variable. (stop_reply_match_ptid, stop_reply_match_ptid_and_ws: New. (queued_stop_reply, peek_stop_reply): Adjust. (remote_get_pending_stop_replies): Rename to remote_notif_get_pending_events. (handle_notification): Move to remote-notif.c. (remote_async_get_pending_events_handler): Likewise. (remote_wait_as): Adjust to call remote_notif_parse. Call 'getpkt_or_notif_sane' instead of 'getpkt_sane'. Return minus_one_ptid early if gets a notification. (remote_wait): Call QUEUE_is_empty (notif_reply_p). (_initialize_remote): Call QUEUE_alloc. Update caller. (remote_resume): Call 'remote_notif_process' in all-stop mode. * remote.h: Include "remote-notif.h". (remote_notif_get_pending_replies): Declare.
2012-12-15 04:50:22 +01:00
#endif /* REMOTE_NOTIF_H */