• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂bd920864f3dc2cad376989a642ab774aef6b2fce (tree)
時間2020-06-22 21:03:33
作者Tankut Baris Aktemur <tankut.baris.aktemur@inte...>
CommiterTankut Baris Aktemur

Log Message

gdb/jit: return bool in jit_breakpoint_re_set_internal and jit_read_descriptor

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'.

The return value logic of jit_breakpoint_re_set_internal has been
reversed. With this patch it now returns true if the jit breakpoint
has been successfully initialized.

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

* jit.c (jit_read_descriptor): Use bool as the return type.
(jit_breakpoint_re_set_internal): Use bool as the return type.
Invert the return value logic; return true if the jit breakpoint
has been successfully initialized.
(jit_inferior_init): Update the call to
jit_breakpoint_re_set_internal.

Change Summary

差異

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
1+2020-06-22 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
2+
3+ * jit.c (jit_read_descriptor): Use bool as the return type.
4+ (jit_breakpoint_re_set_internal): Use bool as the return type.
5+ Invert the return value logic; return true if the jit breakpoint
6+ has been successfully initialized.
7+ (jit_inferior_init): Update the call to
8+ jit_breakpoint_re_set_internal.
9+
110 2020-06-22 Pedro Alves <palves@redhat.com>
211
312 PR gdb/25939
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -329,9 +329,9 @@ get_jit_program_space_data ()
329329 }
330330
331331 /* Helper function for reading the global JIT descriptor from remote
332- memory. Returns 1 if all went well, 0 otherwise. */
332+ memory. Returns true if all went well, false otherwise. */
333333
334-static int
334+static bool
335335 jit_read_descriptor (struct gdbarch *gdbarch,
336336 struct jit_descriptor *descriptor,
337337 struct jit_program_space_data *ps_data)
@@ -345,10 +345,10 @@ jit_read_descriptor (struct gdbarch *gdbarch,
345345 struct jit_objfile_data *objf_data;
346346
347347 if (ps_data->objfile == NULL)
348- return 0;
348+ return false;
349349 objf_data = get_jit_objfile_data (ps_data->objfile);
350350 if (objf_data->descriptor == NULL)
351- return 0;
351+ return false;
352352
353353 if (jit_debug)
354354 fprintf_unfiltered (gdb_stdlog,
@@ -370,7 +370,7 @@ jit_read_descriptor (struct gdbarch *gdbarch,
370370 {
371371 printf_unfiltered (_("Unable to read JIT descriptor from "
372372 "remote memory\n"));
373- return 0;
373+ return false;
374374 }
375375
376376 /* Fix the endianness to match the host. */
@@ -381,7 +381,7 @@ jit_read_descriptor (struct gdbarch *gdbarch,
381381 descriptor->first_entry =
382382 extract_typed_address (&desc_buf[8 + ptr_size], ptr_type);
383383
384- return 1;
384+ return true;
385385 }
386386
387387 /* Helper function for reading a JITed code entry from remote memory. */
@@ -950,9 +950,9 @@ jit_breakpoint_deleted (struct breakpoint *b)
950950 }
951951
952952 /* (Re-)Initialize the jit breakpoint if necessary.
953- Return 0 if the jit breakpoint has been successfully initialized. */
953+ Return true if the jit breakpoint has been successfully initialized. */
954954
955-static int
955+static bool
956956 jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
957957 struct jit_program_space_data *ps_data)
958958 {
@@ -968,13 +968,13 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
968968 reg_symbol = lookup_bound_minimal_symbol (jit_break_name);
969969 if (reg_symbol.minsym == NULL
970970 || BMSYMBOL_VALUE_ADDRESS (reg_symbol) == 0)
971- return 1;
971+ return false;
972972
973973 desc_symbol = lookup_minimal_symbol (jit_descriptor_name, NULL,
974974 reg_symbol.objfile);
975975 if (desc_symbol.minsym == NULL
976976 || BMSYMBOL_VALUE_ADDRESS (desc_symbol) == 0)
977- return 1;
977+ return false;
978978
979979 objf_data = get_jit_objfile_data (reg_symbol.objfile);
980980 objf_data->register_code = reg_symbol.minsym;
@@ -994,7 +994,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
994994 paddress (gdbarch, addr));
995995
996996 if (ps_data->cached_code_address == addr)
997- return 0;
997+ return true;
998998
999999 /* Delete the old breakpoint. */
10001000 if (ps_data->jit_breakpoint != NULL)
@@ -1004,7 +1004,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
10041004 ps_data->cached_code_address = addr;
10051005 ps_data->jit_breakpoint = create_jit_event_breakpoint (gdbarch, addr);
10061006
1007- return 0;
1007+ return true;
10081008 }
10091009
10101010 /* The private data passed around in the frame unwind callback
@@ -1252,7 +1252,7 @@ jit_inferior_init (struct gdbarch *gdbarch)
12521252 jit_prepend_unwinder (gdbarch);
12531253
12541254 ps_data = get_jit_program_space_data ();
1255- if (jit_breakpoint_re_set_internal (gdbarch, ps_data) != 0)
1255+ if (!jit_breakpoint_re_set_internal (gdbarch, ps_data))
12561256 return;
12571257
12581258 /* Read the descriptor so we can check the version number and load