From: Carl Love Date: Wed, 16 Nov 2022 17:04:51 +0000 (-0600) Subject: Change NULL to nullptr in gdb/infcmd.c and gdb/infrun.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=03acd4d85430c8afaa72db4daf1421ee82df53ec;p=binutils-gdb.git 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. --- diff --git a/gdb/infcmd.c b/gdb/infcmd.c index a72df2d6a01..f7bce0d0399 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 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); } diff --git a/gdb/infrun.c b/gdb/infrun.c index 6da46b75ac7..debc6054624 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -388,7 +388,7 @@ static const char follow_fork_mode_parent[] = "parent"; static const char *const follow_fork_mode_kind_names[] = { follow_fork_mode_child, follow_fork_mode_parent, - NULL + nullptr }; static const char *follow_fork_mode_string = follow_fork_mode_parent; @@ -644,8 +644,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \ if (has_vforked) { - gdb_assert (child_inf->vfork_parent == NULL); - gdb_assert (parent_inf->vfork_child == NULL); + gdb_assert (child_inf->vfork_parent == nullptr); + gdb_assert (parent_inf->vfork_child == nullptr); child_inf->vfork_parent = parent_inf; child_inf->pending_detach = 0; parent_inf->vfork_child = child_inf; @@ -700,12 +700,12 @@ follow_fork () followed fork child thread should have a copy of most of the parent thread structure's run control related fields, not just these. Initialized to avoid "may be used uninitialized" warnings from gcc. */ - struct breakpoint *step_resume_breakpoint = NULL; - struct breakpoint *exception_resume_breakpoint = NULL; + struct breakpoint *step_resume_breakpoint = nullptr; + struct breakpoint *exception_resume_breakpoint = nullptr; CORE_ADDR step_range_start = 0; CORE_ADDR step_range_end = 0; int current_line = 0; - symtab *current_symtab = NULL; + symtab *current_symtab = nullptr; struct frame_id step_frame_id = { 0 }; if (!non_stop) @@ -930,8 +930,8 @@ handle_vfork_child_exec_or_exit (int exec) /* This exec or exit marks the end of the shared memory region between the parent and the child. Break the bonds. */ inferior *vfork_parent = inf->vfork_parent; - inf->vfork_parent->vfork_child = NULL; - inf->vfork_parent = NULL; + inf->vfork_parent->vfork_child = nullptr; + inf->vfork_parent = nullptr; /* If the user wanted to detach from the parent, now is the time. */ @@ -964,8 +964,8 @@ handle_vfork_child_exec_or_exit (int exec) pspace = inf->pspace; aspace = inf->aspace; - inf->aspace = NULL; - inf->pspace = NULL; + inf->aspace = nullptr; + inf->pspace = nullptr; if (print_inferior_events) { @@ -1104,7 +1104,7 @@ static const char *const follow_exec_mode_names[] = { follow_exec_mode_new, follow_exec_mode_same, - NULL, + nullptr, }; static const char *follow_exec_mode_string = follow_exec_mode_same; @@ -1178,9 +1178,9 @@ follow_exec (ptid_t ptid, const char *exec_file_target) breakpoint or similar, it's gone now. We cannot truly step-to-next statement through an exec(). */ thread_info *th = inferior_thread (); - th->control.step_resume_breakpoint = NULL; - th->control.exception_resume_breakpoint = NULL; - th->control.single_step_breakpoints = NULL; + th->control.step_resume_breakpoint = nullptr; + th->control.exception_resume_breakpoint = nullptr; + th->control.single_step_breakpoints = nullptr; th->control.step_range_start = 0; th->control.step_range_end = 0; @@ -1203,13 +1203,13 @@ follow_exec (ptid_t ptid, const char *exec_file_target) breakpoint_init_inferior (inf_execd); gdb::unique_xmalloc_ptr exec_file_host - = exec_file_find (exec_file_target, NULL); + = exec_file_find (exec_file_target, nullptr); /* If we were unable to map the executable target pathname onto a host pathname, tell the user that. Otherwise GDB's subsequent behavior is confusing. Maybe it would even be better to stop at this point so that the user can specify a file manually before continuing. */ - if (exec_file_host == NULL) + if (exec_file_host == nullptr) warning (_("Could not load symbols for executable %s.\n" "Do you need \"set sysroot\"?"), exec_file_target); @@ -1220,7 +1220,7 @@ follow_exec (ptid_t ptid, const char *exec_file_target) /* Also, loading a symbol file below may trigger symbol lookups, and we don't want those to be satisfied by the libraries of the previous incarnation of this process. */ - no_shared_libraries (NULL, 0); + no_shared_libraries (nullptr, 0); struct inferior *inf = current_inferior (); @@ -1380,7 +1380,7 @@ static void clear_step_over_info (void) { infrun_debug_printf ("clearing step over info"); - step_over_info.aspace = NULL; + step_over_info.aspace = nullptr; step_over_info.address = 0; step_over_info.nonsteppable_watchpoint_p = 0; step_over_info.thread = -1; @@ -1392,7 +1392,7 @@ int stepping_past_instruction_at (struct address_space *aspace, CORE_ADDR address) { - return (step_over_info.aspace != NULL + return (step_over_info.aspace != nullptr && breakpoint_address_match (aspace, address, step_over_info.aspace, step_over_info.address)); @@ -1420,7 +1420,7 @@ stepping_past_nonsteppable_watchpoint (void) static bool step_over_info_valid_p (void) { - return (step_over_info.aspace != NULL + return (step_over_info.aspace != nullptr || stepping_past_nonsteppable_watchpoint ()); } @@ -1516,7 +1516,7 @@ step_over_info_valid_p (void) static bool displaced_step_in_progress_thread (thread_info *thread) { - gdb_assert (thread != NULL); + gdb_assert (thread != nullptr); return thread->displaced_step_state.in_progress (); } @@ -2101,7 +2101,7 @@ static const char *const scheduler_enums[] = { schedlock_on, schedlock_step, schedlock_replay, - NULL + nullptr }; static const char *scheduler_mode = schedlock_replay; static void @@ -2195,7 +2195,7 @@ process_stratum_target * user_visible_resume_target (ptid_t resume_ptid) { return (resume_ptid == minus_one_ptid && sched_multi - ? NULL + ? nullptr : current_inferior ()->process_target ()); } @@ -2417,7 +2417,7 @@ resume_1 (enum gdb_signal sig) clear_step_over_info (); tp->control.trap_expected = 0; - if (tp->control.step_resume_breakpoint == NULL) + if (tp->control.step_resume_breakpoint == nullptr) { /* Set a "high-priority" step-resume, as we don't want user breakpoints at PC to trigger (again) when this @@ -2559,7 +2559,7 @@ resume_1 (enum gdb_signal sig) a step-resume breakpoint set on the earlier handler. We cannot set another step-resume breakpoint; just continue on until the original breakpoint is hit. */ - if (tp->control.step_resume_breakpoint == NULL) + if (tp->control.step_resume_breakpoint == nullptr) { insert_hp_step_resume_breakpoint_at_frame (get_current_frame ()); tp->step_after_step_resume_breakpoint = 1; @@ -2768,7 +2768,7 @@ clear_proceed_status_thread (struct thread_info *tp) tp->control.step_frame_id = null_frame_id; tp->control.step_stack_frame_id = null_frame_id; tp->control.step_over_calls = STEP_OVER_UNDEBUGGABLE; - tp->control.step_start_function = NULL; + tp->control.step_start_function = nullptr; tp->stop_requested = 0; tp->control.stop_step = 0; @@ -3667,12 +3667,12 @@ do_target_wait_1 (inferior *inf, ptid_t ptid, /* We have a specific thread to check. */ tp = find_thread_ptid (inf, ptid); - gdb_assert (tp != NULL); + gdb_assert (tp != nullptr); if (!tp->has_pending_waitstatus ()) - tp = NULL; + tp = nullptr; } - if (tp != NULL + if (tp != nullptr && (tp->stop_reason () == TARGET_STOPPED_BY_SW_BREAKPOINT || tp->stop_reason () == TARGET_STOPPED_BY_HW_BREAKPOINT)) { @@ -3713,7 +3713,7 @@ do_target_wait_1 (inferior *inf, ptid_t ptid, } } - if (tp != NULL) + if (tp != nullptr) { infrun_debug_printf ("Using pending wait status %s for %s.", tp->pending_waitstatus ().to_string ().c_str (), @@ -4261,7 +4261,7 @@ fetch_inferior_event () if (should_notify_stop) { /* We may not find an inferior if this was a process exit. */ - if (inf == NULL || inf->control.stop_soon == NO_STOP_QUIETLY) + if (inf == nullptr || inf->control.stop_soon == NO_STOP_QUIETLY) proceeded = normal_stop (); } @@ -4560,7 +4560,7 @@ static bool stepped_in_from (frame_info_ptr frame, struct frame_id step_frame_id) { for (frame = get_prev_frame (frame); - frame != NULL; + frame != nullptr; frame = get_prev_frame (frame)) { if (get_frame_id (frame) == step_frame_id) @@ -4587,9 +4587,9 @@ inline_frame_is_marked_for_skip (bool prev_frame, struct thread_info *tp) if (prev_frame) frame = get_prev_frame (frame); - for (; frame != NULL; frame = get_prev_frame (frame)) + for (; frame != nullptr; frame = get_prev_frame (frame)) { - const char *fn = NULL; + const char *fn = nullptr; symtab_and_line sal; struct symbol *sym; @@ -4601,7 +4601,7 @@ inline_frame_is_marked_for_skip (bool prev_frame, struct thread_info *tp) sal = find_frame_sal (frame); sym = get_frame_function (frame); - if (sym != NULL) + if (sym != nullptr) fn = sym->print_name (); if (sal.line != 0 @@ -4726,7 +4726,7 @@ get_inferior_stop_soon (execution_control_state *ecs) { struct inferior *inf = find_inferior_ptid (ecs->target, ecs->ptid); - gdb_assert (inf != NULL); + gdb_assert (inf != nullptr); return inf->control.stop_soon; } @@ -4764,7 +4764,7 @@ wait_one () for (inferior *inf : all_inferiors ()) { process_stratum_target *target = inf->process_target (); - if (target == NULL + if (target == nullptr || !target->is_async_p () || !target->threads_executing) continue; @@ -4795,7 +4795,7 @@ wait_one () for (inferior *inf : all_inferiors ()) { process_stratum_target *target = inf->process_target (); - if (target == NULL + if (target == nullptr || !target->is_async_p () || !target->threads_executing) continue; @@ -4811,12 +4811,12 @@ wait_one () /* No waitable targets left. All must be stopped. */ target_waitstatus ws; ws.set_no_resumed (); - return {NULL, minus_one_ptid, std::move (ws)}; + return {nullptr, minus_one_ptid, std::move (ws)}; } QUIT; - int numfds = interruptible_select (nfds, &readfds, 0, NULL, 0); + int numfds = interruptible_select (nfds, &readfds, 0, nullptr, 0); if (numfds < 0) { if (errno == EINTR) @@ -4987,7 +4987,7 @@ handle_one (const wait_one_event &event) else { thread_info *t = find_thread_ptid (event.target, event.ptid); - if (t == NULL) + if (t == nullptr) t = add_thread (event.target, event.ptid); t->stop_requested = 0; @@ -5393,7 +5393,7 @@ handle_inferior_event (struct execution_control_state *ecs) { ecs->event_thread = find_thread_ptid (ecs->target, ecs->ptid); /* If it's a new thread, add it to the thread database. */ - if (ecs->event_thread == NULL) + if (ecs->event_thread == nullptr) ecs->event_thread = add_thread (ecs->target, ecs->ptid); /* Disable range stepping. If the next step request could use a @@ -6064,8 +6064,8 @@ finish_step_over (struct execution_control_state *ecs) return 0; pending = iterate_over_threads (resumed_thread_with_pending_status, - NULL); - if (pending != NULL) + nullptr); + if (pending != nullptr) { struct thread_info *tp = ecs->event_thread; struct regcache *regcache; @@ -6542,7 +6542,7 @@ handle_signal_stop (struct execution_control_state *ecs) if (ecs->event_thread->prev_pc == ecs->event_thread->stop_pc () && ecs->event_thread->control.trap_expected - && ecs->event_thread->control.step_resume_breakpoint == NULL) + && ecs->event_thread->control.step_resume_breakpoint == nullptr) { /* We were just starting a new sequence, attempting to single-step off of a breakpoint and expecting a SIGTRAP. @@ -6574,7 +6574,7 @@ handle_signal_stop (struct execution_control_state *ecs) || ecs->event_thread->control.step_range_end == 1) && (get_stack_frame_id (frame) == ecs->event_thread->control.step_stack_frame_id) - && ecs->event_thread->control.step_resume_breakpoint == NULL) + && ecs->event_thread->control.step_resume_breakpoint == nullptr) { /* The inferior is about to take a signal that will take it out of the single step range. Set a breakpoint at the @@ -6719,7 +6719,7 @@ process_event_stop_test (struct execution_control_state *ecs) infrun_debug_printf ("BPSTAT_WHAT_CLEAR_LONGJMP_RESUME"); gdb_assert (ecs->event_thread->control.exception_resume_breakpoint - != NULL); + != nullptr); delete_exception_resume_breakpoint (ecs->event_thread); if (what.is_longjmp) @@ -6853,7 +6853,7 @@ process_event_stop_test (struct execution_control_state *ecs) struct breakpoint *sr_bp = ecs->event_thread->control.step_resume_breakpoint; - if (sr_bp != NULL + if (sr_bp != nullptr && sr_bp->loc->permanent && sr_bp->type == bp_hp_step_resume && sr_bp->loc->address == ecs->event_thread->prev_pc) @@ -7269,7 +7269,7 @@ process_event_stop_test (struct execution_control_state *ecs) the trampoline processing logic, however, there are some trampolines that have no names, so we should do trampoline handling first. */ if (ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE - && ecs->stop_func_name == NULL + && ecs->stop_func_name == nullptr && stop_pc_sal.line == 0) { infrun_debug_printf ("stepped into undebuggable function"); @@ -7771,7 +7771,7 @@ static bool currently_stepping (struct thread_info *tp) { return ((tp->control.step_range_end - && tp->control.step_resume_breakpoint == NULL) + && tp->control.step_resume_breakpoint == nullptr) || tp->control.trap_expected || tp->stepped_breakpoint || bpstat_should_step ()); @@ -7789,7 +7789,7 @@ handle_step_into_function (struct gdbarch *gdbarch, compunit_symtab *cust = find_pc_compunit_symtab (ecs->event_thread->stop_pc ()); - if (cust != NULL && cust->language () != language_asm) + if (cust != nullptr && cust->language () != language_asm) ecs->stop_func_start = gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start); @@ -7868,7 +7868,7 @@ handle_step_into_function_backward (struct gdbarch *gdbarch, fill_in_stop_func (gdbarch, ecs); cust = find_pc_compunit_symtab (ecs->event_thread->stop_pc ()); - if (cust != NULL && cust->language () != language_asm) + if (cust != nullptr && cust->language () != language_asm) ecs->stop_func_start = gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start); @@ -7904,7 +7904,7 @@ insert_step_resume_breakpoint_at_sal_1 (struct gdbarch *gdbarch, /* There should never be more than one step-resume or longjmp-resume breakpoint per thread, so we should never be setting a new step_resume_breakpoint when one is already active. */ - gdb_assert (inferior_thread ()->control.step_resume_breakpoint == NULL); + gdb_assert (inferior_thread ()->control.step_resume_breakpoint == nullptr); gdb_assert (sr_type == bp_step_resume || sr_type == bp_hp_step_resume); infrun_debug_printf ("inserting step-resume breakpoint at %s", @@ -7934,7 +7934,7 @@ insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch, static void insert_hp_step_resume_breakpoint_at_frame (frame_info_ptr return_frame) { - gdb_assert (return_frame != NULL); + gdb_assert (return_frame != nullptr); struct gdbarch *gdbarch = get_frame_arch (return_frame); @@ -7992,7 +7992,7 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc) /* There should never be more than one longjmp-resume breakpoint per thread, so we should never be setting a new longjmp_resume_breakpoint when one is already active. */ - gdb_assert (inferior_thread ()->control.exception_resume_breakpoint == NULL); + gdb_assert (inferior_thread ()->control.exception_resume_breakpoint == nullptr); infrun_debug_printf ("inserting longjmp-resume breakpoint at %s", paddress (gdbarch, pc)); @@ -8036,7 +8036,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp, bp_exception_resume).release (); /* set_momentary_breakpoint_at_pc invalidates FRAME. */ - frame = NULL; + frame = nullptr; bp->thread = tp->global_num; inferior_thread ()->control.exception_resume_breakpoint = bp; @@ -8241,7 +8241,7 @@ keep_going_pass_signal (struct execution_control_state *ecs) ecs->event_thread->global_num); } else if (remove_wps) - set_step_over_info (NULL, 0, remove_wps, -1); + set_step_over_info (nullptr, 0, remove_wps, -1); /* If we now need to do an in-line step-over, we need to stop all other threads. Note this must be done before @@ -8403,7 +8403,7 @@ print_signal_received_reason (struct ui_out *uiout, enum gdb_signal siggnal) uiout->field_string ("thread-id", print_thread_id (thr)); const char *name = thread_name (thr); - if (name != NULL) + if (name != nullptr) { uiout->text (" \""); uiout->field_string ("name", name); @@ -8501,7 +8501,7 @@ print_stop_location (const target_waitstatus &ws) LOCATION: Print only location SRC_AND_LOC: Print location and source line. */ if (do_frame_printing) - print_stack_frame (get_selected_frame (NULL), 0, source_flag, 1); + print_stack_frame (get_selected_frame (nullptr), 0, source_flag, 1); } /* See infrun.h. */ @@ -8605,7 +8605,7 @@ stop_context::changed () const return true; if (inf_num != current_inferior ()->num) return true; - if (thread != NULL && thread->state != THREAD_STOPPED) + if (thread != nullptr && thread->state != THREAD_STOPPED) return true; if (get_stop_id () != stop_id) return true; @@ -8782,7 +8782,7 @@ normal_stop (void) gdb::observers::normal_stop.notify (inferior_thread ()->control.stop_bpstat, stop_print_frame); else - gdb::observers::normal_stop.notify (NULL, stop_print_frame); + gdb::observers::normal_stop.notify (nullptr, stop_print_frame); annotate_stopped (); @@ -8912,7 +8912,7 @@ handle_command (const char *args, int from_tty) enum gdb_signal oursig; int allsigs; - if (args == NULL) + if (args == nullptr) { error_no_arg (_("signal to handle")); } @@ -9088,7 +9088,7 @@ handle_completer (struct cmd_list_element *ignore, "noignore", "noprint", "nopass", - NULL, + nullptr, }; signal_completer (ignore, tracker, text, word); @@ -9172,7 +9172,7 @@ siginfo_value_read (struct value *v) transferred = target_read (current_inferior ()->top_target (), TARGET_OBJECT_SIGNAL_INFO, - NULL, + nullptr, value_contents_all_raw (v).data (), value_offset (v), value_type (v)->length ()); @@ -9195,7 +9195,7 @@ siginfo_value_write (struct value *v, struct value *fromval) transferred = target_write (current_inferior ()->top_target (), TARGET_OBJECT_SIGNAL_INFO, - NULL, + nullptr, value_contents_all_raw (fromval).data (), value_offset (v), value_type (fromval)->length ()); @@ -9224,7 +9224,7 @@ siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var, { struct type *type = gdbarch_get_siginfo_type (gdbarch); - return allocate_computed_value (type, &siginfo_value_funcs, NULL); + return allocate_computed_value (type, &siginfo_value_funcs, nullptr); } return allocate_value (builtin_type (gdbarch)->builtin_void); @@ -9259,7 +9259,7 @@ public: siginfo_data.reset ((gdb_byte *) xmalloc (len)); if (target_read (current_inferior ()->top_target (), - TARGET_OBJECT_SIGNAL_INFO, NULL, + TARGET_OBJECT_SIGNAL_INFO, nullptr, siginfo_data.get (), 0, len) != len) { /* Errors ignored. */ @@ -9295,7 +9295,7 @@ public: /* Errors ignored. */ target_write (current_inferior ()->top_target (), - TARGET_OBJECT_SIGNAL_INFO, NULL, + TARGET_OBJECT_SIGNAL_INFO, nullptr, m_siginfo_data.get (), 0, type->length ()); } @@ -9399,8 +9399,8 @@ save_infcall_control_state () inf_status->thread_control = tp->control; inf_status->inferior_control = inf->control; - tp->control.step_resume_breakpoint = NULL; - tp->control.exception_resume_breakpoint = NULL; + tp->control.step_resume_breakpoint = nullptr; + tp->control.exception_resume_breakpoint = nullptr; /* Save original bpstat chain to INF_STATUS; replace it in TP with copy of chain. If caller's caller is walking the chain, they'll be happier if we @@ -9490,7 +9490,7 @@ static const char *exec_direction = exec_forward; static const char *const exec_direction_names[] = { exec_forward, exec_reverse, - NULL + nullptr }; static void @@ -9541,7 +9541,7 @@ show_schedule_multiple (struct ui_file *file, int from_tty, static const struct internalvar_funcs siginfo_funcs = { siginfo_make_value, - NULL, + nullptr, }; /* Callback for infrun's target events source. This is marked when a @@ -9637,7 +9637,7 @@ _initialize_infrun () /* Register extra event sources in the event loop. */ infrun_async_inferior_event_token - = create_async_event_handler (infrun_async_inferior_event_handler, NULL, + = create_async_event_handler (infrun_async_inferior_event_handler, nullptr, "infrun"); cmd_list_element *info_signals_cmd @@ -9683,7 +9683,7 @@ of the program stops."), &cmdlist); _("Set inferior debugging."), _("Show inferior debugging."), _("When non-zero, inferior specific debugging is enabled."), - NULL, show_debug_infrun, &setdebuglist, &showdebuglist); + nullptr, show_debug_infrun, &setdebuglist, &showdebuglist); add_setshow_boolean_cmd ("non-stop", no_class, &non_stop_1, _("\ @@ -9786,7 +9786,7 @@ A fork or vfork creates a new process. follow-fork-mode can be:\n\ child - the new process is debugged after a fork\n\ The unfollowed process will continue to run.\n\ By default, the debugger will follow the parent process."), - NULL, + nullptr, show_follow_fork_mode_string, &setlist, &showlist); @@ -9810,7 +9810,7 @@ the inferior. Restarting the inferior after the exec call restarts\n\ the executable the process was running after the exec call.\n\ \n\ By default, the debugger will use the same inferior."), - NULL, + nullptr, show_follow_exec_mode_string, &setlist, &showlist); @@ -9837,7 +9837,7 @@ threads of all processes. When off (which is the default), execution\n\ commands only resume the threads of the current process. The set of\n\ threads that are resumed is further refined by the scheduler-locking\n\ mode (see help set scheduler-locking)."), - NULL, + nullptr, show_schedule_multiple, &setlist, &showlist); @@ -9847,7 +9847,7 @@ Show mode of the step operation."), _("\ When set, doing a step over a function without debug line information\n\ will stop at the first instruction of that function. Otherwise, the\n\ function is skipped and the step command stops at a different source line."), - NULL, + nullptr, show_step_stop_if_no_debug, &setlist, &showlist); @@ -9861,7 +9861,7 @@ stepping to step over breakpoints, even if such is supported by the target\n\ architecture. If auto (which is the default), gdb will use displaced stepping\n\ if the target architecture supports it and non-stop mode is active, but will not\n\ use it in all-stop mode (see help set non-stop)."), - NULL, + nullptr, show_can_use_displaced_stepping, &setlist, &showlist); @@ -9879,7 +9879,7 @@ Options are 'forward' or 'reverse'."), Set whether gdb will detach the child of a fork."), _("\ Show whether gdb will detach the child of a fork."), _("\ Tells gdb whether to detach the child of a fork."), - NULL, NULL, &setlist, &showlist); + nullptr, nullptr, &setlist, &showlist); /* Set/show disable address space randomization mode. */ @@ -9910,7 +9910,7 @@ enabled by default on some platforms."), value with a void typed value, and when we get here, gdbarch isn't initialized yet. At this point, we're quite sure there isn't another convenience variable of the same name. */ - create_internalvar_type_lazy ("_siginfo", &siginfo_funcs, NULL); + create_internalvar_type_lazy ("_siginfo", &siginfo_funcs, nullptr); add_setshow_boolean_cmd ("observer", no_class, &observer_mode_1, _("\