diff options
author | Carl Love <cel@us.ibm.com> | 2022-11-16 11:04:51 -0600 |
---|---|---|
committer | Carl Love <cel@us.ibm.com> | 2022-11-17 11:32:49 -0500 |
commit | 03acd4d85430c8afaa72db4daf1421ee82df53ec (patch) | |
tree | 1ab440e467e16f877bb42c7fafbf377889975b23 /gdb/infcmd.c | |
parent | 25d17459e337a4cc9856f36c55a88b072c8709c9 (diff) | |
download | fsf-binutils-gdb-03acd4d85430c8afaa72db4daf1421ee82df53ec.zip fsf-binutils-gdb-03acd4d85430c8afaa72db4daf1421ee82df53ec.tar.gz fsf-binutils-gdb-03acd4d85430c8afaa72db4daf1421ee82df53ec.tar.bz2 |
Change NULL to nullptr in gdb/infcmd.c and gdb/infrun.c
The GDB coding standard specifies that nullptr should be used instead of
NULL. There are numerous uses of NULL and nullptr in files infcmd.c and
infrun.c. This patch replaces the various uses of NULL with nullptr in
the source files. The use of NULL in the comments was not changed.
The patch does not introduce any functional changes.
The patch has been tested on PowerPC and Intel X86_64 with no new unexpected
test failures, unresolved tests, new core files etc.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r-- | gdb/infcmd.c | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c index a72df2d..f7bce0d 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -208,10 +208,10 @@ strip_bg_char (const char *args, int *bg_char_p) { const char *p; - if (args == NULL || *args == '\0') + if (args == nullptr || *args == '\0') { *bg_char_p = 0; - return NULL; + return nullptr; } p = args + strlen (args); @@ -297,7 +297,7 @@ post_create_inferior (int from_tty) /* If the solist is global across processes, there's no need to refetch it here. */ if (!gdbarch_has_global_solist (target_gdbarch ())) - solib_add (NULL, 0, auto_solib_add); + solib_add (nullptr, 0, auto_solib_add); } } @@ -450,12 +450,12 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how) want them to go away (PR 2207). This is probably reasonable. */ /* If there were other args, beside '&', process them. */ - if (args != NULL) + if (args != nullptr) current_inferior ()->set_args (args); if (from_tty) { - uiout->field_string (NULL, "Starting program"); + uiout->field_string (nullptr, "Starting program"); uiout->text (": "); if (exec_file) uiout->field_string ("execfile", exec_file, @@ -472,7 +472,7 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how) from_tty); /* to_create_inferior should push the target, so after this point we shouldn't refer to run_target again. */ - run_target = NULL; + run_target = nullptr; infrun_debug_show_threads ("immediately after create_process", current_inferior ()->non_exited_threads ()); @@ -630,7 +630,7 @@ continue_1 (int all_threads) scoped_disable_commit_resumed disable_commit_resumed ("continue all threads in non-stop"); - iterate_over_threads (proceed_thread_callback, NULL); + iterate_over_threads (proceed_thread_callback, nullptr); if (current_ui->prompt_state == PROMPT_BLOCKED) { @@ -675,27 +675,27 @@ continue_command (const char *args, int from_tty) gdb::unique_xmalloc_ptr<char> stripped = strip_bg_char (args, &async_exec); args = stripped.get (); - if (args != NULL) + if (args != nullptr) { if (startswith (args, "-a")) { all_threads_p = true; args += sizeof ("-a") - 1; if (*args == '\0') - args = NULL; + args = nullptr; } } if (!non_stop && all_threads_p) error (_("`-a' is meaningless in all-stop mode.")); - if (args != NULL && all_threads_p) + if (args != nullptr && all_threads_p) error (_("Can't resume all threads and specify " "proceed count simultaneously.")); /* If we have an argument left, set proceed count of breakpoint we stopped at. */ - if (args != NULL) + if (args != nullptr) { bpstat *bs = nullptr; int num, stat; @@ -712,7 +712,7 @@ continue_command (const char *args, int from_tty) get_last_target_status (&last_target, &last_ptid, nullptr); tp = find_thread_ptid (last_target, last_ptid); } - if (tp != NULL) + if (tp != nullptr) bs = tp->control.stop_bpstat; while ((stat = bpstat_num (&bs, &num)) != 0) @@ -964,7 +964,7 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm) && inline_skipped_frames (tp)) { ptid_t resume_ptid; - const char *fn = NULL; + const char *fn = nullptr; symtab_and_line sal; struct symbol *sym; @@ -978,7 +978,7 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm) sal = find_frame_sal (frame); sym = get_frame_function (frame); - if (sym != NULL) + if (sym != nullptr) fn = sym->print_name (); if (sal.line == 0 @@ -1094,7 +1094,7 @@ jump_command (const char *arg, int from_tty) /* See if we are trying to jump to another function. */ fn = get_frame_function (get_current_frame ()); sfn = find_pc_function (sal.pc); - if (fn != NULL && sfn != fn) + if (fn != nullptr && sfn != fn) { if (!query (_("Line %d is not in `%s'. Jump anyway? "), sal.line, fn->print_name ())) @@ -1104,7 +1104,7 @@ jump_command (const char *arg, int from_tty) } } - if (sfn != NULL) + if (sfn != nullptr) { struct obj_section *section; @@ -1245,7 +1245,7 @@ queue_signal_command (const char *signum_exp, int from_tty) ensure_valid_thread (); ensure_not_running (); - if (signum_exp == NULL) + if (signum_exp == nullptr) error_no_arg (_("signal number")); /* It would be even slicker to make signal names be valid expressions, @@ -1356,7 +1356,7 @@ until_next_command (int from_tty) { struct bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (pc); - if (msymbol.minsym == NULL) + if (msymbol.minsym == nullptr) error (_("Execution is not within a known function.")); tp->control.step_range_start = msymbol.value_address (); @@ -1456,7 +1456,7 @@ advance_command (const char *arg, int from_tty) ensure_valid_thread (); ensure_not_running (); - if (arg == NULL) + if (arg == nullptr) error_no_arg (_("a location")); /* Find out whether we must run in the background. */ @@ -1498,17 +1498,17 @@ get_return_value (struct symbol *func_symbol, struct value *function) calls are made async, this will likely be made the norm. */ switch (gdbarch_return_value (gdbarch, function, value_type, - NULL, NULL, NULL)) + nullptr, nullptr, nullptr)) { case RETURN_VALUE_REGISTER_CONVENTION: case RETURN_VALUE_ABI_RETURNS_ADDRESS: case RETURN_VALUE_ABI_PRESERVES_ADDRESS: value = allocate_value (value_type); gdbarch_return_value (gdbarch, function, value_type, stop_regs, - value_contents_raw (value).data (), NULL); + value_contents_raw (value).data (), nullptr); break; case RETURN_VALUE_STRUCT_CONVENTION: - value = NULL; + value = nullptr; break; default: internal_error (_("bad switch")); @@ -1539,7 +1539,7 @@ struct return_value_info static void print_return_value_1 (struct ui_out *uiout, struct return_value_info *rv) { - if (rv->value != NULL) + if (rv->value != nullptr) { /* Print it. */ uiout->text ("Value returned is "); @@ -1578,7 +1578,7 @@ print_return_value_1 (struct ui_out *uiout, struct return_value_info *rv) void print_return_value (struct ui_out *uiout, struct return_value_info *rv) { - if (rv->type == NULL + if (rv->type == nullptr || check_typedef (rv->type)->code () == TYPE_CODE_VOID) return; @@ -1637,22 +1637,22 @@ finish_command_fsm::should_stop (struct thread_info *tp) { struct return_value_info *rv = &return_value_info; - if (function != NULL + if (function != nullptr && bpstat_find_breakpoint (tp->control.stop_bpstat, - breakpoint.get ()) != NULL) + breakpoint.get ()) != nullptr) { /* We're done. */ set_finished (); rv->type = function->type ()->target_type (); - if (rv->type == NULL) + if (rv->type == nullptr) internal_error (_("finish_command: function has no target type")); if (check_typedef (rv->type)->code () != TYPE_CODE_VOID) { struct value *func; - func = read_var_value (function, NULL, get_current_frame ()); + func = read_var_value (function, nullptr, get_current_frame ()); if (return_buf != 0) /* Retrieve return value from the buffer where it was saved. */ @@ -1660,7 +1660,7 @@ finish_command_fsm::should_stop (struct thread_info *tp) else rv->value = get_return_value (function, func); - if (rv->value != NULL) + if (rv->value != nullptr) rv->value_history_index = record_latest_value (rv->value); } } @@ -1717,7 +1717,7 @@ finish_backward (struct finish_command_fsm *sm) pc = get_frame_pc (get_current_frame ()); - if (find_pc_partial_function (pc, NULL, &func_addr, NULL) == 0) + if (find_pc_partial_function (pc, nullptr, &func_addr, nullptr) == 0) error (_("Cannot find bounds of current function")); sal = find_pc_line (func_addr, 0); @@ -1734,7 +1734,7 @@ finish_backward (struct finish_command_fsm *sm) if (sal.pc != pc) { - frame_info_ptr frame = get_selected_frame (NULL); + frame_info_ptr frame = get_selected_frame (nullptr); struct gdbarch *gdbarch = get_frame_arch (frame); /* Set a step-resume at the function's entry point. Once that's @@ -1775,7 +1775,7 @@ finish_forward (struct finish_command_fsm *sm, frame_info_ptr frame) bp_finish); /* set_momentary_breakpoint invalidates FRAME. */ - frame = NULL; + frame = nullptr; set_longjmp_breakpoint (tp, frame_id); @@ -1797,11 +1797,11 @@ skip_finish_frames (frame_info_ptr frame) start = frame; frame = skip_tailcall_frames (frame); - if (frame == NULL) + if (frame == nullptr) break; frame = skip_unwritable_frames (frame); - if (frame == NULL) + if (frame == nullptr) break; } while (start != frame); @@ -1867,7 +1867,7 @@ finish_command (const char *arg, int from_tty) if (from_tty) { gdb_printf (_("Run till exit from ")); - print_stack_frame (get_selected_frame (NULL), 1, LOCATION, 0); + print_stack_frame (get_selected_frame (nullptr), 1, LOCATION, 0); } proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT); @@ -1875,13 +1875,13 @@ finish_command (const char *arg, int from_tty) } /* Find the function we will return from. */ - frame_info_ptr callee_frame = get_selected_frame (NULL); + frame_info_ptr callee_frame = get_selected_frame (nullptr); sm->function = find_pc_function (get_frame_pc (callee_frame)); sm->return_buf = 0; /* Initialize buffer address is not available. */ /* Determine the return convention. If it is RETURN_VALUE_STRUCT_CONVENTION, attempt to determine the address of the return buffer. */ - if (sm->function != NULL) + if (sm->function != nullptr) { enum return_value_convention return_value; struct gdbarch *gdbarch = get_frame_arch (callee_frame); @@ -1890,9 +1890,9 @@ finish_command (const char *arg, int from_tty) = check_typedef (sm->function->type ()->target_type ()); return_value = gdbarch_return_value (gdbarch, - read_var_value (sm->function, NULL, + read_var_value (sm->function, nullptr, callee_frame), - val_type, NULL, NULL, NULL); + val_type, nullptr, nullptr, nullptr); if (return_value == RETURN_VALUE_STRUCT_CONVENTION && val_type->code () != TYPE_CODE_VOID) @@ -1908,7 +1908,7 @@ finish_command (const char *arg, int from_tty) gdb_printf (_("Run back to call of ")); else { - if (sm->function != NULL && TYPE_NO_RETURN (sm->function->type ()) + if (sm->function != nullptr && TYPE_NO_RETURN (sm->function->type ()) && !query (_("warning: Function %s does not return normally.\n" "Try to finish anyway? "), sm->function->print_name ())) @@ -1926,7 +1926,7 @@ finish_command (const char *arg, int from_tty) { frame = skip_finish_frames (frame); - if (frame == NULL) + if (frame == nullptr) error (_("Cannot find the caller frame.")); finish_forward (sm, frame); @@ -2029,7 +2029,7 @@ environment_info (const char *var, int from_tty) { char **envp = current_inferior ()->environment.envp (); - for (int idx = 0; envp[idx] != NULL; ++idx) + for (int idx = 0; envp[idx] != nullptr; ++idx) { gdb_puts (envp[idx]); gdb_puts ("\n"); @@ -2141,7 +2141,7 @@ path_command (const char *dirname, int from_tty) mod_path (dirname, exec_path); current_inferior ()->environment.set (path_var_name, exec_path.c_str ()); if (from_tty) - path_info (NULL, from_tty); + path_info (nullptr, from_tty); } @@ -2288,7 +2288,7 @@ registers_info (const char *addr_exp, int fpregs) if (!target_has_registers ()) error (_("The program has no registers now.")); - frame = get_selected_frame (NULL); + frame = get_selected_frame (nullptr); gdbarch = get_frame_arch (frame); if (!addr_exp) @@ -2364,7 +2364,7 @@ registers_info (const char *addr_exp, int fpregs) break; } } - if (group != NULL) + if (group != nullptr) { int regnum; @@ -2430,7 +2430,7 @@ info_vector_command (const char *args, int from_tty) if (!target_has_registers ()) error (_("The program has no registers now.")); - print_vector_info (gdb_stdout, get_selected_frame (NULL), args); + print_vector_info (gdb_stdout, get_selected_frame (nullptr), args); } /* Kill the inferior process. Make us have no inferior. */ @@ -2498,7 +2498,7 @@ setup_inferior (int from_tty) /* If no exec file is yet known, try to determine it from the process itself. */ - if (get_exec_file (0) == NULL) + if (get_exec_file (0) == nullptr) exec_file_locate_attach (inferior_ptid.pid (), 1, from_tty); else { @@ -2644,7 +2644,7 @@ attach_command (const char *args, int from_tty) attach_target->attach (args, from_tty); /* to_attach should push the target, so after this point we shouldn't refer to attach_target again. */ - attach_target = NULL; + attach_target = nullptr; infrun_debug_show_threads ("immediately after attach", current_inferior ()->non_exited_threads ()); @@ -2826,7 +2826,7 @@ detach_command (const char *args, int from_tty) /* If the solist is global across inferiors, don't clear it when we detach from a single inferior. */ if (!gdbarch_has_global_solist (target_gdbarch ())) - no_shared_libraries (NULL, from_tty); + no_shared_libraries (nullptr, from_tty); if (deprecated_detach_hook) deprecated_detach_hook (); @@ -2852,7 +2852,7 @@ disconnect_command (const char *args, int from_tty) query_if_trace_running (from_tty); disconnect_tracing (); target_disconnect (args, from_tty); - no_shared_libraries (NULL, from_tty); + no_shared_libraries (nullptr, from_tty); init_thread_list (); if (deprecated_detach_hook) deprecated_detach_hook (); @@ -2921,7 +2921,7 @@ interrupt_command (const char *args, int from_tty) dont_repeat (); /* Not for the faint of heart. */ - if (args != NULL + if (args != nullptr && startswith (args, "-a")) all_threads = 1; @@ -2959,7 +2959,7 @@ info_float_command (const char *args, int from_tty) if (!target_has_registers ()) error (_("The program has no registers now.")); - frame = get_selected_frame (NULL); + frame = get_selected_frame (nullptr); gdbarch_print_float_info (get_frame_arch (frame), gdb_stdout, frame, args); } @@ -3085,7 +3085,7 @@ void _initialize_infcmd () { static struct cmd_list_element *info_proc_cmdlist; - struct cmd_list_element *c = NULL; + struct cmd_list_element *c = nullptr; const char *cmd_name; /* Add the filename of the terminal connected to inferior I/O. */ @@ -3100,8 +3100,8 @@ is restored."), show_inferior_tty_command, &setlist, &showlist); cmd_name = "inferior-tty"; - c = lookup_cmd (&cmd_name, setlist, "", NULL, -1, 1); - gdb_assert (c != NULL); + c = lookup_cmd (&cmd_name, setlist, "", nullptr, -1, 1); + gdb_assert (c != nullptr); add_alias_cmd ("tty", c, class_run, 0, &cmdlist); cmd_name = "args"; @@ -3113,8 +3113,8 @@ Follow this command with any number of args, to be passed to the program."), set_args_command, show_args_command, &setlist, &showlist); - c = lookup_cmd (&cmd_name, setlist, "", NULL, -1, 1); - gdb_assert (c != NULL); + c = lookup_cmd (&cmd_name, setlist, "", nullptr, -1, 1); + gdb_assert (c != nullptr); set_cmd_completer (c, filename_completer); cmd_name = "cwd"; @@ -3132,8 +3132,8 @@ working directory."), set_cwd_command, show_cwd_command, &setlist, &showlist); - c = lookup_cmd (&cmd_name, setlist, "", NULL, -1, 1); - gdb_assert (c != NULL); + c = lookup_cmd (&cmd_name, setlist, "", nullptr, -1, 1); + gdb_assert (c != nullptr); set_cmd_completer (c, filename_completer); c = add_cmd ("environment", no_class, environment_info, _("\ @@ -3404,8 +3404,8 @@ List all available info about the specified process."), add_setshow_boolean_cmd ("finish", class_support, &finish_print, _("\ Set whether `finish' prints the return value."), _("\ -Show whether `finish' prints the return value."), NULL, - NULL, +Show whether `finish' prints the return value."), nullptr, + nullptr, show_print_finish, &setprintlist, &showprintlist); } |