Py_RETURN_TRUE;
}
-/* Return the innermost lexical block containing the specified pc value,
- or 0 if there is none. */
-PyObject *
-gdbpy_block_for_pc (PyObject *self, PyObject *args)
-{
- gdb_py_ulongest pc;
- const struct block *block = NULL;
- struct compunit_symtab *cust = NULL;
-
- if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
- return NULL;
-
- TRY
- {
- cust = find_pc_compunit_symtab (pc);
-
- if (cust != NULL && COMPUNIT_OBJFILE (cust) != NULL)
- block = block_for_pc (pc);
- }
- CATCH (except, RETURN_MASK_ALL)
- {
- GDB_PY_HANDLE_EXCEPTION (except);
- }
- END_CATCH
-
- if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL)
- {
- PyErr_SetString (PyExc_RuntimeError,
- _("Cannot locate object file for block."));
- return NULL;
- }
-
- if (block)
- return block_to_block_object (block, COMPUNIT_OBJFILE (cust));
-
- Py_RETURN_NONE;
-}
-
/* This function is called when an objfile is about to be freed.
Invalidate the block as further actions on the block would result
in bad data. All access to obj->symbol should be gated by