2009-02-05 Thiago Jung Bauermann <bauerman@br.ibm.com>

* language.h (language_dfn): Add la_get_string member.
	(LA_GET_STRING): New macro.
	(default_get_string): New prototype.
	* language.c (default_get_string): New function.
	(unknown_language_defn, auto_language_defn, local_language_defn): Use
	default_get_string for la_get_string.
	* c-lang.c (c_get_string): New function.
	(c_language_defn, cplus_language_defn, asm_language_defn): Use
	c_get_string for la_get_string.
	(minimal_language_defn): Likewise
	* ada-lang.c (ada_language_defn): Likewise.
	* f-lang.c (f_language_defn): Use default_get_string for
	la_get_string.
	* jv-lang.c (java_language_defn): Likewise.
	* m2-lang.c (m2_language_defn): Likewise.
	* objc-lang.c (objc_language_defn): Likewise.
	* p-lang.c (p_language_defn): Likewise.
	* scm-lang.c (scm_language_defn): Likewise.
	* typeprint.c (type_to_string): New function.
	* value.h (type_to_string): New prototype.
	* valprint.c (val_print_string): Factor out code for reading string
	from the inferior into its own function.  Put 2 spaces after period
	in comments.
	(read_string): New function.
	* valprint.h (read_string): New prototype.
This commit is contained in:
Thiago Jung Bauermann
2009-02-05 12:16:25 +00:00
parent fa8a61dc87
commit ae6a3a4c2a
15 changed files with 326 additions and 61 deletions

View File

@@ -282,6 +282,14 @@ struct language_defn
reference at the language level. */
int (*la_pass_by_reference) (struct type *type);
/* Obtain a string from the inferior, storing it in a newly allocated
buffer in BUFFER, which should be freed by the caller. LENGTH will
hold the size in bytes of the string (only actual characters, excluding
an eventual terminating null character). CHARSET will hold the encoding
used in the string. */
void (*la_get_string) (struct value *value, gdb_byte **buffer, int *length,
const char **charset);
/* Add fields above this point, so the magic number is always last. */
/* Magic number for compat checking */
@@ -380,6 +388,8 @@ extern enum language set_language (enum language);
force_ellipses,options))
#define LA_EMIT_CHAR(ch, stream, quoter) \
(current_language->la_emitchar(ch, stream, quoter))
#define LA_GET_STRING(value, buffer, length, encoding) \
(current_language->la_get_string(value, buffer, length, encoding))
#define LA_PRINT_ARRAY_INDEX(index_value, stream, optins) \
(current_language->la_print_array_index(index_value, stream, options))
@@ -489,4 +499,10 @@ int default_pass_by_reference (struct type *type);
void default_print_typedef (struct type *type, struct symbol *new_symbol,
struct ui_file *stream);
void default_get_string (struct value *value, gdb_byte **buffer, int *length,
const char **charset);
void c_get_string (struct value *value, gdb_byte **buffer, int *length,
const char **charset);
#endif /* defined (LANGUAGE_H) */