diff options
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r-- | gdb/infcmd.c | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c index b6b21a4..8978c8a 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1,6 +1,6 @@ /* Memory-access and commands for "inferior" process, for GDB. - Copyright (C) 1986-2024 Free Software Foundation, Inc. + Copyright (C) 1986-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -224,14 +224,11 @@ strip_bg_char (const char *args, int *bg_char_p) return make_unique_xstrdup (args); } -/* Common actions to take after creating any sort of inferior, by any - means (running, attaching, connecting, et cetera). The target - should be stopped. */ +/* See inferior.h. */ void -post_create_inferior (int from_tty) +post_create_inferior (int from_tty, bool set_pspace_solib_ops) { - /* Be sure we own the terminal in case write operations are performed. */ target_terminal::ours_for_output (); @@ -261,6 +258,10 @@ post_create_inferior (int from_tty) throw; } + if (set_pspace_solib_ops) + current_program_space->set_solib_ops + (gdbarch_make_solib_ops (current_inferior ()->arch ())); + if (current_program_space->exec_bfd ()) { const unsigned solib_add_generation @@ -482,7 +483,7 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how) /* Pass zero for FROM_TTY, because at this point the "run" command has done its thing; now we are setting up the running program. */ - post_create_inferior (0); + post_create_inferior (0, true); /* Queue a pending event so that the program stops immediately. */ if (run_how == RUN_STOP_AT_FIRST_INSN) @@ -517,12 +518,6 @@ run_command (const char *args, int from_tty) static void start_command (const char *args, int from_tty) { - /* Some languages such as Ada need to search inside the program - minimal symbols for the location where to put the temporary - breakpoint before starting. */ - if (!have_minimal_symbols (current_program_space)) - error (_("No symbol table loaded. Use the \"file\" command.")); - /* Run the program until reaching the main procedure... */ run_command_1 (args, from_tty, RUN_STOP_AT_MAIN); } @@ -536,8 +531,8 @@ starti_command (const char *args, int from_tty) run_command_1 (args, from_tty, RUN_STOP_AT_FIRST_INSN); } -static int -proceed_thread_callback (struct thread_info *thread, void *arg) +static bool +proceed_thread_callback (struct thread_info *thread) { /* We go through all threads individually instead of compressing into a single target `resume_all' request, because some threads @@ -549,15 +544,15 @@ proceed_thread_callback (struct thread_info *thread, void *arg) thread stopped until I say otherwise', then we can optimize this. */ if (thread->state != THREAD_STOPPED) - return 0; + return false; if (!thread->inf->has_execution ()) - return 0; + return false; switch_to_thread (thread); clear_proceed_status (0); proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT); - return 0; + return false; } static void @@ -614,7 +609,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, nullptr); + iterate_over_threads (proceed_thread_callback); if (current_ui->prompt_state == PROMPT_BLOCKED) { @@ -2121,9 +2116,10 @@ static const char path_var_name[] = "PATH"; static void path_info (const char *args, int from_tty) { - gdb_puts ("Executable and object file path: "); - gdb_puts (current_inferior ()->environment.get (path_var_name)); - gdb_puts ("\n"); + const char *env = current_inferior ()->environment.get (path_var_name); + + gdb_printf (_("Executable and object file path: %s\n"), + env != nullptr ? env : ""); } /* Add zero or more directories to the front of the execution path. */ @@ -2511,7 +2507,7 @@ setup_inferior (int from_tty) /* Take any necessary post-attaching actions for this platform. */ target_post_attach (inferior_ptid.pid ()); - post_create_inferior (from_tty); + post_create_inferior (from_tty, true); } /* What to do after the first program stops after attaching. */ @@ -3085,9 +3081,7 @@ use \"set args\" without arguments.\n\ \n\ To start the inferior without using a shell, use \"set startup-with-shell off\"." -void _initialize_infcmd (); -void -_initialize_infcmd () +INIT_GDB_FILE (infcmd) { static struct cmd_list_element *info_proc_cmdlist; struct cmd_list_element *c = nullptr; |