+2002-09-25 David Carlton <carlton@math.stanford.edu>
+
+ * 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 <carlton@math.stanford.edu>
* dictionary.c: Comment out block-specific stuff.
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) \
$(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) \
$(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)
$(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)
$(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) \
#include "solib.h" /* Support for shared libraries. */
#include "solib-svr4.h" /* For struct link_map_offsets. */
+#include "gdb_string.h"
enum cris_num_regs
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 <impl>, what you should do
+ is:
+
+ * Add a new element DICT_<IMPL> to dict_type.
+
+ * Create a new structure dictionary_<impl>. 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 _<impl>. 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_<impl>_vtbl.
+
+ * Define a function dict_create_<impl> to create these
+ gizmos. Add its declaration to dictionary.h.
+
+ To add a new operation <op> on all existing implementations, what
+ you should do is:
+
+ * Add a new member <op> to struct dict_vtbl.
+
+ * If there is useful generic behavior <op>, define a static
+ function <op>_something_informative that implements that behavior.
+ (E.g. add_symbol_nonexpandable, free_obstack.)
+
+ * For every implementation <impl> that should have its own specific
+ behavior for <op>, define a static function <op>_<impl>
+ implementing it.
+
+ * Modify all existing dict_vtbl_<impl>'s to include the appropriate
+ member.
+
+ * Define a function dict_<op> that looks up <op> in the dict_vtbl
+ and calls the appropriate function. Add a declaration for
+ dict_<op> 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
/* 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. */
#include "gdbcore.h"
#include "inferior.h"
#include "arch-utils.h"
+#include "gdb_string.h"
/* Functions declared and used only in this file */
#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);
#include "srec.h"
#include "arch-utils.h"
#include "regcache.h"
+#include "gdb_string.h"
#include "sh-tdep.h"
#include "frame.h"
#include "value.h"
#include "arch-utils.h"
+#include "gdb_string.h"
#include "vax-tdep.h"