This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[ob] symfile-mem cleanups
- From: Andrew Cagney <cagney at gnu dot org>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 25 May 2004 17:59:32 -0400
- Subject: [ob] symfile-mem cleanups
Hello,
This tidies up symfile-mem.[hc] a little. Of note is making
symbol_file_add_from_memory static letting us delete _two_ extern
symbol_file_add_from_memory declarations and a header! The ChangeLog
lists the other tweaks.
committed,
Andrew
Index: ChangeLog
2004-05-25 Andrew Cagney <cagney@gnu.org>
* symfile.h (symbol_file_add_from_memory): Delete declaration.
* symfile-mem.h: Delete file.
* symfile-mem.c: Do not include "symfile-mem.h".
(symbol_file_add_from_memory): Make static. Use "struct bfd" and
"struct bfd_section". When an error do not bother returning NULL.
(add_symbol_file_from_memory_command): Use "struct bfd" and
"struct bfd_section".
* Makefile.in (symfile_mem_h): Delete.
(symfile-mem.o): Update dependencies.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.579
diff -p -u -r1.579 Makefile.in
--- Makefile.in 25 May 2004 16:04:05 -0000 1.579
+++ Makefile.in 25 May 2004 21:53:52 -0000
@@ -757,7 +757,6 @@ srec_h = srec.h
stabsread_h = stabsread.h
stack_h = stack.h
symfile_h = symfile.h
-symfile_mem_h = symfile-mem.h
symtab_h = symtab.h
target_h = target.h $(bfd_h) $(symtab_h) $(dcache_h) $(memattr_h)
terminal_h = terminal.h
@@ -2446,8 +2445,7 @@ symfile.o: symfile.c $(defs_h) $(bfdlink
$(hashtab_h) $(readline_h) $(gdb_assert_h) $(block_h) \
$(gdb_string_h) $(gdb_stat_h)
symfile-mem.o: symfile-mem.c $(defs_h) $(symtab_h) $(gdbcore_h) \
- $(objfiles_h) $(gdbcmd_h) $(target_h) $(value_h) $(symfile_h) \
- $(symfile_mem_h)
+ $(objfiles_h) $(gdbcmd_h) $(target_h) $(value_h) $(symfile_h)
symmisc.o: symmisc.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(bfd_h) \
$(symfile_h) $(objfiles_h) $(breakpoint_h) $(command_h) \
$(gdb_obstack_h) $(language_h) $(bcache_h) $(block_h) $(gdb_regex_h) \
Index: symfile-mem.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile-mem.c,v
retrieving revision 1.1
diff -p -u -r1.1 symfile-mem.c
--- symfile-mem.c 2 May 2004 10:14:01 -0000 1.1
+++ symfile-mem.c 25 May 2004 21:53:52 -0000
@@ -52,18 +52,17 @@
#include "target.h"
#include "value.h"
#include "symfile.h"
-#include "symfile-mem.h"
/* Read inferior memory at ADDR to find the header of a loaded object file
and read its in-core symbols out of inferior memory. TEMPL is a bfd
representing the target's format. */
-struct objfile *
-symbol_file_add_from_memory (bfd *templ, CORE_ADDR addr, int from_tty)
+static struct objfile *
+symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, int from_tty)
{
struct objfile *objf;
- bfd *nbfd;
- asection *sec;
+ struct bfd *nbfd;
+ struct bfd_section *sec;
bfd_vma loadbase;
struct section_addr_info *sai;
unsigned int i;
@@ -74,10 +73,7 @@ symbol_file_add_from_memory (bfd *templ,
nbfd = bfd_elf_bfd_from_remote_memory (templ, addr, &loadbase,
target_read_memory);
if (nbfd == NULL)
- {
- error ("Failed to read a valid object file image from memory.");
- return NULL;
- }
+ error ("Failed to read a valid object file image from memory.");
nbfd->filename = xstrdup ("shared object read from target memory");
@@ -89,7 +85,6 @@ symbol_file_add_from_memory (bfd *templ,
bfd_close (nbfd);
error ("Got object file from memory but can't read symbols: %s.",
bfd_errmsg (bfd_get_error ()));
- return NULL;
}
sai = alloc_section_addr_info (bfd_count_sections (nbfd));
@@ -118,7 +113,7 @@ static void
add_symbol_file_from_memory_command (char *args, int from_tty)
{
CORE_ADDR addr;
- bfd *templ;
+ struct bfd *templ;
if (args == NULL)
error ("add-symbol-file-from-memory requires an expression argument");
Index: symfile-mem.h
===================================================================
RCS file: symfile-mem.h
diff -N symfile-mem.h
--- symfile-mem.h 2 May 2004 10:14:01 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,33 +0,0 @@
-/* Declarations for reading symbol files from memory into GDB.
-
- Copyright 2004 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#if !defined (SYMFILE_MEM_H)
-#define SYMFILE_MEM_H
-
-/* You must #include "bfd.h" and "defs.h" before #including this file. */
-
-/* Forward declarations. */
-struct objfile;
-
-struct objfile *(symbol_file_add_from_memory
- (bfd *templ, CORE_ADDR addr, int from_tty));
-
-#endif /* SYMFILE_MEM_H */
Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.30
diff -p -u -r1.30 symfile.h
--- symfile.h 2 May 2004 10:14:01 -0000 1.30
+++ symfile.h 25 May 2004 21:53:52 -0000
@@ -306,12 +306,6 @@ extern CORE_ADDR symbol_overlayed_addres
/* Load symbols from a file. */
extern void symbol_file_add_main (char *args, int from_tty);
-/* Read inferior memory at ADDR to find the header of a loaded object file
- and read its in-core symbols out of inferior memory. TEMPL is a bfd
- representing the target's format. */
-extern struct objfile *symbol_file_add_from_memory (bfd *templ, CORE_ADDR addr,
- int from_tty);
-
/* Clear GDB symbol tables. */
extern void symbol_file_clear (int from_tty);