Exemple #1
0
/* Implementation of
   gdb.lookup_symbol (name [, block] [, domain]) -> (symbol, is_field_of_this)
   A tuple with 2 elements is always returned.  The first is the symbol
   object or None, the second is a boolean with the value of
   is_a_field_of_this (see comment in lookup_symbol_in_language).  */
PyObject *
gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
{
    int domain = VAR_DOMAIN, is_a_field_of_this = 0;
    const char *name;
    static char *keywords[] = { "name", "block", "domain", NULL };
    struct symbol *symbol;
    PyObject *block_obj = NULL, *ret_tuple, *sym_obj, *bool_obj;
    struct block *block = NULL;

    if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O!i", keywords, &name,
                                       &block_object_type, &block_obj, &domain))
        return NULL;

    if (block_obj)
        block = block_object_to_block (block_obj);
    else
    {
        struct frame_info *selected_frame;
        volatile struct gdb_exception except;

        TRY_CATCH (except, RETURN_MASK_ALL)
        {
            selected_frame  = get_selected_frame (_("No frame selected."));
            block = block_for_pc (get_frame_address_in_block (selected_frame));
        }
        GDB_PY_HANDLE_EXCEPTION (except);
    }
Exemple #2
0
static PyObject *
blpy_is_valid (PyObject *self, PyObject *args)
{
  const struct block *block;

  block = block_object_to_block (self);
  if (block == NULL)
    Py_RETURN_FALSE;

  Py_RETURN_TRUE;
}