[PATCH 11/13] script language API for GDB

Doug Evans xdje42@gmail.com
Thu Dec 5 17:23:00 GMT 2013


This patch contains the associated changes to typeprint.[ch].
Basically it's just adding "script" to the API entry points
and changing the the arg that's passed around from void *
to a pointer to a struct (that can then contain members for
the scripting language).

2013-12-05  Doug Evans  <xdje42@gmail.com>

	* typeprint.c (do_free_global_table): Update to call
	free_script_type_printers.
	(create_global_typedef_table): Update to call
	start_script_type_printers.
	(find_global_typedef): Update to call apply_script_type_printers.
	* typeprint.h (struct script_type_printers): Add forward decl.
	(type_print_options): Change type of global_printers from "void *"
	to "struct script_type_printers *".

diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index c5e45be..4a74e18 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -248,7 +248,7 @@ do_free_global_table (void *arg)
   struct type_print_options *flags = arg;
 
   free_typedef_hash (flags->global_typedefs);
-  free_type_printers (flags->global_printers);
+  free_script_type_printers (flags->global_printers);
 }
 
 /* Create the global typedef hash.  */
@@ -258,13 +258,13 @@ create_global_typedef_table (struct type_print_options *flags)
 {
   gdb_assert (flags->global_typedefs == NULL && flags->global_printers == NULL);
   flags->global_typedefs = create_typedef_hash ();
-  flags->global_printers = start_type_printers ();
+  flags->global_printers = start_script_type_printers ();
   return make_cleanup (do_free_global_table, flags);
 }
 
 /* Look up the type T in the global typedef hash.  If it is found,
    return the typedef name.  If it is not found, apply the
-   type-printers, if any, given by start_type_printers and return the
+   type-printers, if any, given by start_script_type_printers and return the
    result.  A NULL return means that the name was not found.  */
 
 static const char *
@@ -288,7 +288,7 @@ find_global_typedef (const struct type_print_options *flags,
       return new_tf->name;
     }
 
-  /* Put an entry into the hash table now, in case apply_type_printers
+  /* Put an entry into the hash table now, in case apply_script_type_printers
      recurses.  */
   new_tf = XOBNEW (&flags->global_typedefs->storage, struct typedef_field);
   new_tf->name = NULL;
@@ -296,7 +296,7 @@ find_global_typedef (const struct type_print_options *flags,
 
   *slot = new_tf;
 
-  applied = apply_type_printers (flags->global_printers, t);
+  applied = apply_script_type_printers (flags->global_printers, t);
 
   if (applied != NULL)
     {
diff --git a/gdb/typeprint.h b/gdb/typeprint.h
index 38ba5e6..293f46e 100644
--- a/gdb/typeprint.h
+++ b/gdb/typeprint.h
@@ -22,6 +22,7 @@
 enum language;
 struct ui_file;
 struct typedef_hash_table;
+struct script_type_printers;
 
 struct type_print_options
 {
@@ -44,7 +45,7 @@ struct type_print_options
 
   /* The list of type printers associated with the global typedef
      table.  This is intentionally opaque.  */
-  void *global_printers;
+  struct script_type_printers *global_printers;
 };
 
 extern const struct type_print_options type_print_raw_options;



More information about the Gdb-patches mailing list