From: David Carlton Date: Thu, 26 Sep 2002 00:04:42 +0000 (+0000) Subject: 2002-09-25 David Carlton X-Git-Tag: newlib-1_11_0~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=60d1ea990a33a7e55294c1c26f32eb6224b06654;p=thirdparty%2Fbinutils-gdb.git 2002-09-25 David Carlton * dictionary.c: Commented what needs to be done to add stuff to this file. * dictionary.h: Expand on namespace_enum comment. * Makefile.in (cris-tdep.o): Depend on gdb_string_h. (mcore-tdep.o): Ditto. (ns32k-tdep.o): Ditto. (sh3-rom.o): Ditto. (vax-tdep.o): Ditto. * cris-tdep.c: #include "gdb_string.h" * mcore-tdep.c: Ditto. * ns32k-tdep.c: Ditto. * sh3-rom.c: Ditto. * vax-tdep.c: Ditto. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bbe191b07c4..008a5ef5cee 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2002-09-25 David Carlton + + * dictionary.c: Commented what needs to be done to add stuff to + this file. + * dictionary.h: Expand on namespace_enum comment. + * Makefile.in (cris-tdep.o): Depend on gdb_string_h. + (mcore-tdep.o): Ditto. + (ns32k-tdep.o): Ditto. + (sh3-rom.o): Ditto. + (vax-tdep.o): Ditto. + * cris-tdep.c: #include "gdb_string.h" + * mcore-tdep.c: Ditto. + * ns32k-tdep.c: Ditto. + * sh3-rom.c: Ditto. + * vax-tdep.c: Ditto. + 2002-09-24 David Carlton * dictionary.c: Comment out block-specific stuff. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 980d66f4774..bcefadd7f89 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1612,7 +1612,7 @@ cpu32bug-rom.o: cpu32bug-rom.c $(defs_h) $(gdbcore_h) $(target_h) \ cris-tdep.o: cris-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(inferior_h) \ $(gdbtypes_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(value_h) \ $(opcode_cris_h) $(arch_utils_h) $(regcache_h) $(symfile_h) \ - $(solib_h) $(solib_svr4_h) + $(solib_h) $(solib_svr4_h) $(gdb_string_h) # OBSOLETE cxux-nat.o: cxux-nat.c d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbtypes_h) \ $(gdbcmd_h) $(gdbcore_h) $(gdb_string_h) $(value_h) $(inferior_h) \ @@ -1896,7 +1896,7 @@ mcore-rom.o: mcore-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(gdb_string_h) $(regcache_h) $(serial_h) mcore-tdep.o: mcore-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \ $(gdbcmd_h) $(regcache_h) $(symfile_h) $(gdbcore_h) $(inferior_h) \ - $(arch_utils_h) + $(arch_utils_h) $(gdb_string_h) mdebugread.o: mdebugread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \ $(symfile_h) $(objfiles_h) $(gdb_obstack_h) $(buildsym_h) \ $(stabsread_h) $(complaints_h) $(demangle_h) $(gdb_assert_h) \ @@ -1949,7 +1949,7 @@ nlmread.o: nlmread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \ $(objfiles_h) $(buildsym_h) $(stabsread_h) ns32k-tdep.o: ns32k-tdep.c $(defs_h) $(frame_h) $(gdbtypes_h) $(gdbcore_h) \ $(inferior_h) $(regcache_h) $(target_h) $(arch_utils_h) \ - $(ns32k_tdep_h) + $(ns32k_tdep_h) $(gdb_string_h) ns32knbsd-nat.o: ns32knbsd-nat.c $(defs_h) $(inferior_h) $(target_h) \ $(gdbcore_h) $(regcache_h) ns32knbsd-tdep.o: ns32knbsd-tdep.c $(defs_h) $(ns32k_tdep_h) @@ -2127,7 +2127,8 @@ sh-tdep.o: sh-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(symfile_h) \ $(regcache_h) $(doublest_h) $(sh_tdep_h) $(elf_bfd_h) \ $(solib_svr4_h) $(elf_sh_h) $(gdb_sim_sh_h) sh3-rom.o: sh3-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ - $(serial_h) $(srec_h) $(arch_utils_h) $(regcache_h) $(sh_tdep_h) + $(serial_h) $(srec_h) $(arch_utils_h) $(regcache_h) $(gdb_string_h) \ + $(sh_tdep_h) shnbsd-nat.o: shnbsd-nat.c $(defs_h) $(inferior_h) $(shnbsd_tdep_h) shnbsd-tdep.o: shnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) $(value_h) \ $(solib_svr4_h) $(nbsd_tdep_h) $(sh_tdep_h) $(shnbsd_tdep_h) @@ -2276,7 +2277,7 @@ varobj.o: varobj.c $(defs_h) $(value_h) $(expression_h) $(frame_h) \ $(language_h) $(wrapper_h) $(gdbcmd_h) $(gdb_string_h) $(varobj_h) vax-tdep.o: vax-tdep.c $(defs_h) $(symtab_h) $(opcode_vax_h) $(gdbcore_h) \ $(inferior_h) $(regcache_h) $(frame_h) $(value_h) $(arch_utils_h) \ - $(vax_tdep_h) + $(gdb_string_h) $(vax_tdep_h) w89k-rom.o: w89k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(xmodem_h) $(regcache_h) win32-nat.o: win32-nat.c $(defs_h) $(tm_h) $(frame_h) $(inferior_h) \ diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 0bfb5b32f6d..5d64d43f1f6 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "solib.h" /* Support for shared libraries. */ #include "solib-svr4.h" /* For struct link_map_offsets. */ +#include "gdb_string.h" enum cris_num_regs diff --git a/gdb/dictionary.c b/gdb/dictionary.c index b1c96f0bacd..0e98be2fea9 100644 --- a/gdb/dictionary.c +++ b/gdb/dictionary.c @@ -36,7 +36,53 @@ Each dictionary starts with a 'virtual function table' that contains the functions that actually implement the various - operations that dictionaries provide. */ + operations that dictionaries provide. + + To add a new dictionary implementation , what you should do + is: + + * Add a new element DICT_ to dict_type. + + * Create a new structure dictionary_. If your new + implementation is a variant of an existing one, make sure that + their structs have the same initial data members. Define accessor + macros for your new data members. + + * Implement all the functions in dict_vtbl as static functions, + whose name is the same as the corresponding member of dict_vtbl + plus _. You don't have to do this for those members where + you can reuse existing generic functions + (e.g. add_symbol_nonexpandable, free_obstack) or in the case where + your new implementation is a variant of an existing implementation + and where the variant doesn't affect the member function in + question. + + * Define a static const struct dict_vtbl dict__vtbl. + + * Define a function dict_create_ to create these + gizmos. Add its declaration to dictionary.h. + + To add a new operation on all existing implementations, what + you should do is: + + * Add a new member to struct dict_vtbl. + + * If there is useful generic behavior , define a static + function _something_informative that implements that behavior. + (E.g. add_symbol_nonexpandable, free_obstack.) + + * For every implementation that should have its own specific + behavior for , define a static function _ + implementing it. + + * Modify all existing dict_vtbl_'s to include the appropriate + member. + + * Define a function dict_ that looks up in the dict_vtbl + and calls the appropriate function. Add a declaration for + dict_ to dictionary.h. + +*/ /* NOTE: carlton/2002-09-20: Originally, I'd had each dictionary start with a dict_type member, and had implemented the various functions diff --git a/gdb/dictionary.h b/gdb/dictionary.h index c944c2f187c..ea39922e429 100644 --- a/gdb/dictionary.h +++ b/gdb/dictionary.h @@ -23,7 +23,9 @@ /* FIXME: carlton/2002-09-24: because of namespace_enum, you have to include symtab.h before including this file. But I'm leaving in - opaque declarations as if that weren't true. */ + opaque declarations as if that weren't true. (Probably the + 'namespace' argument to dict_lookup should eventually be moved back + into lookup_block_symbol, I think.) */ /* An opaque type for dictionaries; only dictionary.c should know about its innards. */ diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index 395bb44f8a6..41114b44735 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -27,6 +27,7 @@ #include "gdbcore.h" #include "inferior.h" #include "arch-utils.h" +#include "gdb_string.h" /* Functions declared and used only in this file */ diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 58c2e13c10c..e60b1c0ef36 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -30,6 +30,7 @@ #include "arch-utils.h" #include "ns32k-tdep.h" +#include "gdb_string.h" static int sign_extend (int value, int bits); static CORE_ADDR ns32k_get_enter_addr (CORE_ADDR); diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c index f450ac9d5fc..7d07fa53c80 100644 --- a/gdb/sh3-rom.c +++ b/gdb/sh3-rom.c @@ -27,6 +27,7 @@ #include "srec.h" #include "arch-utils.h" #include "regcache.h" +#include "gdb_string.h" #include "sh-tdep.h" diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 709ef383c83..2f517edb379 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -28,6 +28,7 @@ #include "frame.h" #include "value.h" #include "arch-utils.h" +#include "gdb_string.h" #include "vax-tdep.h"