From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id F3C223858D1E for ; Tue, 19 Jul 2022 19:31:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F3C223858D1E Received: by mail-il1-x12f.google.com with SMTP id w1so1180309ilj.9 for ; Tue, 19 Jul 2022 12:31:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/HvOjZKgR8ighQXsBTamkOGaDdtdcAhKEwz7jQwpgxo=; b=Z25JPCbQo7tzR6x+SoCbOPXUsejJ4Nbw8AtiDPPL4MWC7z2rJwE/nf24ZHnxGoJ9aO eT0DQBKKVLCDeyrha6q7IBR1HA5IcD5nm8qcb7sKHkBqk8Rl2le2pZnGFmm+hDbuPJQT ztTdZN7OpF/Vcu8ZH4z/B12gO5MBoc2rrV/3Y5CgnMtDjpLecuvyNZIWOE1dlA8SF7wG RoHnk8L5SIzseXDvpjkneMJyXNc74C3COuceEYS9DeYtZXIK/SHp3qA2u8eJ/lA+7PlL LF3V2vgbruHPcdRjsSMgjNFJ3o7hs1gN7gwIW3PY0QClrz4pXljeYdR/1G+8VKRnL5z2 kMcw== X-Gm-Message-State: AJIora/7scbvhJZ3cCxqromZHSi3pDq3JonVP5Zsudp1IsgbBQGM1nMf JHbx0/+YAZTYGCECZD0jEvS8u4Avl0JWjg== X-Google-Smtp-Source: AGRyM1tZKrS+dB0rTPvMVI40WLP70SwUeboQabn2Qca2TxzlR741rfKWtywIRBZh7ktkESaN6/zFOA== X-Received: by 2002:a05:6e02:1e01:b0:2dc:9bd5:81ee with SMTP id g1-20020a056e021e0100b002dc9bd581eemr17295927ila.129.1658259087943; Tue, 19 Jul 2022 12:31:27 -0700 (PDT) Received: from murgatroyd.Home (71-211-185-228.hlrn.qwest.net. [71.211.185.228]) by smtp.gmail.com with ESMTPSA id x6-20020a056638034600b0033ea1d9858bsm7265481jap.36.2022.07.19.12.31.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 12:31:27 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Change target_ops::async to accept bool Date: Tue, 19 Jul 2022 13:31:25 -0600 Message-Id: <20220719193125.3977900-1-tromey@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2022 19:31:33 -0000 This changes the parameter of target_ops::async from int to bool. Regression tested on x86-64 Fedora 34. --- gdb/fbsd-nat.c | 4 ++-- gdb/fbsd-nat.h | 2 +- gdb/inf-loop.c | 2 +- gdb/inf-ptrace.c | 2 +- gdb/infcmd.c | 2 +- gdb/infrun.c | 4 ++-- gdb/linux-nat.c | 6 +++--- gdb/linux-nat.h | 2 +- gdb/record-btrace.c | 6 +++--- gdb/record-full.c | 4 ++-- gdb/remote.c | 12 ++++++------ gdb/target-delegates.c | 12 ++++++------ gdb/target.c | 4 ++-- gdb/target.h | 4 ++-- gdb/top.c | 4 ++-- 15 files changed, 35 insertions(+), 35 deletions(-) diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 32b289f3bbc..398f1c18b33 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -971,9 +971,9 @@ handle_target_event (int error, gdb_client_data client_data) /* Implement the "async" target method. */ void -fbsd_nat_target::async (int enable) +fbsd_nat_target::async (bool enable) { - if ((enable != 0) == is_async_p ()) + if (enable == is_async_p ()) return; /* Block SIGCHILD while we create/destroy the pipe, as the handler diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h index 3a13bc8711f..eb7d29dd2a3 100644 --- a/gdb/fbsd-nat.h +++ b/gdb/fbsd-nat.h @@ -68,7 +68,7 @@ class fbsd_nat_target : public inf_ptrace_target bool can_async_p () override; - void async (int) override; + void async (bool) override; thread_control_capabilities get_thread_control_capabilities () override { return tc_schedlock; } diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c index 41ca17ad62a..2ae534b2f5c 100644 --- a/gdb/inf-loop.c +++ b/gdb/inf-loop.c @@ -48,7 +48,7 @@ inferior_event_handler (enum inferior_event_type event_type) so that when the inferior is not running we don't get distracted by spurious inferior output. */ if (target_has_execution () && target_can_async_p ()) - target_async (0); + target_async (false); } /* Do all continuations associated with the whole inferior (not diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index b9767978744..8995ef517dd 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -538,7 +538,7 @@ inf_ptrace_target::close () { /* Unregister from the event loop. */ if (is_async_p ()) - async (0); + async (false); inf_child_target::close (); } diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 17d15534356..69a7896b560 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -2605,7 +2605,7 @@ attach_command (const char *args, int from_tty) /* Enable async mode if it is supported by the target. */ if (target_can_async_p ()) - target_async (1); + target_async (true); /* Set up the "saved terminal modes" of the inferior based on what modes we are starting it with. */ diff --git a/gdb/infrun.c b/gdb/infrun.c index a6694230d29..4d81fb8ffbf 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2353,7 +2353,7 @@ resume_1 (enum gdb_signal sig) if (target_can_async_p ()) { - target_async (1); + target_async (true); /* Tell the event loop we have an event to process. */ mark_async_event_handler (infrun_async_inferior_event_token); } @@ -4767,7 +4767,7 @@ wait_one () { /* If nothing is resumed, remove the target from the event loop. */ - target_async (0); + target_async (false); } else if (event.ws.kind () != TARGET_WAITKIND_IGNORE) return event; diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 0a93ab5c6ae..a2bbd3cbfc8 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1652,7 +1652,7 @@ linux_nat_target::resume (ptid_t scope_ptid, int step, enum gdb_signal signo) if (target_can_async_p ()) { - target_async (1); + target_async (true); /* Tell the event loop we have something to process. */ async_file_mark (); } @@ -4143,9 +4143,9 @@ handle_target_event (int error, gdb_client_data client_data) /* target_async implementation. */ void -linux_nat_target::async (int enable) +linux_nat_target::async (bool enable) { - if ((enable != 0) == is_async_p ()) + if (enable == is_async_p ()) return; /* Block child signals while we create/destroy the pipe, as their diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h index 11043c4b9f6..38e253eff36 100644 --- a/gdb/linux-nat.h +++ b/gdb/linux-nat.h @@ -87,7 +87,7 @@ class linux_nat_target : public inf_ptrace_target bool supports_non_stop () override; bool always_non_stop_p () override; - void async (int) override; + void async (bool) override; void stop (ptid_t) override; diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 3f8a69dd04f..3a56925f63e 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -62,7 +62,7 @@ class record_btrace_target final : public target_ops strata stratum () const override { return record_stratum; } void close () override; - void async (int) override; + void async (bool) override; void detach (inferior *inf, int from_tty) override { record_detach (this, inf, from_tty); } @@ -456,7 +456,7 @@ record_btrace_target::close () /* The async method of target record-btrace. */ void -record_btrace_target::async (int enable) +record_btrace_target::async (bool enable) { if (enable) mark_async_event_handler (record_btrace_async_inferior_event_handler); @@ -2187,7 +2187,7 @@ record_btrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal) /* Async support. */ if (target_can_async_p ()) { - target_async (1); + target_async (true); mark_async_event_handler (record_btrace_async_inferior_event_handler); } } diff --git a/gdb/record-full.c b/gdb/record-full.c index 38e021529c7..48b92281fe6 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -223,7 +223,7 @@ class record_full_base_target : public target_ops strata stratum () const override { return record_stratum; } void close () override; - void async (int) override; + void async (bool) override; ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override; bool stopped_by_watchpoint () override; bool stopped_data_address (CORE_ADDR *) override; @@ -1017,7 +1017,7 @@ record_full_base_target::close () /* "async" target method. */ void -record_full_base_target::async (int enable) +record_full_base_target::async (bool enable) { if (enable) mark_async_event_handler (record_full_async_inferior_event_token); diff --git a/gdb/remote.c b/gdb/remote.c index ed834228829..f91973458ea 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -537,7 +537,7 @@ class remote_target : public process_stratum_target bool is_async_p () override; - void async (int) override; + void async (bool) override; int async_wait_fd () override; @@ -4649,8 +4649,8 @@ remote_target::process_initial_stop_replies (int from_tty) the poll in stop_all_threads to consider events from it, so enable it temporarily. */ gdb_assert (!this->is_async_p ()); - SCOPE_EXIT { target_async (0); }; - target_async (1); + SCOPE_EXIT { target_async (false); }; + target_async (true); stop_all_threads ("remote connect in all-stop"); } @@ -5018,7 +5018,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p) process_initial_stop_replies (from_tty); if (target_can_async_p ()) - target_async (1); + target_async (true); } /* Give the target a chance to look up symbols. */ @@ -10451,7 +10451,7 @@ extended_remote_target::create_inferior (const char *exec_file, /* If running asynchronously, register the target file descriptor with the event loop. */ if (target_can_async_p ()) - target_async (1); + target_async (true); /* Disable address space randomization if requested (and supported). */ if (supports_disable_randomization ()) @@ -14495,7 +14495,7 @@ remote_target::async_wait_fd () } void -remote_target::async (int enable) +remote_target::async (bool enable) { struct remote_state *rs = get_remote_state (); diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 8a9986454dd..b6628c4d0be 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -101,7 +101,7 @@ struct dummy_target : public target_ops bool attach_no_wait () override; bool can_async_p () override; bool is_async_p () override; - void async (int arg0) override; + void async (bool arg0) override; int async_wait_fd () override; bool has_pending_events () override; void thread_events (int arg0) override; @@ -275,7 +275,7 @@ struct debug_target : public target_ops bool attach_no_wait () override; bool can_async_p () override; bool is_async_p () override; - void async (int arg0) override; + void async (bool arg0) override; int async_wait_fd () override; bool has_pending_events () override; void thread_events (int arg0) override; @@ -2156,24 +2156,24 @@ debug_target::is_async_p () } void -target_ops::async (int arg0) +target_ops::async (bool arg0) { this->beneath ()->async (arg0); } void -dummy_target::async (int arg0) +dummy_target::async (bool arg0) { tcomplain (); } void -debug_target::async (int arg0) +debug_target::async (bool arg0) { gdb_printf (gdb_stdlog, "-> %s->async (...)\n", this->beneath ()->shortname ()); this->beneath ()->async (arg0); gdb_printf (gdb_stdlog, "<- %s->async (", this->beneath ()->shortname ()); - target_debug_print_int (arg0); + target_debug_print_bool (arg0); gdb_puts (")\n", gdb_stdlog); } diff --git a/gdb/target.c b/gdb/target.c index 18e53aa5d27..41144901fc1 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2675,7 +2675,7 @@ target_resume (ptid_t scope_ptid, int step, enum gdb_signal signal) clear_inline_frame_state (curr_target, scope_ptid); if (target_can_async_p ()) - target_async (1); + target_async (true); } /* See target.h. */ @@ -4352,7 +4352,7 @@ maintenance_print_target_stack (const char *cmd, int from_tty) /* See target.h. */ void -target_async (int enable) +target_async (bool enable) { /* If we are trying to enable async mode then it must be the case that async mode is possible for this target. */ diff --git a/gdb/target.h b/gdb/target.h index 18559feef89..7e52716a9e8 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -713,7 +713,7 @@ struct target_ops TARGET_DEFAULT_RETURN (false); virtual bool is_async_p () TARGET_DEFAULT_RETURN (false); - virtual void async (int) + virtual void async (bool) TARGET_DEFAULT_NORETURN (tcomplain ()); virtual int async_wait_fd () TARGET_DEFAULT_NORETURN (noprocess ()); @@ -1886,7 +1886,7 @@ extern bool target_can_async_p (struct target_ops *target); extern bool target_is_async_p (); /* Enables/disabled async target events. */ -extern void target_async (int enable); +extern void target_async (bool enable); /* Enables/disables thread create and exit events. */ extern void target_thread_events (int enable); diff --git a/gdb/top.c b/gdb/top.c index 60835acd5e5..453fa236db1 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1109,7 +1109,7 @@ class gdb_readline_wrapper_cleanup current_ui->secondary_prompt_depth++; if (m_target_is_async_orig) - target_async (0); + target_async (false); } ~gdb_readline_wrapper_cleanup () @@ -1138,7 +1138,7 @@ class gdb_readline_wrapper_cleanup saved_after_char_processing_hook = NULL; if (m_target_is_async_orig) - target_async (1); + target_async (true); } DISABLE_COPY_AND_ASSIGN (gdb_readline_wrapper_cleanup); -- 2.34.1