aboutsummaryrefslogtreecommitdiff
path: root/gdb/guile/scm-disasm.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-11-08 15:26:44 +0000
committerPedro Alves <palves@redhat.com>2016-11-08 15:26:44 +0000
commit3ab692db7f4d96022a132379614031a852de6f35 (patch)
treedcc4b2cdf8d475300d5b72633589d458820166d8 /gdb/guile/scm-disasm.c
parent09b0e4b047b44063cf4c8c00527886743619c24e (diff)
downloadgdb-3ab692db7f4d96022a132379614031a852de6f35.zip
gdb-3ab692db7f4d96022a132379614031a852de6f35.tar.gz
gdb-3ab692db7f4d96022a132379614031a852de6f35.tar.bz2
Use ui_file_as_string in gdb/guile/
gdb/ChangeLog: 2016-11-08 Pedro Alves <palves@redhat.com> * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use ui_file_as_string and adjust to use std::string. * guile/scm-disasm.c (gdbscm_arch_disassemble): Likewise. * guile/scm-frame.c (frscm_print_frame_smob): Likewise. * guile/scm-type.c (tyscm_type_name): Use ui_file_as_string and adjust to use std::string. Throw exception directly instead of returning it in EXCP output parameter. (tyscm_print_type_smob, gdbscm_type_print_name): Adjust to tyscm_type_name interface change. * guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print): Use ui_file_as_string and std::string.
Diffstat (limited to 'gdb/guile/scm-disasm.c')
-rw-r--r--gdb/guile/scm-disasm.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/gdb/guile/scm-disasm.c b/gdb/guile/scm-disasm.c
index 78a7b83..a7d6b14 100644
--- a/gdb/guile/scm-disasm.c
+++ b/gdb/guile/scm-disasm.c
@@ -282,7 +282,6 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
for (pc = start, i = 0; pc <= end && i < count; )
{
int insn_len = 0;
- char *as = NULL;
struct ui_file *memfile = mem_fileopen ();
struct cleanup *cleanups = make_cleanup_ui_file_delete (memfile);
@@ -302,15 +301,14 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
}
END_CATCH
- as = ui_file_xstrdup (memfile, NULL);
+ std::string as = ui_file_as_string (memfile);
- result = scm_cons (dascm_make_insn (pc, as, insn_len),
+ result = scm_cons (dascm_make_insn (pc, as.c_str (), insn_len),
result);
pc += insn_len;
i++;
do_cleanups (cleanups);
- xfree (as);
}
return scm_reverse_x (result, SCM_EOL);