aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-frame.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-09-09 10:14:52 -0600
committerTom Tromey <tom@tromey.com>2017-09-11 16:15:11 -0600
commitc6dc63a16299e22fcb5bc13b34cb402a1bfcf6b9 (patch)
treeba6c7f5c359753ab3cc712e8e98d8211b9caecdd /gdb/python/py-frame.c
parentd6b9b80f9483b6c1a3a018c0fcaf813ca098d8af (diff)
downloadgdb-c6dc63a16299e22fcb5bc13b34cb402a1bfcf6b9.zip
gdb-c6dc63a16299e22fcb5bc13b34cb402a1bfcf6b9.tar.gz
gdb-c6dc63a16299e22fcb5bc13b34cb402a1bfcf6b9.tar.bz2
Remove cleanups from find_frame_funname
This changes find_frame_funname to return a unique_xmalloc_ptr and then fixes up the callers. This removes several cleanups. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * ada-lang.c (is_known_support_routine): Update. (ada_unhandled_exception_name_addr_from_raise): Update. * guile/scm-frame.c (gdbscm_frame_name): Update. * python/py-frame.c (frapy_name): Update. (frapy_function): Update. * stack.h (find_frame_funname): Update. * stack.c (find_frame_funname): Return unique_xmalloc_ptr. (print_frame): Update.
Diffstat (limited to 'gdb/python/py-frame.c')
-rw-r--r--gdb/python/py-frame.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index c5ae391..a927b3c 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -119,7 +119,7 @@ static PyObject *
frapy_name (PyObject *self, PyObject *args)
{
struct frame_info *frame;
- char *name = NULL;
+ gdb::unique_xmalloc_ptr<char> name;
enum language lang;
PyObject *result;
@@ -127,19 +127,18 @@ frapy_name (PyObject *self, PyObject *args)
{
FRAPY_REQUIRE_VALID (self, frame);
- find_frame_funname (frame, &name, &lang, NULL);
+ name = find_frame_funname (frame, &lang, NULL);
}
CATCH (except, RETURN_MASK_ALL)
{
- xfree (name);
GDB_PY_HANDLE_EXCEPTION (except);
}
END_CATCH
if (name)
{
- result = PyUnicode_Decode (name, strlen (name), host_charset (), NULL);
- xfree (name);
+ result = PyUnicode_Decode (name.get (), strlen (name.get ()),
+ host_charset (), NULL);
}
else
{
@@ -334,13 +333,12 @@ frapy_function (PyObject *self, PyObject *args)
TRY
{
- char *funname;
enum language funlang;
FRAPY_REQUIRE_VALID (self, frame);
- find_frame_funname (frame, &funname, &funlang, &sym);
- xfree (funname);
+ gdb::unique_xmalloc_ptr<char> funname
+ = find_frame_funname (frame, &funlang, &sym);
}
CATCH (except, RETURN_MASK_ALL)
{