From: Tom Tromey Date: Sat, 13 Jul 2013 17:19:14 +0000 (-0600) Subject: remove using_exec_ops global X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=ab16fce80e60f15058b594f624024219c3a7a000;p=deliverable%2Fbinutils-gdb.git remove using_exec_ops global This removes the using_exec_ops global from exec.c, in favor of querying the target stack directly using target_is_pushed. This is more in keeping with other code in gdb, and is also more future-proof as it is more multi-target-ready. Built and regtested on x86-64 Fedora 20. 2014-07-25 Tom Tromey * exec.c (using_exec_ops): Remove. (exec_close_1): Update. Remove extraneous block, reindent. (add_target_sections): Use target_is_pushed. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d496dbf9ef..47205a1cbb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2014-07-25 Tom Tromey + + * exec.c (using_exec_ops): Remove. + (exec_close_1): Update. Remove extraneous block, reindent. + (add_target_sections): Use target_is_pushed. + 2014-07-25 Pedro Alves * go32-nat.c (go32_create_inferior): Pass 0 to clear_proceed_status. diff --git a/gdb/exec.c b/gdb/exec.c index 7ba2720b82..8b6f588dd8 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -63,9 +63,6 @@ void _initialize_exec (void); static struct target_ops exec_ops; -/* True if the exec target is pushed on the stack. */ -static int using_exec_ops; - /* Whether to open exec and core files read-only or read-write. */ int write_files = 0; @@ -115,22 +112,18 @@ exec_close (void) static void exec_close_1 (struct target_ops *self) { - using_exec_ops = 0; + struct program_space *ss; + struct cleanup *old_chain; + old_chain = save_current_program_space (); + ALL_PSPACES (ss) { - struct program_space *ss; - struct cleanup *old_chain; - - old_chain = save_current_program_space (); - ALL_PSPACES (ss) - { - set_current_program_space (ss); - clear_section_table (current_target_sections); - exec_close (); - } - - do_cleanups (old_chain); + set_current_program_space (ss); + clear_section_table (current_target_sections); + exec_close (); } + + do_cleanups (old_chain); } void @@ -445,11 +438,8 @@ add_target_sections (void *owner, /* If these are the first file sections we can provide memory from, push the file_stratum target. */ - if (!using_exec_ops) - { - using_exec_ops = 1; - push_target (&exec_ops); - } + if (!target_is_pushed (&exec_ops)) + push_target (&exec_ops); } }