* [review] Convert int to bool in agent.c
@ 2019-10-30 21:22 Christian Biesinger (Code Review)
2019-10-31 1:25 ` Luis Machado (Code Review)
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Christian Biesinger (Code Review) @ 2019-10-30 21:22 UTC (permalink / raw)
To: gdb-patches; +Cc: Christian Biesinger
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/462
......................................................................
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-30 Christian Biesinger <cbiesinger@google.com>
* 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-30 Christian Biesinger <cbiesinger@google.com>
* ax.h (debug_agent): Remove duplicate declaration.
Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
---
M gdb/gdbserver/ax.h
M gdb/gdbsupport/agent.c
M gdb/gdbsupport/agent.h
3 files changed, 13 insertions(+), 16 deletions(-)
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..90b7ff5 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 @@
#define DEBUG_AGENT debug_agent_printf
/* Global flag to determine using agent or not. */
-int use_agent = 0;
+bool use_agent = 0;
/* Addresses of in-process agent's symbols both GDB and GDBserver cares
about. */
@@ -73,9 +73,9 @@
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 @@
int
agent_look_up_symbols (void *arg)
{
- int i;
+ all_agent_symbols_looked_up = false;
- all_agent_symbols_looked_up = 0;
-
- 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 @@
}
}
- all_agent_symbols_looked_up = 1;
+ all_agent_symbols_looked_up = true;
return 0;
}
@@ -260,7 +258,7 @@
/* 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))
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 @@
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 @@
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);
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
Gerrit-Change-Number: 462
Gerrit-PatchSet: 1
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-MessageType: newchange
^ permalink raw reply [flat|nested] 8+ messages in thread
* [review] Convert int to bool in agent.c
2019-10-30 21:22 [review] Convert int to bool in agent.c Christian Biesinger (Code Review)
@ 2019-10-31 1:25 ` Luis Machado (Code Review)
2019-10-31 1:31 ` [review v2] " Christian Biesinger (Code Review)
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Luis Machado (Code Review) @ 2019-10-31 1:25 UTC (permalink / raw)
To: Christian Biesinger, gdb-patches
Luis Machado has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/462
......................................................................
Patch Set 1: Code-Review+1
(1 comment)
Looks good to me, except for the nit pointed out. Thanks!
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/462/1/gdb/gdbsupport/agent.c
File gdb/gdbsupport/agent.c:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/462/1/gdb/gdbsupport/agent.c@48
PS1, Line 48:
43 | }
44 |
45 | #define DEBUG_AGENT debug_agent_printf
46 |
47 | /* Global flag to determine using agent or not. */
48 > bool use_agent = 0;
49 |
50 | /* Addresses of in-process agent's symbols both GDB and GDBserver cares
51 | about. */
52 |
53 | struct ipa_sym_addresses_common
Likewise make it "false"?
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
Gerrit-Change-Number: 462
Gerrit-PatchSet: 1
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Luis Machado <luis.machado@linaro.org>
Gerrit-Comment-Date: Thu, 31 Oct 2019 01:25:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 8+ messages in thread
* [review v2] Convert int to bool in agent.c
2019-10-30 21:22 [review] Convert int to bool in agent.c Christian Biesinger (Code Review)
2019-10-31 1:25 ` Luis Machado (Code Review)
@ 2019-10-31 1:31 ` Christian Biesinger (Code Review)
2019-10-31 1:31 ` Christian Biesinger (Code Review)
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Christian Biesinger (Code Review) @ 2019-10-31 1:31 UTC (permalink / raw)
To: Christian Biesinger, gdb-patches; +Cc: Luis Machado
Christian Biesinger has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/462
......................................................................
Uploaded patch set 2.
(1 comment)
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/462/1/gdb/gdbsupport/agent.c
File gdb/gdbsupport/agent.c:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/462/1/gdb/gdbsupport/agent.c@48
PS1, Line 48:
43 | }
44 |
45 | #define DEBUG_AGENT debug_agent_printf
46 |
47 | /* Global flag to determine using agent or not. */
48 > bool use_agent = 0;
49 |
50 | /* Addresses of in-process agent's symbols both GDB and GDBserver cares
51 | about. */
52 |
53 | struct ipa_sym_addresses_common
> Likewise make it "false"?
Oops, thanks. Fixed.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
Gerrit-Change-Number: 462
Gerrit-PatchSet: 2
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Luis Machado <luis.machado@linaro.org>
Gerrit-Comment-Date: Thu, 31 Oct 2019 01:30:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Luis Machado <luis.machado@linaro.org>
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 8+ messages in thread
* [review v2] Convert int to bool in agent.c
2019-10-30 21:22 [review] Convert int to bool in agent.c Christian Biesinger (Code Review)
2019-10-31 1:25 ` Luis Machado (Code Review)
2019-10-31 1:31 ` [review v2] " Christian Biesinger (Code Review)
@ 2019-10-31 1:31 ` Christian Biesinger (Code Review)
2019-10-31 14:13 ` Simon Marchi (Code Review)
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Christian Biesinger (Code Review) @ 2019-10-31 1:31 UTC (permalink / raw)
To: Christian Biesinger, Luis Machado, gdb-patches
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/462
......................................................................
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-30 Christian Biesinger <cbiesinger@google.com>
* 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-30 Christian Biesinger <cbiesinger@google.com>
* ax.h (debug_agent): Remove duplicate declaration.
Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
---
M gdb/gdbserver/ax.h
M gdb/gdbsupport/agent.c
M gdb/gdbsupport/agent.h
3 files changed, 13 insertions(+), 16 deletions(-)
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 @@
#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 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 @@
int
agent_look_up_symbols (void *arg)
{
- int i;
+ all_agent_symbols_looked_up = false;
- all_agent_symbols_looked_up = 0;
-
- 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 @@
}
}
- all_agent_symbols_looked_up = 1;
+ all_agent_symbols_looked_up = true;
return 0;
}
@@ -260,7 +258,7 @@
/* 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))
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 @@
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 @@
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);
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
Gerrit-Change-Number: 462
Gerrit-PatchSet: 2
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Luis Machado <luis.machado@linaro.org>
Gerrit-MessageType: newpatchset
^ permalink raw reply [flat|nested] 8+ messages in thread
* [review v2] Convert int to bool in agent.c
2019-10-30 21:22 [review] Convert int to bool in agent.c Christian Biesinger (Code Review)
` (3 preceding siblings ...)
2019-10-31 14:13 ` Simon Marchi (Code Review)
@ 2019-10-31 14:13 ` Simon Marchi (Code Review)
2019-10-31 18:29 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-10-31 18:29 ` Sourceware to Gerrit sync (Code Review)
6 siblings, 0 replies; 8+ messages in thread
From: Simon Marchi (Code Review) @ 2019-10-31 14:13 UTC (permalink / raw)
To: Christian Biesinger, gdb-patches; +Cc: Luis Machado
Simon Marchi has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/462
......................................................................
Patch Set 2: Code-Review+2
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
Gerrit-Change-Number: 462
Gerrit-PatchSet: 2
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Luis Machado <luis.machado@linaro.org>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Thu, 31 Oct 2019 14:13:49 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 8+ messages in thread
* [review v2] Convert int to bool in agent.c
2019-10-30 21:22 [review] Convert int to bool in agent.c Christian Biesinger (Code Review)
` (2 preceding siblings ...)
2019-10-31 1:31 ` Christian Biesinger (Code Review)
@ 2019-10-31 14:13 ` Simon Marchi (Code Review)
2019-10-31 14:13 ` Simon Marchi (Code Review)
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Simon Marchi (Code Review) @ 2019-10-31 14:13 UTC (permalink / raw)
To: Christian Biesinger, gdb-patches; +Cc: Luis Machado
Simon Marchi has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/462
......................................................................
Patch Set 2:
Thanks, this LGTM.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
Gerrit-Change-Number: 462
Gerrit-PatchSet: 2
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Luis Machado <luis.machado@linaro.org>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Thu, 31 Oct 2019 14:13:41 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pushed] Convert int to bool in agent.c
2019-10-30 21:22 [review] Convert int to bool in agent.c Christian Biesinger (Code Review)
` (5 preceding siblings ...)
2019-10-31 18:29 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-10-31 18:29 ` Sourceware to Gerrit sync (Code Review)
6 siblings, 0 replies; 8+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-10-31 18:29 UTC (permalink / raw)
To: Christian Biesinger, Luis Machado, Simon Marchi, gdb-patches
The original change was created by Christian Biesinger.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/462
......................................................................
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 <cbiesinger@google.com>
* 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 <cbiesinger@google.com>
* ax.h (debug_agent): Remove duplicate declaration.
Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
---
M gdb/ChangeLog
M gdb/gdbserver/ChangeLog
M gdb/gdbserver/ax.h
M gdb/gdbsupport/agent.c
M gdb/gdbsupport/agent.h
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 <cbiesinger@google.com>
+
+ * 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 <cbiesinger@google.com>
* 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 <cbiesinger@google.com>
+
+ * ax.h (debug_agent): Remove duplicate declaration.
+
2019-10-26 Tom de Vries <tdevries@suse.de>
* 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 @@
#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 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 @@
int
agent_look_up_symbols (void *arg)
{
- int i;
+ all_agent_symbols_looked_up = false;
- all_agent_symbols_looked_up = 0;
-
- 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 @@
}
}
- all_agent_symbols_looked_up = 1;
+ all_agent_symbols_looked_up = true;
return 0;
}
@@ -260,7 +258,7 @@
/* 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))
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 @@
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 @@
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);
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
Gerrit-Change-Number: 462
Gerrit-PatchSet: 3
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Luis Machado <luis.machado@linaro.org>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: newpatchset
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pushed] Convert int to bool in agent.c
2019-10-30 21:22 [review] Convert int to bool in agent.c Christian Biesinger (Code Review)
` (4 preceding siblings ...)
2019-10-31 14:13 ` Simon Marchi (Code Review)
@ 2019-10-31 18:29 ` Sourceware to Gerrit sync (Code Review)
2019-10-31 18:29 ` Sourceware to Gerrit sync (Code Review)
6 siblings, 0 replies; 8+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-10-31 18:29 UTC (permalink / raw)
To: Christian Biesinger, gdb-patches; +Cc: Simon Marchi, Luis Machado
Sourceware to Gerrit sync has submitted this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/462
......................................................................
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 <cbiesinger@google.com>
* 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 <cbiesinger@google.com>
* ax.h (debug_agent): Remove duplicate declaration.
Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
---
M gdb/ChangeLog
M gdb/gdbserver/ChangeLog
M gdb/gdbserver/ax.h
M gdb/gdbsupport/agent.c
M gdb/gdbsupport/agent.h
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 <cbiesinger@google.com>
+
+ * 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 <cbiesinger@google.com>
* 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 <cbiesinger@google.com>
+
+ * ax.h (debug_agent): Remove duplicate declaration.
+
2019-10-26 Tom de Vries <tdevries@suse.de>
* 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 @@
#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 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 @@
int
agent_look_up_symbols (void *arg)
{
- int i;
+ all_agent_symbols_looked_up = false;
- all_agent_symbols_looked_up = 0;
-
- 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 @@
}
}
- all_agent_symbols_looked_up = 1;
+ all_agent_symbols_looked_up = true;
return 0;
}
@@ -260,7 +258,7 @@
/* 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))
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 @@
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 @@
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);
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
Gerrit-Change-Number: 462
Gerrit-PatchSet: 3
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Luis Machado <luis.machado@linaro.org>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: merged
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-10-31 18:29 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 21:22 [review] Convert int to bool in agent.c Christian Biesinger (Code Review)
2019-10-31 1:25 ` Luis Machado (Code Review)
2019-10-31 1:31 ` [review v2] " Christian Biesinger (Code Review)
2019-10-31 1:31 ` Christian Biesinger (Code Review)
2019-10-31 14:13 ` Simon Marchi (Code Review)
2019-10-31 14:13 ` Simon Marchi (Code Review)
2019-10-31 18:29 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-10-31 18:29 ` Sourceware to Gerrit sync (Code Review)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).