projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kill init_sal
[deliverable/binutils-gdb.git]
/
gdb
/
python
/
py-frame.c
diff --git
a/gdb/python/py-frame.c
b/gdb/python/py-frame.c
index b4486869f70a1e307d1c41184828335cc00ed628..c5ae391ef544aff151c9f755c5ef5136bd87f273 100644
(file)
--- a/
gdb/python/py-frame.c
+++ b/
gdb/python/py-frame.c
@@
-1,6
+1,6
@@
/* Python interface to stack frames
/* Python interface to stack frames
- Copyright (C) 2008-201
5
Free Software Foundation, Inc.
+ Copyright (C) 2008-201
7
Free Software Foundation, Inc.
This file is part of GDB.
This file is part of GDB.
@@
-28,6
+28,7
@@
#include "symfile.h"
#include "objfiles.h"
#include "user-regs.h"
#include "symfile.h"
#include "objfiles.h"
#include "user-regs.h"
+#include "py-ref.h"
typedef struct {
PyObject_HEAD
typedef struct {
PyObject_HEAD
@@
-80,17
+81,10
@@
frame_object_to_frame_info (PyObject *obj)
static PyObject *
frapy_str (PyObject *self)
{
static PyObject *
frapy_str (PyObject *self)
{
- char *s;
- PyObject *result;
- struct ui_file *strfile;
-
- strfile = mem_fileopen ();
- fprint_frame_id (strfile, ((frame_object *) self)->frame_id);
- s = ui_file_xstrdup (strfile, NULL);
- result = PyString_FromString (s);
- xfree (s);
+ string_file strfile;
- return result;
+ fprint_frame_id (&strfile, ((frame_object *) self)->frame_id);
+ return PyString_FromString (strfile.c_str ());
}
/* Implementation of gdb.Frame.is_valid (self) -> Boolean.
}
/* Implementation of gdb.Frame.is_valid (self) -> Boolean.
@@
-340,9
+334,13
@@
frapy_function (PyObject *self, PyObject *args)
TRY
{
TRY
{
+ char *funname;
+ enum language funlang;
+
FRAPY_REQUIRE_VALID (self, frame);
FRAPY_REQUIRE_VALID (self, frame);
- sym = find_pc_function (get_frame_address_in_block (frame));
+ find_frame_funname (frame, &funname, &funlang, &sym);
+ xfree (funname);
}
CATCH (except, RETURN_MASK_ALL)
{
}
CATCH (except, RETURN_MASK_ALL)
{
@@
-362,9
+360,8
@@
frapy_function (PyObject *self, PyObject *args)
PyObject *
frame_info_to_frame_object (struct frame_info *frame)
{
PyObject *
frame_info_to_frame_object (struct frame_info *frame)
{
- frame_object *frame_obj;
-
- frame_obj = PyObject_New (frame_object, &frame_object_type);
+ gdbpy_ref<frame_object> frame_obj (PyObject_New (frame_object,
+ &frame_object_type));
if (frame_obj == NULL)
return NULL;
if (frame_obj == NULL)
return NULL;
@@
-390,13
+387,12
@@
frame_info_to_frame_object (struct frame_info *frame)
}
CATCH (except, RETURN_MASK_ALL)
{
}
CATCH (except, RETURN_MASK_ALL)
{
- Py_DECREF (frame_obj);
gdbpy_convert_exception (except);
return NULL;
}
END_CATCH
gdbpy_convert_exception (except);
return NULL;
}
END_CATCH
- return (PyObject *) frame_obj;
+ return (PyObject *) frame_obj
.release ()
;
}
/* Implementation of gdb.Frame.older (self) -> gdb.Frame.
}
/* Implementation of gdb.Frame.older (self) -> gdb.Frame.
@@
-472,14
+468,13
@@
static PyObject *
frapy_find_sal (PyObject *self, PyObject *args)
{
struct frame_info *frame;
frapy_find_sal (PyObject *self, PyObject *args)
{
struct frame_info *frame;
- struct symtab_and_line sal;
PyObject *sal_obj = NULL; /* Initialize to appease gcc warning. */
TRY
{
FRAPY_REQUIRE_VALID (self, frame);
PyObject *sal_obj = NULL; /* Initialize to appease gcc warning. */
TRY
{
FRAPY_REQUIRE_VALID (self, frame);
-
find_frame_sal (frame, &sal
);
+
symtab_and_line sal = find_frame_sal (frame
);
sal_obj = symtab_and_line_to_sal_object (sal);
}
CATCH (except, RETURN_MASK_ALL)
sal_obj = symtab_and_line_to_sal_object (sal);
}
CATCH (except, RETURN_MASK_ALL)
@@
-514,13
+509,11
@@
frapy_read_var (PyObject *self, PyObject *args)
var = symbol_object_to_symbol (sym_obj);
else if (gdbpy_is_string (sym_obj))
{
var = symbol_object_to_symbol (sym_obj);
else if (gdbpy_is_string (sym_obj))
{
- char *var_name;
-
struct cleanup *cleanup
;
+ gdb::unique_xmalloc_ptr<char>
+
var_name (python_string_to_target_string (sym_obj))
;
- var_name = python_string_to_target_string (sym_obj);
if (!var_name)
return NULL;
if (!var_name)
return NULL;
- cleanup = make_cleanup (xfree, var_name);
if (block_obj)
{
if (block_obj)
{
@@
-529,7
+522,6
@@
frapy_read_var (PyObject *self, PyObject *args)
{
PyErr_SetString (PyExc_RuntimeError,
_("Second argument must be block."));
{
PyErr_SetString (PyExc_RuntimeError,
_("Second argument must be block."));
- do_cleanups (cleanup);
return NULL;
}
}
return NULL;
}
}
@@
-541,13
+533,12
@@
frapy_read_var (PyObject *self, PyObject *args)
if (!block)
block = get_frame_block (frame, NULL);
if (!block)
block = get_frame_block (frame, NULL);
- lookup_sym = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
+ lookup_sym = lookup_symbol (var_name
.get ()
, block, VAR_DOMAIN, NULL);
var = lookup_sym.symbol;
block = lookup_sym.block;
}
CATCH (except, RETURN_MASK_ALL)
{
var = lookup_sym.symbol;
block = lookup_sym.block;
}
CATCH (except, RETURN_MASK_ALL)
{
- do_cleanups (cleanup);
gdbpy_convert_exception (except);
return NULL;
}
gdbpy_convert_exception (except);
return NULL;
}
@@
-556,13
+547,10
@@
frapy_read_var (PyObject *self, PyObject *args)
if (!var)
{
PyErr_Format (PyExc_ValueError,
if (!var)
{
PyErr_Format (PyExc_ValueError,
- _("Variable '%s' not found."), var_name);
- do_cleanups (cleanup);
+ _("Variable '%s' not found."), var_name.get ());
return NULL;
}
return NULL;
}
-
- do_cleanups (cleanup);
}
else
{
}
else
{
This page took
0.025483 seconds
and
4
git commands to generate.