GNU Binutils with patches for OS216
修訂 | bd920864f3dc2cad376989a642ab774aef6b2fce (tree) |
---|---|
時間 | 2020-06-22 21:03:33 |
作者 | Tankut Baris Aktemur <tankut.baris.aktemur@inte...> |
Commiter | Tankut Baris Aktemur |
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.
@@ -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 | + | |
1 | 10 | 2020-06-22 Pedro Alves <palves@redhat.com> |
2 | 11 | |
3 | 12 | PR gdb/25939 |
@@ -329,9 +329,9 @@ get_jit_program_space_data () | ||
329 | 329 | } |
330 | 330 | |
331 | 331 | /* 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. */ | |
333 | 333 | |
334 | -static int | |
334 | +static bool | |
335 | 335 | jit_read_descriptor (struct gdbarch *gdbarch, |
336 | 336 | struct jit_descriptor *descriptor, |
337 | 337 | struct jit_program_space_data *ps_data) |
@@ -345,10 +345,10 @@ jit_read_descriptor (struct gdbarch *gdbarch, | ||
345 | 345 | struct jit_objfile_data *objf_data; |
346 | 346 | |
347 | 347 | if (ps_data->objfile == NULL) |
348 | - return 0; | |
348 | + return false; | |
349 | 349 | objf_data = get_jit_objfile_data (ps_data->objfile); |
350 | 350 | if (objf_data->descriptor == NULL) |
351 | - return 0; | |
351 | + return false; | |
352 | 352 | |
353 | 353 | if (jit_debug) |
354 | 354 | fprintf_unfiltered (gdb_stdlog, |
@@ -370,7 +370,7 @@ jit_read_descriptor (struct gdbarch *gdbarch, | ||
370 | 370 | { |
371 | 371 | printf_unfiltered (_("Unable to read JIT descriptor from " |
372 | 372 | "remote memory\n")); |
373 | - return 0; | |
373 | + return false; | |
374 | 374 | } |
375 | 375 | |
376 | 376 | /* Fix the endianness to match the host. */ |
@@ -381,7 +381,7 @@ jit_read_descriptor (struct gdbarch *gdbarch, | ||
381 | 381 | descriptor->first_entry = |
382 | 382 | extract_typed_address (&desc_buf[8 + ptr_size], ptr_type); |
383 | 383 | |
384 | - return 1; | |
384 | + return true; | |
385 | 385 | } |
386 | 386 | |
387 | 387 | /* Helper function for reading a JITed code entry from remote memory. */ |
@@ -950,9 +950,9 @@ jit_breakpoint_deleted (struct breakpoint *b) | ||
950 | 950 | } |
951 | 951 | |
952 | 952 | /* (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. */ | |
954 | 954 | |
955 | -static int | |
955 | +static bool | |
956 | 956 | jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, |
957 | 957 | struct jit_program_space_data *ps_data) |
958 | 958 | { |
@@ -968,13 +968,13 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, | ||
968 | 968 | reg_symbol = lookup_bound_minimal_symbol (jit_break_name); |
969 | 969 | if (reg_symbol.minsym == NULL |
970 | 970 | || BMSYMBOL_VALUE_ADDRESS (reg_symbol) == 0) |
971 | - return 1; | |
971 | + return false; | |
972 | 972 | |
973 | 973 | desc_symbol = lookup_minimal_symbol (jit_descriptor_name, NULL, |
974 | 974 | reg_symbol.objfile); |
975 | 975 | if (desc_symbol.minsym == NULL |
976 | 976 | || BMSYMBOL_VALUE_ADDRESS (desc_symbol) == 0) |
977 | - return 1; | |
977 | + return false; | |
978 | 978 | |
979 | 979 | objf_data = get_jit_objfile_data (reg_symbol.objfile); |
980 | 980 | objf_data->register_code = reg_symbol.minsym; |
@@ -994,7 +994,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, | ||
994 | 994 | paddress (gdbarch, addr)); |
995 | 995 | |
996 | 996 | if (ps_data->cached_code_address == addr) |
997 | - return 0; | |
997 | + return true; | |
998 | 998 | |
999 | 999 | /* Delete the old breakpoint. */ |
1000 | 1000 | if (ps_data->jit_breakpoint != NULL) |
@@ -1004,7 +1004,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, | ||
1004 | 1004 | ps_data->cached_code_address = addr; |
1005 | 1005 | ps_data->jit_breakpoint = create_jit_event_breakpoint (gdbarch, addr); |
1006 | 1006 | |
1007 | - return 0; | |
1007 | + return true; | |
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | /* The private data passed around in the frame unwind callback |
@@ -1252,7 +1252,7 @@ jit_inferior_init (struct gdbarch *gdbarch) | ||
1252 | 1252 | jit_prepend_unwinder (gdbarch); |
1253 | 1253 | |
1254 | 1254 | 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)) | |
1256 | 1256 | return; |
1257 | 1257 | |
1258 | 1258 | /* Read the descriptor so we can check the version number and load |