diff options
author | Pedro Alves <palves@redhat.com> | 2016-11-08 15:26:45 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-11-08 15:26:45 +0000 |
commit | db1ec11fff1a46f7046bcbd971a42632d2ea795c (patch) | |
tree | 99dbce3d4e42a2b9ce26f5cba1fd8e1f9992973c /gdb/guile | |
parent | 3ab692db7f4d96022a132379614031a852de6f35 (diff) | |
download | fsf-binutils-gdb-db1ec11fff1a46f7046bcbd971a42632d2ea795c.zip fsf-binutils-gdb-db1ec11fff1a46f7046bcbd971a42632d2ea795c.tar.gz fsf-binutils-gdb-db1ec11fff1a46f7046bcbd971a42632d2ea795c.tar.bz2 |
Use ui_file_as_string in execute_command_to_string
... and then return std::string and adjust all callers.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* gdbcmd.h (execute_command_to_string): Now returns std::string.
(lookup_struct_elt_type): Adjust to use std::string.
* top.c (execute_command_to_string): Use ui_file_as_string and
return std::string.
* guile/guile.c (gdbscm_execute_gdb_command): Adjust to use
std::string.
* python/python.c (execute_gdb_command): Adjust to use
std::string.
Diffstat (limited to 'gdb/guile')
-rw-r--r-- | gdb/guile/guile.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c index 3a19eec..9a126a1 100644 --- a/gdb/guile/guile.c +++ b/gdb/guile/guile.c @@ -311,7 +311,6 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest) int from_tty = 0, to_string = 0; const SCM keywords[] = { from_tty_keyword, to_string_keyword, SCM_BOOL_F }; char *command; - char *result = NULL; struct cleanup *cleanups; struct gdb_exception except = exception_none; @@ -324,6 +323,8 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest) executed. */ cleanups = make_cleanup (xfree, command); + std::string to_string_res; + TRY { struct cleanup *inner_cleanups; @@ -333,12 +334,9 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest) prevent_dont_repeat (); if (to_string) - result = execute_command_to_string (command, from_tty); + to_string_res = execute_command_to_string (command, from_tty); else - { - execute_command (command, from_tty); - result = NULL; - } + execute_command (command, from_tty); /* Do any commands attached to breakpoint we stopped at. */ bpstat_do_actions (); @@ -354,12 +352,8 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest) do_cleanups (cleanups); GDBSCM_HANDLE_GDB_EXCEPTION (except); - if (result) - { - SCM r = gdbscm_scm_from_c_string (result); - xfree (result); - return r; - } + if (to_string) + return gdbscm_scm_from_c_string (to_string_res.c_str ()); return SCM_UNSPECIFIED; } |