Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
To: gdb-patches@sourceware.org
Cc: simark@simark.ca
Subject: [PATCH v2 2/3] gdb/jit: return bool in jit_breakpoint_re_set_internal and jit_read_descriptor
Date: Tue, 16 Jun 2020 11:49:44 +0200	[thread overview]
Message-ID: <f2c9399b05d361ef0dac37dfd1968f039ad4b6a1.1592299502.git.tankut.baris.aktemur@intel.com> (raw)
In-Reply-To: <cover.1592299502.git.tankut.baris.aktemur@intel.com>
In-Reply-To: <cover.1592299502.git.tankut.baris.aktemur@intel.com>

This is a minor refactoring that converts the return type of
jit_read_descriptor and jit_breakpoint_re_set_internal functions
from 'int' to 'bool'.

gdb/ChangeLog:
2020-06-15  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* jit.c (jit_read_descriptor): Use bool as the return type.
	(jit_breakpoint_re_set_internal): Ditto.
	(jit_inferior_init): Update the call to
	jit_breakpoint_re_set_internal.
---
 gdb/jit.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/gdb/jit.c b/gdb/jit.c
index 1bfc80455b9..5da0601b024 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -329,9 +329,9 @@ get_jit_program_space_data ()
 }
 
 /* Helper function for reading the global JIT descriptor from remote
-   memory.  Returns 1 if all went well, 0 otherwise.  */
+   memory.  Returns true if all went well, false otherwise.  */
 
-static int
+static bool
 jit_read_descriptor (gdbarch *gdbarch,
 		     jit_descriptor *descriptor,
 		     objfile *jiter)
@@ -348,7 +348,7 @@ jit_read_descriptor (gdbarch *gdbarch,
 
   objf_data = get_jit_objfile_data (jiter);
   if (objf_data->descriptor == NULL)
-    return 0;
+    return false;
 
   if (jit_debug)
     fprintf_unfiltered (gdb_stdlog,
@@ -370,7 +370,7 @@ jit_read_descriptor (gdbarch *gdbarch,
     {
       printf_unfiltered (_("Unable to read JIT descriptor from "
 			   "remote memory\n"));
-      return 0;
+      return false;
     }
 
   /* Fix the endianness to match the host.  */
@@ -381,7 +381,7 @@ jit_read_descriptor (gdbarch *gdbarch,
   descriptor->first_entry =
       extract_typed_address (&desc_buf[8 + ptr_size], ptr_type);
 
-  return 1;
+  return true;
 }
 
 /* Helper function for reading a JITed code entry from remote memory.  */
@@ -950,9 +950,9 @@ jit_breakpoint_deleted (struct breakpoint *b)
 }
 
 /* (Re-)Initialize the jit breakpoint if necessary.
-   Return 0 if the jit breakpoint has been successfully initialized.  */
+   Return true if the jit breakpoint has been successfully initialized.  */
 
-static int
+static bool
 jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
 				struct jit_program_space_data *ps_data)
 {
@@ -968,13 +968,13 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
       reg_symbol = lookup_bound_minimal_symbol (jit_break_name);
       if (reg_symbol.minsym == NULL
 	  || BMSYMBOL_VALUE_ADDRESS (reg_symbol) == 0)
-	return 1;
+	return false;
 
       desc_symbol = lookup_minimal_symbol (jit_descriptor_name, NULL,
 					   reg_symbol.objfile);
       if (desc_symbol.minsym == NULL
 	  || BMSYMBOL_VALUE_ADDRESS (desc_symbol) == 0)
-	return 1;
+	return false;
 
       objf_data = get_jit_objfile_data (reg_symbol.objfile);
       objf_data->register_code = reg_symbol.minsym;
@@ -994,7 +994,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
 			paddress (gdbarch, addr));
 
   if (ps_data->cached_code_address == addr)
-    return 0;
+    return true;
 
   /* Delete the old breakpoint.  */
   if (ps_data->jit_breakpoint != NULL)
@@ -1004,7 +1004,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
   ps_data->cached_code_address = addr;
   ps_data->jit_breakpoint = create_jit_event_breakpoint (gdbarch, addr);
 
-  return 0;
+  return true;
 }
 
 /* The private data passed around in the frame unwind callback
@@ -1252,7 +1252,7 @@ jit_inferior_init (struct gdbarch *gdbarch)
   jit_prepend_unwinder (gdbarch);
 
   ps_data = get_jit_program_space_data ();
-  if (jit_breakpoint_re_set_internal (gdbarch, ps_data) != 0)
+  if (!jit_breakpoint_re_set_internal (gdbarch, ps_data))
     return;
 
   /* There must be a JITer registered, otherwise we would exit early
-- 
2.17.1



  parent reply	other threads:[~2020-06-16  9:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16  9:49 [PATCH v2 0/3] Handling multiple JITers Tankut Baris Aktemur
2020-06-16  9:49 ` [PATCH v2 1/3] gdb/jit: pass the jiter objfile as an argument to jit_event_handler Tankut Baris Aktemur
2020-06-16  9:49 ` Tankut Baris Aktemur [this message]
2020-06-21  3:43   ` [PATCH v2 2/3] gdb/jit: return bool in jit_breakpoint_re_set_internal and jit_read_descriptor Simon Marchi
2020-06-22 12:05     ` Aktemur, Tankut Baris
2020-06-16  9:49 ` [PATCH v2 3/3] gdb/jit: enable tracking multiple jitter objfiles Tankut Baris Aktemur
2020-06-21  3:32   ` Simon Marchi
2020-06-22 16:28     ` Pedro Alves
2020-06-22 16:39       ` Simon Marchi
2020-06-22 16:53         ` Aktemur, Tankut Baris
2020-06-22 17:00           ` Simon Marchi
2020-06-23  8:16             ` Aktemur, Tankut Baris
2020-06-22 16:53         ` Pedro Alves
2020-06-22 16:52     ` Aktemur, Tankut Baris
2020-06-30  8:17     ` Aktemur, Tankut Baris
2020-07-03  2:19       ` Simon Marchi
2020-07-03  7:29         ` Aktemur, Tankut Baris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f2c9399b05d361ef0dac37dfd1968f039ad4b6a1.1592299502.git.tankut.baris.aktemur@intel.com \
    --to=tankut.baris.aktemur@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox