From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by sourceware.org (Postfix) with ESMTPS id D37E1383F85E for ; Tue, 16 Jun 2020 09:51:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D37E1383F85E IronPort-SDR: iuiM6m8JgEgKkcJ6FB5+i8p6z1nlPbEXmIomwByt3iLN+x32SpRF9zpgoHdP8hOS7RPJTCDiuz inXG1aTmsX0g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2020 02:51:15 -0700 IronPort-SDR: zsPODJDR2iM8Wc5vOcnyvBeqFxjI3mT52T1e4VHu5fUuOGXpZZq6OLRBGiMtJXgL3nd4eEQsPp EMfiGh6wH8Tw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,518,1583222400"; d="scan'208";a="476351521" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga006.fm.intel.com with ESMTP; 16 Jun 2020 02:51:13 -0700 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 05G9pDlt020515; Tue, 16 Jun 2020 10:51:13 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id 05G9pCQI004973; Tue, 16 Jun 2020 11:51:12 +0200 Received: (from taktemur@localhost) by ulvlx001.iul.intel.com with LOCAL id 05G9pC4d004969; Tue, 16 Jun 2020 11:51:12 +0200 From: Tankut Baris Aktemur 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 Message-Id: X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: In-Reply-To: References: X-Spam-Status: No, score=-23.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_STOCKGEN, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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, 16 Jun 2020 09:51:22 -0000 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 * 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