From aaee65aea29ac8f7317e866d5dbef9f96cfdb253 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 8 Nov 2016 15:26:46 +0000 Subject: Use ui_file_as_string in gdb/compile/ Using ui_file_as_string would imply changing a few prototypes to pass around source and object file names as std::string. Instead of that, wrap those two in a new class. This ends up eliminating a small wrinkle: get_new_file_names and compile_object_load have swapped parameters. The former takes "source, objfile", while the latter takes "objfile, source". gdb/ChangeLog: 2016-11-08 Pedro Alves * c-lang.h (c_compute_program): Now returns std::string. * compile/compile-internal.h (class compile_file_names): New class. * compile/compile-object-load.c (compile_object_load): Replace object_file and source_file parameters with a compile_file_names parameter. Adjust. * compile-object-load.h: Include "compile-internal.h". (compile_object_load): Replace object_file and source_file parameters with a compile_file_names parameter. * compile/compile-c-support.c (c_compute_program): Now returns a std::string. Use ui_file_as_string. * compile/compile.c (get_new_file_names): Remove parameters and return a compile_file_names instead. (compile_to_object): Now returns a compile_file_names. Use ui_file_as_string. (eval_compile_command): Use compile_file_names. * language.h (struct language_defn) : Now returns std::string. --- gdb/c-lang.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gdb/c-lang.h') diff --git a/gdb/c-lang.h b/gdb/c-lang.h index 12be8bf..8378d4f 100644 --- a/gdb/c-lang.h +++ b/gdb/c-lang.h @@ -152,16 +152,16 @@ extern int c_textual_element_type (struct type *, char); extern struct compile_instance *c_get_compile_context (void); -/* This takes the user-supplied text and returns a newly malloc'd bit - of code to compile. +/* This takes the user-supplied text and returns a new bit of code to + compile. This is used as the la_compute_program language method; see that for a description of the arguments. */ -extern char *c_compute_program (struct compile_instance *inst, - const char *input, - struct gdbarch *gdbarch, - const struct block *expr_block, - CORE_ADDR expr_pc); +extern std::string c_compute_program (struct compile_instance *inst, + const char *input, + struct gdbarch *gdbarch, + const struct block *expr_block, + CORE_ADDR expr_pc); #endif /* !defined (C_LANG_H) */ -- cgit v1.1