static void exec_close_1 (void) { using_exec_ops = 0; { struct program_space *ss; struct cleanup *old_chain; old_chain = save_current_program_space (); ALL_PSPACES (ss) { set_current_program_space (ss); /* Delete all target sections. */ resize_section_table (current_target_sections, -resize_section_table (current_target_sections, 0)); exec_close (); } do_cleanups (old_chain); } }
static void exec_close_1 (int quitting) { int need_symtab_cleanup = 0; struct vmap *vp, *nxt; using_exec_ops = 0; for (nxt = vmap; nxt != NULL;) { vp = nxt; nxt = vp->nxt; /* if there is an objfile associated with this bfd, free_objfile() will do proper cleanup of objfile *and* bfd. */ if (vp->objfile) { free_objfile (vp->objfile); need_symtab_cleanup = 1; } else if (vp->bfd != exec_bfd) /* FIXME-leak: We should be freeing vp->name too, I think. */ gdb_bfd_close_or_warn (vp->bfd); xfree (vp); } vmap = NULL; { struct program_space *ss; struct cleanup *old_chain; old_chain = save_current_program_space (); ALL_PSPACES (ss) { set_current_program_space (ss); /* Delete all target sections. */ resize_section_table (current_target_sections, -resize_section_table (current_target_sections, 0)); exec_close (); } do_cleanups (old_chain); } }
static void exec_close_1 (struct target_ops *self) { 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); }
void exec_file_attach (char *filename, int from_tty) { /* Remove any previous exec file. */ exec_close (); if (!ptid_equal (inferior_ptid, null_ptid)) { target_kill (); init_thread_list (); struct program_space *ss; ALL_PSPACES (ss) { set_current_program_space (ss); breakpoint_program_space_exit (ss); } symbol_file_clear (0); }
ps_err_e ps_pglobal_lookup (struct ps_prochandle *ph, const char *obj, const char *name, psaddr_t *sym_addr) { inferior *inf = ph->thread->inf; scoped_restore_current_program_space restore_pspace; set_current_program_space (inf->pspace); /* FIXME: kettenis/2000-09-03: What should we do with OBJ? */ bound_minimal_symbol ms = lookup_minimal_symbol (name, NULL, NULL); if (ms.minsym == NULL) return PS_NOSYM; *sym_addr = core_addr_to_ps_addr (BMSYMBOL_VALUE_ADDRESS (ms)); return PS_OK; }
static void exec_close_1 (int quitting) { struct vmap *vp, *nxt; using_exec_ops = 0; for (nxt = vmap; nxt != NULL;) { vp = nxt; nxt = vp->nxt; if (vp->objfile) free_objfile (vp->objfile); gdb_bfd_unref (vp->bfd); xfree (vp); } vmap = NULL; { struct program_space *ss; struct cleanup *old_chain; old_chain = save_current_program_space (); ALL_PSPACES (ss) { set_current_program_space (ss); /* Delete all target sections. */ resize_section_table (current_target_sections, -resize_section_table (current_target_sections, 0)); exec_close (); } do_cleanups (old_chain); } }
void switch_to_program_space_and_thread (program_space *pspace) { inferior *inf = find_inferior_for_program_space (pspace); if (inf != NULL && inf->pid != 0) { thread_info *tp = any_live_thread_of_inferior (inf); if (tp != NULL) { switch_to_thread (tp); /* Switching thread switches pspace implicitly. We're done. */ return; } } switch_to_no_thread (); set_current_program_space (pspace); }
ps_err_e ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *obj, const char *name, psaddr_t *sym_addr) { struct bound_minimal_symbol ms; struct cleanup *old_chain = save_current_program_space (); struct inferior *inf = find_inferior_ptid (ph->ptid); ps_err_e result; set_current_program_space (inf->pspace); /* FIXME: kettenis/2000-09-03: What should we do with OBJ? */ ms = lookup_minimal_symbol (name, NULL, NULL); if (ms.minsym == NULL) result = PS_NOSYM; else { *sym_addr = core_addr_to_ps_addr (BMSYMBOL_VALUE_ADDRESS (ms)); result = PS_OK; } do_cleanups (old_chain); return result; }