Rename python function thread_from_thread_handle to thread_from_handle

This renaming was done to stay consistent with the naming of the new
gdb.InferiorThread.handle method.  I had initially named it "thread_handle"
but Tom Tromey suggested just "handle".

The old name (thread_from_thread_handle) still works, but is marked as
deprecated in comments in the code as well as in the documentation.

I have some code which uses these functions.  I very much like the
brevity of the new names.

gdb/doc/ChangeLog:

	* python.texi (Inferiors In Python): Rename
	Inferior.thread_from_thread_handle to Inferior.thread_from_handle.
	Add note about the former being deprecated.

gdb/ChangeLog:

	* python/py-inferior.c (infpy_thread_from_thread_handle):
	Adjust comments to reflect renaming of thread_from_thread_handle
	to thread_from_handle.  Adjust keywords.  Fix type error message.
	(inferior_object_methods): Add thread_from_handle.  Retain
	thread_from_thread_handle, but mark it as deprecated.

testsuite/ChangeLog:

	* gdb.python/py-thrhandle.exp: Adjust tests to call
	thread_from_handle instead of thread_from_thread_handle.
This commit is contained in:
Kevin Buettner 2019-03-20 20:38:33 -07:00
parent c369f8f0fa
commit 2b0c8b0199
6 changed files with 50 additions and 20 deletions

View file

@ -755,7 +755,7 @@ infpy_is_valid (PyObject *self, PyObject *args)
Py_RETURN_TRUE;
}
/* Implementation of gdb.Inferior.thread_from_thread_handle (self, handle)
/* Implementation of gdb.Inferior.thread_from_handle (self, handle)
-> gdb.InferiorThread. */
static PyObject *
@ -763,7 +763,7 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
{
PyObject *handle_obj;
inferior_object *inf_obj = (inferior_object *) self;
static const char *keywords[] = { "thread_handle", NULL };
static const char *keywords[] = { "handle", NULL };
INFPY_REQUIRE_VALID (inf_obj);
@ -791,7 +791,7 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
else
{
PyErr_SetString (PyExc_TypeError,
_("Argument 'handle_obj' must be a thread handle object."));
_("Argument 'handle' must be a thread handle object."));
return NULL;
}
@ -956,9 +956,15 @@ Write the given buffer object to the inferior's memory." },
METH_VARARGS | METH_KEYWORDS,
"search_memory (address, length, pattern) -> long\n\
Return a long with the address of a match, or None." },
/* thread_from_thread_handle is deprecated. */
{ "thread_from_thread_handle", (PyCFunction) infpy_thread_from_thread_handle,
METH_VARARGS | METH_KEYWORDS,
"thread_from_thread_handle (handle) -> gdb.InferiorThread.\n\
Return thread object corresponding to thread handle.\n\
This method is deprecated - use thread_from_handle instead." },
{ "thread_from_handle", (PyCFunction) infpy_thread_from_thread_handle,
METH_VARARGS | METH_KEYWORDS,
"thread_from_handle (handle) -> gdb.InferiorThread.\n\
Return thread object corresponding to thread handle." },
{ "architecture", (PyCFunction) infpy_architecture, METH_NOARGS,
"architecture () -> gdb.Architecture\n\