From c20cb6860c27d6ef15a1e561f4be78e7b85952ac Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 29 Oct 2020 15:04:33 -0600 Subject: Remove exec_filename macro This removes the exec_filename macro, replacing it with uses of the member of current_program_space. This also renames that member, and changes it to be a unique pointer. gdb/ChangeLog 2020-10-29 Tom Tromey * progspace.h (struct program_space) : Rename from pspace_exec_filename. Now a unique_xmalloc_ptr. * inferior.c (print_selected_inferior): Update. (print_inferior): Update. * mi/mi-main.c (print_one_inferior): Update. * exec.h (exec_filename): Remove macro. * corefile.c (get_exec_file): Update. * exec.c (exec_close): Update. (exec_file_attach): Update. * progspace.c (clone_program_space): Update. (print_program_space): Update. --- gdb/exec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'gdb/exec.c') diff --git a/gdb/exec.c b/gdb/exec.c index 9bdd87d..d27949c 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -167,8 +167,7 @@ exec_close (void) remove_target_sections (&exec_bfd); - xfree (exec_filename); - exec_filename = NULL; + current_program_space->exec_filename.reset (nullptr); } } @@ -486,11 +485,13 @@ exec_file_attach (const char *filename, int from_tty) /* gdb_realpath_keepfile resolves symlinks on the local filesystem and so cannot be used for "target:" files. */ - gdb_assert (exec_filename == NULL); + gdb_assert (current_program_space->exec_filename == nullptr); if (load_via_target) - exec_filename = xstrdup (bfd_get_filename (exec_bfd)); + current_program_space->exec_filename + = make_unique_xstrdup (bfd_get_filename (exec_bfd)); else - exec_filename = gdb_realpath_keepfile (scratch_pathname).release (); + current_program_space->exec_filename + = gdb_realpath_keepfile (scratch_pathname); if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching)) { -- cgit v1.1