aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-20 20:31:18 +0000
committerTom Tromey <tromey@redhat.com>2013-05-20 20:31:18 +0000
commit33ee792fe5d3d9622fde9a027e10f157cbad75c0 (patch)
tree92b3c8ef9b8c81b85304b91bb39362d1350a45a8
parentfcb49fc817243a98937f14a9385b3de7d17417d6 (diff)
downloadgdb-33ee792fe5d3d9622fde9a027e10f157cbad75c0.zip
gdb-33ee792fe5d3d9622fde9a027e10f157cbad75c0.tar.gz
gdb-33ee792fe5d3d9622fde9a027e10f157cbad75c0.tar.bz2
* python/py-symtab.c (set_sal): Use
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION. Return -1 on error. (symtab_and_line_to_sal_object): Update.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/python/py-symtab.c13
2 files changed, 11 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f394f87..db245ea 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2013-05-20 Tom Tromey <tromey@redhat.com>
+ * python/py-symtab.c (set_sal): Use
+ CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION. Return -1 on error.
+ (symtab_and_line_to_sal_object): Update.
+
+2013-05-20 Tom Tromey <tromey@redhat.com>
+
* python/py-param.c (compute_enum_values): Decref 'item'.
2013-05-20 Tom Tromey <tromey@redhat.com>
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c
index 80a2282..fe26b4c 100644
--- a/gdb/python/py-symtab.c
+++ b/gdb/python/py-symtab.c
@@ -315,9 +315,8 @@ salpy_dealloc (PyObject *self)
and initialized, populate the sal_object with the struct sal data.
Also, register the sal_object life-cycle with the life-cycle of the
object file associated with this sal, if needed. If a failure
- occurs during the sal population, this function will return
- NULL. */
-static int
+ occurs during the sal population, this function will return -1. */
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
set_sal (sal_object *sal_obj, struct symtab_and_line sal)
{
symtab_object *symtab_obj;
@@ -328,7 +327,7 @@ set_sal (sal_object *sal_obj, struct symtab_and_line sal)
/* If a symtab existed in the sal, but it cannot be duplicated,
we exit. */
if (symtab_obj == NULL)
- return 0;
+ return -1;
}
else
{
@@ -356,7 +355,7 @@ set_sal (sal_object *sal_obj, struct symtab_and_line sal)
else
sal_obj->next = NULL;
- return 1;
+ return 0;
}
/* Given a symtab, and a symtab_object that has previously been
@@ -398,7 +397,6 @@ symtab_to_symtab_object (struct symtab *symtab)
that encapsulates the symtab_and_line structure from GDB. */
PyObject *
symtab_and_line_to_sal_object (struct symtab_and_line sal)
-
{
sal_object *sal_obj;
int success = 0;
@@ -406,8 +404,7 @@ symtab_and_line_to_sal_object (struct symtab_and_line sal)
sal_obj = PyObject_New (sal_object, &sal_object_type);
if (sal_obj)
{
- success = set_sal (sal_obj, sal);
- if (!success)
+ if (set_sal (sal_obj, sal) < 0)
{
Py_DECREF (sal_obj);
return NULL;