mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 02:24:17 +08:00
Use unique_xmalloc_ptr for read_string
This changes read_string's "buffer" out-parameter to be a unique_xmalloc_ptr, then updates the users. This allows for the removal of some cleanups. I chose unique_xmalloc_ptr rather than byte_vector here due to the way Guile unwinding seems to work. Tested by the buildbot. gdb/ChangeLog 2018-06-18 Tom Tromey <tom@tromey.com> * valprint.h (read_string): Update. * valprint.c (read_string): Change type of "buffer". (val_print_string): Update. * python/py-value.c (valpy_string): Update. * language.h (struct language_defn) <la_get_string>: Change type of "buffer". (default_get_string, c_get_string): Update. * language.c (default_get_string): Change type of "buffer". * guile/scm-value.c (gdbscm_value_to_string): Update. * c-lang.c (c_get_string): Change type of "buffer".
This commit is contained in:
@ -366,8 +366,10 @@ struct language_defn
|
||||
characters, excluding any eventual terminating null character.
|
||||
Otherwise *LENGTH will include all characters - including any nulls.
|
||||
CHARSET will hold the encoding used in the string. */
|
||||
void (*la_get_string) (struct value *value, gdb_byte **buffer, int *length,
|
||||
struct type **chartype, const char **charset);
|
||||
void (*la_get_string) (struct value *value,
|
||||
gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
|
||||
int *length, struct type **chartype,
|
||||
const char **charset);
|
||||
|
||||
/* Return an expression that can be used for a location
|
||||
watchpoint. TYPE is a pointer type that points to the memory
|
||||
@ -627,8 +629,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,
|
||||
struct type **char_type, const char **charset);
|
||||
void default_get_string (struct value *value,
|
||||
gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
|
||||
int *length, struct type **char_type,
|
||||
const char **charset);
|
||||
|
||||
/* Default name hashing function. */
|
||||
|
||||
@ -638,8 +642,10 @@ void default_get_string (struct value *value, gdb_byte **buffer, int *length,
|
||||
comparison operators hash to the same value. */
|
||||
extern unsigned int default_search_name_hash (const char *search_name);
|
||||
|
||||
void c_get_string (struct value *value, gdb_byte **buffer, int *length,
|
||||
struct type **char_type, const char **charset);
|
||||
void c_get_string (struct value *value,
|
||||
gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
|
||||
int *length, struct type **char_type,
|
||||
const char **charset);
|
||||
|
||||
/* The default implementation of la_symbol_name_matcher. Matches with
|
||||
strncmp_iw. */
|
||||
|
Reference in New Issue
Block a user