Constify notif_client
It seems to me that a notif_client is read-only, so this patch changes the code to use "const" everywhere.
This commit is contained in:
parent
5a5319833d
commit
42938c1a5b
4 changed files with 26 additions and 26 deletions
|
@ -46,7 +46,7 @@ bool notif_debug = false;
|
|||
|
||||
/* Supported clients of notifications. */
|
||||
|
||||
static struct notif_client *notifs[] =
|
||||
static const notif_client *const notifs[] =
|
||||
{
|
||||
¬if_client_stop,
|
||||
};
|
||||
|
@ -58,7 +58,7 @@ gdb_static_assert (ARRAY_SIZE (notifs) == REMOTE_NOTIF_LAST);
|
|||
|
||||
void
|
||||
remote_notif_ack (remote_target *remote,
|
||||
struct notif_client *nc, const char *buf)
|
||||
const notif_client *nc, const char *buf)
|
||||
{
|
||||
notif_event_up event = nc->alloc_event ();
|
||||
|
||||
|
@ -74,7 +74,7 @@ remote_notif_ack (remote_target *remote,
|
|||
|
||||
struct notif_event *
|
||||
remote_notif_parse (remote_target *remote,
|
||||
struct notif_client *nc, const char *buf)
|
||||
const notif_client *nc, const char *buf)
|
||||
{
|
||||
notif_event_up event = nc->alloc_event ();
|
||||
|
||||
|
@ -91,11 +91,11 @@ remote_notif_parse (remote_target *remote,
|
|||
|
||||
void
|
||||
remote_notif_process (struct remote_notif_state *state,
|
||||
struct notif_client *except)
|
||||
const notif_client *except)
|
||||
{
|
||||
while (!state->notif_queue.empty ())
|
||||
{
|
||||
struct notif_client *nc = state->notif_queue.front ();
|
||||
const notif_client *nc = state->notif_queue.front ();
|
||||
state->notif_queue.pop_front ();
|
||||
|
||||
gdb_assert (nc != except);
|
||||
|
@ -120,7 +120,7 @@ remote_async_get_pending_events_handler (gdb_client_data data)
|
|||
void
|
||||
handle_notification (struct remote_notif_state *state, const char *buf)
|
||||
{
|
||||
struct notif_client *nc;
|
||||
const notif_client *nc;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE (notifs); i++)
|
||||
|
|
|
@ -60,19 +60,19 @@ struct notif_client
|
|||
function may throw exception if contents in BUF is not the
|
||||
expected event. */
|
||||
void (*parse) (remote_target *remote,
|
||||
struct notif_client *self, const char *buf,
|
||||
const notif_client *self, const char *buf,
|
||||
struct notif_event *event);
|
||||
|
||||
/* Send field <ack_command> to remote, and do some checking. If
|
||||
something wrong, throw an exception. */
|
||||
void (*ack) (remote_target *remote,
|
||||
struct notif_client *self, const char *buf,
|
||||
const notif_client *self, const char *buf,
|
||||
struct notif_event *event);
|
||||
|
||||
/* Check this notification client can get pending events in
|
||||
'remote_notif_process'. */
|
||||
int (*can_get_pending_events) (remote_target *remote,
|
||||
struct notif_client *self);
|
||||
const notif_client *self);
|
||||
|
||||
/* Allocate an event. */
|
||||
notif_event_up (*alloc_event) ();
|
||||
|
@ -95,7 +95,7 @@ struct remote_notif_state
|
|||
|
||||
/* Notification queue. */
|
||||
|
||||
std::list<notif_client *> notif_queue;
|
||||
std::list<const notif_client *> notif_queue;
|
||||
|
||||
/* Asynchronous signal handle registered as event loop source for when
|
||||
the remote sent us a notification. The registered callback
|
||||
|
@ -114,20 +114,20 @@ struct remote_notif_state
|
|||
struct notif_event *pending_event[REMOTE_NOTIF_LAST] {};
|
||||
};
|
||||
|
||||
void remote_notif_ack (remote_target *remote, notif_client *nc,
|
||||
void remote_notif_ack (remote_target *remote, const notif_client *nc,
|
||||
const char *buf);
|
||||
struct notif_event *remote_notif_parse (remote_target *remote,
|
||||
notif_client *nc,
|
||||
const notif_client *nc,
|
||||
const char *buf);
|
||||
|
||||
void handle_notification (struct remote_notif_state *notif_state,
|
||||
const char *buf);
|
||||
|
||||
void remote_notif_process (struct remote_notif_state *state,
|
||||
struct notif_client *except);
|
||||
const notif_client *except);
|
||||
remote_notif_state *remote_notif_state_allocate (remote_target *remote);
|
||||
|
||||
extern struct notif_client notif_client_stop;
|
||||
extern const notif_client notif_client_stop;
|
||||
|
||||
extern bool notif_debug;
|
||||
|
||||
|
|
22
gdb/remote.c
22
gdb/remote.c
|
@ -844,7 +844,7 @@ public: /* Remote specific methods. */
|
|||
void send_interrupt_sequence ();
|
||||
void interrupt_query ();
|
||||
|
||||
void remote_notif_get_pending_events (notif_client *nc);
|
||||
void remote_notif_get_pending_events (const notif_client *nc);
|
||||
|
||||
int fetch_register_using_p (struct regcache *regcache,
|
||||
packet_reg *reg);
|
||||
|
@ -4995,7 +4995,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
|
|||
mechanism. */
|
||||
if (strcmp (rs->buf.data (), "OK") != 0)
|
||||
{
|
||||
struct notif_client *notif = ¬if_client_stop;
|
||||
const notif_client *notif = ¬if_client_stop;
|
||||
|
||||
/* remote_notif_get_pending_replies acks this one, and gets
|
||||
the rest out. */
|
||||
|
@ -7219,7 +7219,7 @@ remote_target::stop_reply_queue_length ()
|
|||
|
||||
static void
|
||||
remote_notif_stop_parse (remote_target *remote,
|
||||
struct notif_client *self, const char *buf,
|
||||
const notif_client *self, const char *buf,
|
||||
struct notif_event *event)
|
||||
{
|
||||
remote->remote_parse_stop_reply (buf, (struct stop_reply *) event);
|
||||
|
@ -7227,7 +7227,7 @@ remote_notif_stop_parse (remote_target *remote,
|
|||
|
||||
static void
|
||||
remote_notif_stop_ack (remote_target *remote,
|
||||
struct notif_client *self, const char *buf,
|
||||
const notif_client *self, const char *buf,
|
||||
struct notif_event *event)
|
||||
{
|
||||
struct stop_reply *stop_reply = (struct stop_reply *) event;
|
||||
|
@ -7244,7 +7244,7 @@ remote_notif_stop_ack (remote_target *remote,
|
|||
|
||||
static int
|
||||
remote_notif_stop_can_get_pending_events (remote_target *remote,
|
||||
struct notif_client *self)
|
||||
const notif_client *self)
|
||||
{
|
||||
/* We can't get pending events in remote_notif_process for
|
||||
notification stop, and we have to do this in remote_wait_ns
|
||||
|
@ -7270,7 +7270,7 @@ remote_notif_stop_alloc_reply ()
|
|||
|
||||
/* A client of notification Stop. */
|
||||
|
||||
struct notif_client notif_client_stop =
|
||||
const notif_client notif_client_stop =
|
||||
{
|
||||
"Stop",
|
||||
"vStopped",
|
||||
|
@ -7290,7 +7290,7 @@ struct notif_client notif_client_stop =
|
|||
void
|
||||
remote_target::remove_new_fork_children (threads_listing_context *context)
|
||||
{
|
||||
struct notif_client *notif = ¬if_client_stop;
|
||||
const notif_client *notif = ¬if_client_stop;
|
||||
|
||||
/* For any threads stopped at a fork event, remove the corresponding
|
||||
fork child threads from the CONTEXT list. */
|
||||
|
@ -7326,7 +7326,7 @@ void
|
|||
remote_target::check_pending_events_prevent_wildcard_vcont
|
||||
(bool *may_global_wildcard)
|
||||
{
|
||||
struct notif_client *notif = ¬if_client_stop;
|
||||
const notif_client *notif = ¬if_client_stop;
|
||||
|
||||
remote_notif_get_pending_events (notif);
|
||||
for (auto &event : get_remote_state ()->stop_reply_queue)
|
||||
|
@ -7896,7 +7896,7 @@ Packet: '%s'\n"),
|
|||
*/
|
||||
|
||||
void
|
||||
remote_target::remote_notif_get_pending_events (notif_client *nc)
|
||||
remote_target::remote_notif_get_pending_events (const notif_client *nc)
|
||||
{
|
||||
struct remote_state *rs = get_remote_state ();
|
||||
|
||||
|
@ -7934,7 +7934,7 @@ remote_target::remote_notif_get_pending_events (notif_client *nc)
|
|||
avoid having to export the whole remote_target class. */
|
||||
|
||||
void
|
||||
remote_notif_get_pending_events (remote_target *remote, notif_client *nc)
|
||||
remote_notif_get_pending_events (remote_target *remote, const notif_client *nc)
|
||||
{
|
||||
remote->remote_notif_get_pending_events (nc);
|
||||
}
|
||||
|
@ -10058,7 +10058,7 @@ void
|
|||
remote_target::kill_new_fork_children (inferior *inf)
|
||||
{
|
||||
remote_state *rs = get_remote_state ();
|
||||
struct notif_client *notif = ¬if_client_stop;
|
||||
const notif_client *notif = ¬if_client_stop;
|
||||
|
||||
/* Kill the fork child threads of any threads in inferior INF that are stopped
|
||||
at a fork event. */
|
||||
|
|
|
@ -78,7 +78,7 @@ extern int remote_register_number_and_offset (struct gdbarch *gdbarch,
|
|||
int *poffset);
|
||||
|
||||
extern void remote_notif_get_pending_events (remote_target *remote,
|
||||
struct notif_client *np);
|
||||
const notif_client *np);
|
||||
extern bool remote_target_is_non_stop_p (remote_target *t);
|
||||
|
||||
/* An abstract class that represents the set of callbacks that are made
|
||||
|
|
Loading…
Add table
Reference in a new issue