aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-breakpoint.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-11-08 15:26:45 +0000
committerPedro Alves <palves@redhat.com>2016-11-08 15:26:45 +0000
commitc92aed165e8af79f51c5165f98f12389bb59a121 (patch)
tree68b7aecd264ec7bcdc148d5a71c7459a62c03a09 /gdb/python/py-breakpoint.c
parent02030646c2a799614d31e52008403d8be067ac5d (diff)
downloadbinutils-c92aed165e8af79f51c5165f98f12389bb59a121.zip
binutils-c92aed165e8af79f51c5165f98f12389bb59a121.tar.gz
binutils-c92aed165e8af79f51c5165f98f12389bb59a121.tar.bz2
Use ui_file_as_string in gdb/python/
gdb/ChangeLog: 2016-11-08 Pedro Alves <palves@redhat.com> * python/py-arch.c (archpy_disassemble): Use ui_file_as_string and std::string. * python/py-breakpoint.c (bppy_get_commands): Use ui_file_as_string and std::string. * python/py-frame.c (frapy_str): Likewise. * python/py-type.c (typy_str): Likewise. * python/py-unwind.c (unwind_infopy_str): Likewise. * python/py-value.c (valpy_str): Likewise.
Diffstat (limited to 'gdb/python/py-breakpoint.c')
-rw-r--r--gdb/python/py-breakpoint.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 80f5d1f..e61cbcd 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -487,9 +487,8 @@ bppy_get_commands (PyObject *self, void *closure)
struct breakpoint *bp = self_bp->bp;
long length;
struct ui_file *string_file;
- struct cleanup *chain;
PyObject *result;
- char *cmdstr;
+ struct cleanup *chain;
BPPY_REQUIRE_VALID (self_bp);
@@ -514,9 +513,8 @@ bppy_get_commands (PyObject *self, void *closure)
END_CATCH
ui_out_redirect (current_uiout, NULL);
- cmdstr = ui_file_xstrdup (string_file, &length);
- make_cleanup (xfree, cmdstr);
- result = host_string_to_python_string (cmdstr);
+ std::string cmdstr = ui_file_as_string (string_file);
+ result = host_string_to_python_string (cmdstr.c_str ());
do_cleanups (chain);
return result;
}