From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42828 invoked by alias); 31 Oct 2019 18:28:28 -0000 Mailing-List: contact gdb-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: , Sender: gdb-cvs-owner@sourceware.org List-Subscribe: Sender: gdb-cvs-owner@sourceware.org Received: (qmail 42783 invoked by uid 10256); 31 Oct 2019 18:28:28 -0000 Date: Thu, 31 Oct 2019 18:28:00 -0000 Message-ID: <20191031182828.42781.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Christian Biesinger To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Convert int to bool in agent.c X-Act-Checkin: binutils-gdb X-Git-Author: Christian Biesinger X-Git-Refname: refs/heads/master X-Git-Oldrev: f78d04905a457abde48c8f521ec2303e84683100 X-Git-Newrev: 75cafaa61a0244016a2c2ee1d0b2742d674d7373 X-SW-Source: 2019-10/txt/msg00195.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=75cafaa61a0244016a2c2ee1d0b2742d674d7373 commit 75cafaa61a0244016a2c2ee1d0b2742d674d7373 Author: Christian Biesinger Date: Wed Oct 30 16:19:11 2019 -0500 Convert int to bool in agent.c Also moves an int declaration inside the for loop. Code cleanup, no change in behavior intended. gdb/ChangeLog: 2019-10-31 Christian Biesinger * gdbsupport/agent.c (debug_agent): Change type to bool. (use_agent): Likewise. (all_agent_symbols_look_up): Likewise. (agent_loaded_p): Change return value to bool. (agent_look_up_symbols): Update. (agent_capability_check): Change return value to bool. * gdbsupport/agent.h (agent_loaded_p): Likewise. (debug_agent): Change type to bool. (use_agent): Likewise. (agent_capability_check): Change return value to bool. gdb/gdbserver/ChangeLog: 2019-10-31 Christian Biesinger * ax.h (debug_agent): Remove duplicate declaration. Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5 Diff: --- gdb/ChangeLog | 13 +++++++++++++ gdb/gdbserver/ChangeLog | 4 ++++ gdb/gdbserver/ax.h | 1 - gdb/gdbsupport/agent.c | 20 +++++++++----------- gdb/gdbsupport/agent.h | 8 ++++---- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0382082..ee48133 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2019-10-31 Christian Biesinger + + * gdbsupport/agent.c (debug_agent): Change type to bool. + (use_agent): Likewise. + (all_agent_symbols_look_up): Likewise. + (agent_loaded_p): Change return value to bool. + (agent_look_up_symbols): Update. + (agent_capability_check): Change return value to bool. + * gdbsupport/agent.h (agent_loaded_p): Likewise. + (debug_agent): Change type to bool. + (use_agent): Likewise. + (agent_capability_check): Change return value to bool. + 2019-10-30 Christian Biesinger * minsyms.c (clear_minimal_symbol_hash_tables): New function. diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index d016549..9606596 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2019-10-31 Christian Biesinger + + * ax.h (debug_agent): Remove duplicate declaration. + 2019-10-26 Tom de Vries * linux-aarch64-low.c: Fix typos in comments. diff --git a/gdb/gdbserver/ax.h b/gdb/gdbserver/ax.h index 3e9fd8f..db8ecae 100644 --- a/gdb/gdbserver/ax.h +++ b/gdb/gdbserver/ax.h @@ -22,7 +22,6 @@ #include "regcache.h" #ifdef IN_PROCESS_AGENT -extern int debug_agent; #define debug_threads debug_agent #endif diff --git a/gdb/gdbsupport/agent.c b/gdb/gdbsupport/agent.c index 02cad46..6d55f58 100644 --- a/gdb/gdbsupport/agent.c +++ b/gdb/gdbsupport/agent.c @@ -26,7 +26,7 @@ #define IPA_SYM_STRUCT_NAME ipa_sym_addresses_common #include "agent.h" -int debug_agent = 0; +bool debug_agent = false; /* A stdarg wrapper for debug_vprintf. */ @@ -45,7 +45,7 @@ debug_agent_printf (const char *fmt, ...) #define DEBUG_AGENT debug_agent_printf /* Global flag to determine using agent or not. */ -int use_agent = 0; +bool use_agent = false; /* Addresses of in-process agent's symbols both GDB and GDBserver cares about. */ @@ -73,9 +73,9 @@ static struct static struct ipa_sym_addresses_common ipa_sym_addrs; -static int all_agent_symbols_looked_up = 0; +static bool all_agent_symbols_looked_up = false; -int +bool agent_loaded_p (void) { return all_agent_symbols_looked_up; @@ -87,11 +87,9 @@ agent_loaded_p (void) int agent_look_up_symbols (void *arg) { - int i; - - all_agent_symbols_looked_up = 0; + all_agent_symbols_looked_up = false; - for (i = 0; i < sizeof (symbol_list) / sizeof (symbol_list[0]); i++) + for (int i = 0; i < sizeof (symbol_list) / sizeof (symbol_list[0]); i++) { CORE_ADDR *addrp = (CORE_ADDR *) ((char *) &ipa_sym_addrs + symbol_list[i].offset); @@ -105,7 +103,7 @@ agent_look_up_symbols (void *arg) } } - all_agent_symbols_looked_up = 1; + all_agent_symbols_looked_up = true; return 0; } @@ -260,7 +258,7 @@ static uint32_t agent_capability = 0; /* Return true if agent has capability AGENT_CAP, otherwise return false. */ -int +bool agent_capability_check (enum agent_capa agent_capa) { if (agent_capability == 0) @@ -269,7 +267,7 @@ agent_capability_check (enum agent_capa agent_capa) &agent_capability)) warning (_("Error reading capability of agent")); } - return agent_capability & agent_capa; + return (agent_capability & agent_capa) != 0; } /* Invalidate the cache of agent capability, so we'll read it from inferior diff --git a/gdb/gdbsupport/agent.h b/gdb/gdbsupport/agent.h index 4f05498..27f515d 100644 --- a/gdb/gdbsupport/agent.h +++ b/gdb/gdbsupport/agent.h @@ -42,11 +42,11 @@ int agent_look_up_symbols (void *); thread. */ #define IPA_CMD_BUF_SIZE 1024 -int agent_loaded_p (void); +bool agent_loaded_p (void); -extern int debug_agent; +extern bool debug_agent; -extern int use_agent; +extern bool use_agent; /* Capability of agent. Different agents may have different capabilities, such as installing fast tracepoint or evaluating breakpoint conditions. @@ -61,7 +61,7 @@ enum agent_capa AGENT_CAPA_STATIC_TRACE = (0x1 << 1), }; -int agent_capability_check (enum agent_capa); +bool agent_capability_check (enum agent_capa); void agent_capability_invalidate (void);