From e540a5a22319f2ab5661db882639839d1d867542 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 11 May 2018 19:10:13 +0100 Subject: [PATCH] Move core_bfd to program space This moves the core_bfd global to be a field of the program space. It then replaces core_bfd with a macro to avoid a massive patch -- the same approach taken for various other program space fields. This is a basic transformation for multi-target work. 2018-05-11 Tom Tromey Pedro Alves * corefile.c (core_bfd): Remove. * gdbcore.h (core_bfd): Now a macro. * progspace.h (struct program_space) : New field. --- gdb/ChangeLog | 7 +++++++ gdb/corefile.c | 4 ---- gdb/gdbcore.h | 2 +- gdb/progspace.h | 3 +++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 34d2d49..97ee0f9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2018-05-11 Tom Tromey + Pedro Alves + + * corefile.c (core_bfd): Remove. + * gdbcore.h (core_bfd): Now a macro. + * progspace.h (struct program_space) : New field. + 2018-05-11 Tom Tromey * mdebugread.c (parse_partial_symbols, psymtab_to_symtab_1): Use diff --git a/gdb/corefile.c b/gdb/corefile.c index 114de83..e0c7540 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -49,10 +49,6 @@ static hook_type *exec_file_extra_hooks; /* Array of additional hooks. */ static int exec_file_hook_count = 0; /* Size of array. */ -/* Binary file diddling handle for the core file. */ - -bfd *core_bfd = NULL; - /* Backward compatability with old way of specifying core files. */ diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index 401c213..d06ccc3 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -133,7 +133,7 @@ extern void specify_exec_file_hook (void (*hook) (const char *filename)); /* Binary File Diddler for the core file. */ -extern bfd *core_bfd; +#define core_bfd (current_program_space->cbfd) /* corelow.c target. It is never NULL after GDB initialization. */ diff --git a/gdb/progspace.h b/gdb/progspace.h index 67c0a24..835fcfd 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -157,6 +157,9 @@ struct program_space It needs to be freed by xfree. It is not NULL iff EBFD is not NULL. */ char *pspace_exec_filename = NULL; + /* Binary file diddling handle for the core file. */ + bfd *cbfd = NULL; + /* The address space attached to this program space. More than one program space may be bound to the same address space. In the traditional unix-like debugging scenario, this will usually -- 2.7.4