gcc-python-plugin icon indicating copy to clipboard operation
gcc-python-plugin copied to clipboard

provide a way to indicate that function sets an exception

Open davidmalcolm opened this issue 8 years ago • 3 comments

This is a "TODO" from the docs:

(TODO: provide a way to mark a function as setting this state)

gdb has some functions that return a value < 0 on error; in this case the python exception is set. This causes false reports from the checker.

In the meantime I may change these functions to return PyObject*, since I think the checker will handle this ok.

davidmalcolm avatar Feb 09 '17 20:02 davidmalcolm

Imported from trac issue 17. Created by tromey on 2012-01-04T16:34:08, last modified: 2013-04-18T14:23:25

davidmalcolm avatar Feb 09 '17 20:02 davidmalcolm

Trac comment by tromey on 2012-01-04 16:52:14:

I've run across a few different cases in gdb:

  • A function that returns a negative value to indicate error. (We could change these if need be)
  • A function where NULL means ok but non-NULL means error. (This one can't easily be changed; it is an iteration function that takes a void* argument and is used all over gdb; but in the Python code we pass in a PyObject*)
  • A function that always sets an error and returns NULL. Normally we can do return gdbpy_convert_exception(...) and the checker will DTRT; but we also call it from a "set" context, where we have to return -1 from the enclosing function.

davidmalcolm avatar Feb 09 '17 20:02 davidmalcolm

Trac comment by tromey on 2013-04-18 14:23:25:

FWIW I think this issue has been solved enough for my purposes. I think closing it would be fine.

davidmalcolm avatar Feb 09 '17 20:02 davidmalcolm