if (sym)
return symbol_to_symbol_object (sym).release ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
static PyObject *
if (super_block)
return block_to_block_object (super_block, self_obj->objfile).release ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implement gdb.Block.subblocks attribute. Return a list of gdb.Block
BLPY_REQUIRE_VALID (self, block);
if (block->superblock () == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
static_block = block->static_block ();
BLPY_REQUIRE_VALID (self, block);
if (block->superblock ())
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Implementation of gdb.Block.is_static (self) -> Boolean.
if (block->superblock () != NULL
&& block->superblock ()->superblock () == NULL)
- Py_RETURN_TRUE;
+ return py_true ().release ();
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Given a string, returns the gdb.Symbol representing that symbol in this
block = block_object_to_block (self);
if (block == NULL)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Implementation of gdb.BlockIterator.is_valid (self) -> Boolean.
(block_syms_iterator_object *) self;
if (iter_obj->source->block == NULL)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* __repr__ implementation for gdb.Block. */
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
if (self_bp->bp)
- Py_RETURN_TRUE;
- Py_RETURN_FALSE;
+ return py_true ().release ();
+ return py_false ().release ();
}
/* Python function to test whether or not the breakpoint is enabled. */
BPPY_REQUIRE_VALID (self_bp);
if (! self_bp->bp)
- Py_RETURN_FALSE;
+ return py_false ().release ();
if (self_bp->bp->enable_state == bp_enabled)
- Py_RETURN_TRUE;
- Py_RETURN_FALSE;
+ return py_true ().release ();
+ return py_false ().release ();
}
/* Python function to test whether or not the breakpoint is silent. */
BPPY_REQUIRE_VALID (self_bp);
if (self_bp->bp->silent)
- Py_RETURN_TRUE;
- Py_RETURN_FALSE;
+ return py_true ().release ();
+ return py_false ().release ();
}
/* Python function to set the enabled state of a breakpoint. */
return gdbpy_handle_gdb_exception (nullptr, except);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
if (obj->bp->type != bp_breakpoint
&& obj->bp->type != bp_hardware_breakpoint)
- Py_RETURN_NONE;
+ return py_none ().release ();
const char *str = obj->bp->locspec->to_string ();
if (str == nullptr)
BPPY_REQUIRE_VALID (obj);
if (!is_watchpoint (obj->bp))
- Py_RETURN_NONE;
+ return py_none ().release ();
watchpoint *wp = gdb::checked_static_cast<watchpoint *> (obj->bp);
str = obj->bp->cond_string.get ();
if (! str)
- Py_RETURN_NONE;
+ return py_none ().release ();
return host_string_to_python_string (str).release ();
}
BPPY_REQUIRE_VALID (self_bp);
if (! self_bp->bp->commands)
- Py_RETURN_NONE;
+ return py_none ().release ();
string_file stb;
BPPY_REQUIRE_VALID (self_bp);
if (user_breakpoint_p (self_bp->bp))
- Py_RETURN_TRUE;
+ return py_true ().release ();
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Python function to determine if the breakpoint is a temporary
if (self_bp->bp->disposition == disp_del
|| self_bp->bp->disposition == disp_del_at_next_stop)
- Py_RETURN_TRUE;
+ return py_true ().release ();
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Python function to determine if the breakpoint is a pending
BPPY_REQUIRE_VALID (self_bp);
if (is_watchpoint (self_bp->bp))
- Py_RETURN_FALSE;
+ return py_false ().release ();
if (pending_breakpoint_p (self_bp->bp))
- Py_RETURN_TRUE;
+ return py_true ().release ();
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Python function to get the breakpoint's number. */
BPPY_REQUIRE_VALID (self_bp);
if (self_bp->bp->thread == -1)
- Py_RETURN_NONE;
+ return py_none ().release ();
return gdb_py_object_from_longest (self_bp->bp->thread).release ();
}
BPPY_REQUIRE_VALID (self_bp);
if (self_bp->bp->inferior == -1)
- Py_RETURN_NONE;
+ return py_none ().release ();
return gdb_py_object_from_longest (self_bp->bp->inferior).release ();
}
BPPY_REQUIRE_VALID (self_bp);
if (self_bp->bp->task == -1)
- Py_RETURN_NONE;
+ return py_none ().release ();
return gdb_py_object_from_longest (self_bp->bp->task).release ();
}
BPLOCPY_REQUIRE_VALID (self->owner, self);
if (self->bp_loc->enabled)
- Py_RETURN_TRUE;
+ return py_true ().release ();
else
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Python function to get address of breakpoint location. */
return tup.release ();
}
else
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Python function to get the function name of where this location was set. */
const auto fn_name = self->bp_loc->function_name.get ();
if (fn_name != nullptr)
return host_string_to_python_string (fn_name).release ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
static PyObject *
= host_string_to_python_string (symtab->fullname ());
return fullname.release ();
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* De-allocation function to be called for the Python object. */
cmdpy_dont_repeat (PyObject *self, PyObject *args)
{
dont_repeat ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
\f
connection_object *conn = (connection_object *) self;
if (conn->target == nullptr)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Return the id number of this connection. */
if (details != nullptr)
return host_string_to_python_string (details).release ();
else
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Python specific initialization for this file. */
corefile_object *obj = (corefile_object *) self;
if (!cfpy_corefile_object_is_valid (obj))
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Implement gdb.Corefile.mapped_files (). Return a List of
= (corefile_mapped_file_object *) self;
if (obj->is_main_exec_p)
- Py_RETURN_TRUE;
+ return py_true ().release ();
else
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
\f
disasm_info_object *disasm_obj = (disasm_info_object *) self;
if (disasm_info_object_is_valid (disasm_obj))
- Py_RETURN_TRUE;
+ return py_true ().release ();
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Set the Python exception to be a gdb.MemoryError object, with ADDRESS
return nullptr;
python_print_insn_enabled = newstate == Py_True;
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implement DisassembleInfo.read_memory(LENGTH, OFFSET). Read LENGTH
if (PyList_Append (callback_list, func) < 0)
return NULL;
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implementation of EventRegistry.disconnect () -> NULL.
index = PySequence_Index (callback_list, func);
if (index < 0)
- Py_RETURN_NONE;
+ return py_none ().release ();
if (PySequence_DelItem (callback_list, index) < 0)
return NULL;
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Create a new event registry. This function uses PyObject_New
(struct finish_breakpoint_object *) self;
if (!self_finishbp->return_value)
- Py_RETURN_NONE;
+ return py_none ().release ();
Py_INCREF (self_finishbp->return_value);
return self_finishbp->return_value;
}
if (frame == NULL)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Implementation of gdb.Frame.name (self) -> String.
if (sym)
return symbol_to_symbol_object (sym).release ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Convert a frame_info struct to a Python Frame object.
return gdbpy_handle_gdb_exception (nullptr, except);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* The stack frame level for this frame. */
}
if (link == nullptr)
- Py_RETURN_NONE;
+ return py_none ().release ();
return frame_info_to_frame_object (link).release ();
}
result = Py_NE;
if (op == result)
- Py_RETURN_TRUE;
- Py_RETURN_FALSE;
+ return py_true ().release ();
+ return py_false ().release ();
}
/* Sets up the Frame API in the gdb module. */
}
}
else
- Py_RETURN_NONE;
+ return py_none ().release ();
return NULL;
}
process_stratum_target *target = inf->inferior->process_target ();
if (target == nullptr)
- Py_RETURN_NONE;
+ return py_none ().release ();
return gdb_py_object_from_longest (target->connection_number).release ();
}
INFPY_REQUIRE_VALID (inf);
if (inf->inferior->attach_flag)
- Py_RETURN_TRUE;
- Py_RETURN_FALSE;
+ return py_true ().release ();
+ return py_false ().release ();
}
/* Getter of gdb.Inferior.progspace. */
return gdbpy_handle_gdb_exception (nullptr, ex);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implementation of
if (found)
return gdb_py_object_from_ulongest (found_addr).release ();
else
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implementation of gdb.Inferior.is_valid (self) -> Boolean.
inferior_object *inf = (inferior_object *) self;
if (! inf->inferior)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Implementation of gdb.Inferior.thread_from_handle (self, handle)
return gdbpy_handle_gdb_exception (nullptr, except);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implementation of gdb.Inferior.architecture. */
INFPY_REQUIRE_VALID (self);
self->inferior->environment.clear ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implement set_env. */
return nullptr;
self->inferior->environment.set (name, val);
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implement unset_env. */
return nullptr;
self->inferior->environment.unset (name);
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Getter for "arguments". */
const std::string &args = inf->inferior->args ();
if (args.empty ())
- Py_RETURN_NONE;
+ return py_none ().release ();
return host_string_to_python_string (args.c_str ()).release ();
}
}
if (name == nullptr)
- Py_RETURN_NONE;
+ return py_none ().release ();
return host_string_to_python_string (name).release ();
}
const char *name = thread_name (thread_obj->thread);
if (name == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
return PyUnicode_FromString (name);
}
return gdbpy_handle_gdb_exception (nullptr, except);
}
if (extra_info == nullptr)
- Py_RETURN_NONE;
+ return py_none ().release ();
return PyUnicode_FromString (extra_info);
}
return gdbpy_handle_gdb_exception (nullptr, except);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implementation of InferiorThread.is_stopped () -> Boolean.
THPY_REQUIRE_VALID (thread_obj);
if (thread_obj->thread->state () == THREAD_STOPPED)
- Py_RETURN_TRUE;
+ return py_true ().release ();
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Implementation of InferiorThread.is_running () -> Boolean.
THPY_REQUIRE_VALID (thread_obj);
if (thread_obj->thread->state () == THREAD_RUNNING)
- Py_RETURN_TRUE;
+ return py_true ().release ();
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Implementation of InferiorThread.is_exited () -> Boolean.
THPY_REQUIRE_VALID (thread_obj);
if (thread_obj->thread->state () == THREAD_EXITED)
- Py_RETURN_TRUE;
+ return py_true ().release ();
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Implementation of gdb.InfThread.is_valid (self) -> Boolean.
thread_object *thread_obj = (thread_object *) self;
if (! thread_obj->thread)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Implementation of gdb.InferiorThread.handle (self) -> handle. */
if (inferior_ptid != null_ptid)
return thread_to_thread_object (inferior_thread ()).release ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
static int
int i;
if (entries.size () < 1)
- Py_RETURN_NONE;
+ return py_none ().release ();
gdbpy_ref<> tuple (PyTuple_New (entries.size ()));
{
const linetable_entry *item = &(symtab->linetable ()->item[index]);
if (item->line == py_line)
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Implementation of gdb.LineTable.source_lines (self) -> List.
symtab = symtab_object_to_symtab (get_symtab (self));
if (symtab == NULL)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Deconstructor for the line table object. Decrement the reference
symtab = symtab_object_to_symtab (get_symtab (iter_obj->source));
if (symtab == NULL)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
GDBPY_INITIALIZE_FILE (gdbpy_initialize_linetable);
gdb_flush (mi->event_channel);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
struct micmdpy_object *micmd_obj = (struct micmdpy_object *) self;
if (micmd_obj->mi_command == nullptr)
- Py_RETURN_FALSE;
- Py_RETURN_TRUE;
+ return py_false ().release ();
+ return py_true ().release ();
}
/* Set the gdb.MICommand.installed property. The property can be set to
if (obj->objfile)
return (host_string_to_python_string (objfile_name (obj->objfile))
.release ());
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* An Objfile method which returns the objfile's file name, as specified
return host_string_to_python_string (username).release ();
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Get the 'is_file' attribute. */
if (self->objfile != nullptr)
return PyBool_FromLong ((self->objfile->flags & OBJF_NOT_FILENAME) == 0);
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* If SELF is a separate debug-info file, return the "backlink" field.
owner = objfile->separate_debug_objfile_backlink;
if (owner != NULL)
return objfile_to_objfile_object (owner).release ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* An Objfile method which returns the objfile's build id, or None. */
return host_string_to_python_string (hex_form.c_str ()).release ();
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* An Objfile method which returns the objfile's progspace, or None. */
if (obj->objfile)
return pspace_to_pspace_object (obj->objfile->pspace ()).release ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
static void
objfile_object *obj = (objfile_object *) self;
if (! obj->objfile)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Implementation of gdb.Objfile.add_separate_debug_file (self, string). */
return gdbpy_handle_gdb_exception (nullptr, except);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implementation of
struct symbol *sym = lookup_global_symbol_from_objfile
(obj->objfile, GLOBAL_BLOCK, symbol_name, flags).symbol;
if (sym == nullptr)
- Py_RETURN_NONE;
+ return py_none ().release ();
return symbol_to_symbol_object (sym).release ();
}
struct symbol *sym = lookup_global_symbol_from_objfile
(obj->objfile, STATIC_BLOCK, symbol_name, flags).symbol;
if (sym == nullptr)
- Py_RETURN_NONE;
+ return py_none ().release ();
return symbol_to_symbol_object (sym).release ();
}
return function.release ();
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Subroutine of find_pretty_printer to simplify it.
return (host_string_to_python_string (objfile_name (objfile))
.release ());
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implement the gdb.Progspace.symbol_file attribute. Return the
if (objfile != nullptr)
return objfile_to_objfile_object (objfile).release ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implement the gdb.Progspace.executable_filename attribute. Return a
if (filename != nullptr)
return host_string_to_python_string (filename).release ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
static void
const char *soname = solib_name_from_address (self->pspace, pc);
if (soname == nullptr)
- Py_RETURN_NONE;
+ return py_none ().release ();
return host_string_to_python_string (soname).release ();
}
struct objfile *objf = self->pspace->objfile_for_address (addr);
if (objf == nullptr)
- Py_RETURN_NONE;
+ return py_none ().release ();
return objfile_to_objfile_object (objf).release ();
}
}
if (cust == NULL || cust->objfile () == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
if (block)
return block_to_block_object (block, cust->objfile ()).release ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implementation of the find_pc_line function.
pspace_object *self = (pspace_object *) o;
if (self->pspace == NULL)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
\f
return NULL;
if (insn->flags & BTRACE_INSN_FLAG_SPECULATIVE)
- Py_RETURN_TRUE;
+ return py_true ().release ();
else
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Implementation of RecordInstruction.data [buffer] for btrace.
return NULL;
if (func->sym == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
return symbol_to_symbol_object (func->sym).release ();
}
return NULL;
if (func->up == 0)
- Py_RETURN_NONE;
+ return py_none ().release ();
return recpy_func_new (((recpy_element_object *) self)->thread,
RECORD_METHOD_BTRACE, func->up);
return NULL;
if (func->prev == 0)
- Py_RETURN_NONE;
+ return py_none ().release ();
return recpy_func_new (((recpy_element_object *) self)->thread,
RECORD_METHOD_BTRACE, func->prev);
return NULL;
if (func->next == 0)
- Py_RETURN_NONE;
+ return py_none ().release ();
return recpy_func_new (((recpy_element_object *) self)->thread,
RECORD_METHOD_BTRACE, func->next);
&& obj1->first == obj2->first
&& obj1->last == obj2->last
&& obj1->step == obj2->step)
- Py_RETURN_TRUE;
+ return py_true ().release ();
else
- Py_RETURN_FALSE;
+ return py_false ().release ();
case Py_NE:
if (obj1->thread != obj2->thread
|| obj1->first != obj2->first
|| obj1->last != obj2->last
|| obj1->step != obj2->step)
- Py_RETURN_TRUE;
+ return py_true ().release ();
else
- Py_RETURN_FALSE;
+ return py_false ().release ();
default:
break;
const struct btrace_config * config;
if (tinfo == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
config = btrace_conf (&tinfo->btrace);
if (config == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
return PyUnicode_FromString (btrace_format_short_string (config->format));
}
thread_info * tinfo = record->thread;
if (tinfo == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
if (tinfo->btrace.replay == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
return btpy_item_new (tinfo, btrace_insn_number (tinfo->btrace.replay));
}
struct btrace_insn_iterator iterator;
if (tinfo == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
btrace_fetch (tinfo, record_btrace_get_cpu ());
if (btrace_is_empty (tinfo))
- Py_RETURN_NONE;
+ return py_none ().release ();
btrace_insn_begin (&iterator, &tinfo->btrace);
return btpy_item_new (tinfo, btrace_insn_number (&iterator));
struct btrace_insn_iterator iterator;
if (tinfo == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
btrace_fetch (tinfo, record_btrace_get_cpu ());
if (btrace_is_empty (tinfo))
- Py_RETURN_NONE;
+ return py_none ().release ();
btrace_insn_end (&iterator, &tinfo->btrace);
return btpy_item_new (tinfo, btrace_insn_number (&iterator));
unsigned long last = 0;
if (tinfo == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
btrace_fetch (tinfo, record_btrace_get_cpu ());
if (btrace_is_empty (tinfo))
- Py_RETURN_NONE;
+ return py_none ().release ();
btrace_insn_begin (&iterator, &tinfo->btrace);
first = btrace_insn_number (&iterator);
unsigned long last = 0;
if (tinfo == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
btrace_fetch (tinfo, record_btrace_get_cpu ());
if (btrace_is_empty (tinfo))
- Py_RETURN_NONE;
+ return py_none ().release ();
btrace_call_begin (&iterator, &tinfo->btrace);
first = btrace_call_number (&iterator);
return gdbpy_handle_gdb_exception (nullptr, except);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implementation of BtraceRecord.clear (self) -> None. */
btrace_clear (tinfo);
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* BtraceList methods. */
if (obj1->thread == obj2->thread
&& obj1->method == obj2->method
&& obj1->number == obj2->number)
- Py_RETURN_TRUE;
+ return py_true ().release ();
else
- Py_RETURN_FALSE;
+ return py_false ().release ();
case Py_NE:
if (obj1->thread != obj2->thread
|| obj1->method != obj2->method
|| obj1->number != obj2->number)
- Py_RETURN_TRUE;
+ return py_true ().release ();
else
- Py_RETURN_FALSE;
+ return py_false ().release ();
default:
break;
recpy_record_object *ret = NULL;
if (find_record_target () == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
ret = PyObject_New (recpy_record_object, &recpy_record_type);
if (ret == nullptr)
return gdbpy_handle_gdb_exception (nullptr, except);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
GDBPY_INITIALIZE_FILE (gdbpy_initialize_record);
return gdbpy_get_register_descriptor (gdbarch, regnum).release ();
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* See python-internal.h. */
SYMPY_REQUIRE_VALID (self, symbol);
if (!symbol->is_objfile_owned ())
- Py_RETURN_NONE;
+ return py_none ().release ();
return symtab_to_symtab_object (symbol->symtab ()).release ();
}
}
if (result)
- Py_RETURN_TRUE;
- Py_RETURN_FALSE;
+ return py_true ().release ();
+ return py_false ().release ();
}
/* Implementation of gdb.Symbol.line -> int.
symbol = symbol_object_to_symbol (self);
if (symbol == NULL)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Implementation of gdb.Symbol.value (self[, frame]) -> gdb.Value. Returns
return host_string_to_python_string (producer).release ();
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
static PyObject *
symtab = symtab_object_to_symtab (self);
if (symtab == NULL)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Return the GLOBAL_BLOCK of the underlying symtab. */
std::optional<int> last_lineno = last_symtab_line (symtab);
if (!last_lineno.has_value ())
- Py_RETURN_NONE;
+ return py_none ().release ();
if (first < 1)
= make_scoped_restore (&source_styling, required_styling);
if (!g_source_cache.get_source_lines (symtab, first, last, &lines))
- Py_RETURN_NONE;
+ return py_none ().release ();
}
gdbpy_ref<> list (PyList_New (0));
if (sal->end > 0)
return gdb_py_object_from_ulongest (sal->end - 1).release ();
else
- Py_RETURN_NONE;
+ return py_none ().release ();
}
static PyObject *
SALPY_REQUIRE_VALID (self, sal);
if (sal->symtab == nullptr)
- Py_RETURN_NONE;
+ return py_none ().release ();
else
return symtab_to_symtab_object (sal->symtab).release ();
}
sal = sal_object_to_symtab_and_line (self);
if (sal == NULL)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
static void
return gdbpy_handle_gdb_exception (nullptr, except);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
\f
gdbpy_tui_window *win = (gdbpy_tui_window *) self;
if (win->is_valid ())
- Py_RETURN_TRUE;
- Py_RETURN_FALSE;
+ return py_true ().release ();
+ return py_false ().release ();
}
/* Python function that erases the TUI window. */
win->window->erase ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Python function that writes some text to a TUI window. */
win->window->output (text, full_window);
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Return the width of the TUI window. */
struct type *type = ((type_object *) self)->type;
if (type->name () == NULL)
- Py_RETURN_NONE;
+ return py_none ().release ();
/* Ada type names are encoded, but it is better for users to see the
decoded form. */
if (ADA_TYPE_P (type))
tagname = type->name ();
if (tagname == nullptr)
- Py_RETURN_NONE;
+ return py_none ().release ();
return PyUnicode_FromString (tagname);
}
struct objfile *objfile = type->objfile_owner ();
if (objfile == nullptr)
- Py_RETURN_NONE;
+ return py_none ().release ();
return objfile_to_objfile_object (objfile).release ();
}
struct type *type = ((type_object *) self)->type;
if (is_scalar_type (type))
- Py_RETURN_TRUE;
+ return py_true ().release ();
else
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Return true if this type is signed. Raises a ValueError if this type
}
if (type->is_unsigned ())
- Py_RETURN_FALSE;
+ return py_false ().release ();
else
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Return true if this type is array-like. */
}
if (result)
- Py_RETURN_TRUE;
+ return py_true ().release ();
else
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Return true if this type is string-like. */
}
if (result)
- Py_RETURN_TRUE;
+ return py_true ().release ();
else
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Return the type, stripped of typedefs. */
/* Ignore exceptions. */
if (size_varies)
- Py_RETURN_NONE;
+ return py_none ().release ();
return gdb_py_object_from_longest (type->length ()).release ();
}
}
if (result)
- Py_RETURN_TRUE;
- Py_RETURN_FALSE;
+ return py_true ().release ();
+ return py_false ().release ();
}
static struct type *
}
if (op == (result ? Py_EQ : Py_NE))
- Py_RETURN_TRUE;
- Py_RETURN_FALSE;
+ return py_true ().release ();
+ return py_false ().release ();
}
\f
const char *t_field_name = field.name ();
if (t_field_name && (strcmp_iw (t_field_name, field_name) == 0))
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Make an iterator object to iterate over keys, values, or items. */
here and True otherwise, but again that might require changes in
user code. So, handle this with minimal impact for the user, while
improving robustness: silently ignore the register/value pair. */
- Py_RETURN_NONE;
+ return py_none ().release ();
}
}
catch (const gdb_exception &except)
if (!found)
unwind_info->saved_regs->emplace_back (regnum, std::move (new_value));
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* UnwindInfo cleanup. */
pending_frame_object *pending_frame = (pending_frame_object *) self;
if (pending_frame->frame_info == nullptr)
- Py_RETURN_FALSE;
+ return py_false ().release ();
- Py_RETURN_TRUE;
+ return py_true ().release ();
}
/* Implement PendingFrame.name(). Return a string that is the name of the
return PyUnicode_Decode (name.get (), strlen (name.get ()),
host_charset (), nullptr);
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implement gdb.PendingFrame.pc(). Returns an integer containing the
if (sym != nullptr)
return symbol_to_symbol_object (sym).release ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implementation of
if (!valpy_assign_core (self, val))
return nullptr;
- Py_RETURN_NONE;
+ return py_none ().release ();
}
static Py_ssize_t
}
if (opt)
- Py_RETURN_TRUE;
+ return py_true ().release ();
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Implements gdb.Value.is_unavailable. Return true if any part of the
}
if (!entirely_available)
- Py_RETURN_TRUE;
+ return py_true ().release ();
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Implements gdb.Value.is_lazy. */
}
if (opt)
- Py_RETURN_TRUE;
+ return py_true ().release ();
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Get gdb.Value.bytes attribute. */
return gdbpy_handle_gdb_exception (nullptr, except);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Calculate and return the address of the PyObject as the value of
case Py_LT:
case Py_LE:
case Py_EQ:
- Py_RETURN_FALSE;
+ return py_false ().release ();
case Py_NE:
case Py_GT:
case Py_GE:
- Py_RETURN_TRUE;
+ return py_true ().release ();
default:
/* Can't happen. */
PyErr_SetString (PyExc_NotImplementedError,
return NULL;
if (result == 1)
- Py_RETURN_TRUE;
+ return py_true ().release ();
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
/* Implements conversion to long. */
}
if (result == nullptr && !found)
- Py_RETURN_NONE;
+ return py_none ().release ();
return result.release ();
}
return gdbpy_handle_gdb_exception (nullptr, except);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Returns 1 in OBJ is a gdb.Value object, 0 otherwise. */
if (enabled == 0)
{
/* Return 'None' if the matcher is not enabled. */
- Py_RETURN_NONE;
+ return py_none ().release ();
}
gdbpy_ref<> match_method (PyObject_GetAttrString (matcher,
case var_boolean:
{
if (var.get<bool> ())
- Py_RETURN_TRUE;
+ return py_true ().release ();
else
- Py_RETURN_FALSE;
+ return py_false ().release ();
}
case var_auto_boolean:
enum auto_boolean ab = var.get<enum auto_boolean> ();
if (ab == AUTO_BOOLEAN_TRUE)
- Py_RETURN_TRUE;
+ return py_true ().release ();
else if (ab == AUTO_BOOLEAN_FALSE)
- Py_RETURN_FALSE;
+ return py_false ().release ();
else
- Py_RETURN_NONE;
+ return py_none ().release ();
}
case var_uinteger:
&& *l->val == -1)
value = -1;
else
- Py_RETURN_NONE;
+ return py_none ().release ();
}
else if (l->val.has_value ())
value = *l->val;
if (to_string)
return PyUnicode_Decode (to_string_res.c_str (), to_string_res.size (),
host_charset (), nullptr);
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implementation of Python rbreak command. Take a REGEX and
gdbpy_invalidate_cached_frames (PyObject *self, PyObject *args)
{
reinit_frame_cache ();
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Read a file as Python code.
gdbpy_event event (std::move (func_ref));
run_on_main_thread (event);
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Interrupt the current operation on the main thread. */
}
#endif
- Py_RETURN_NONE;
+ return py_none ().release ();
}
\f
return gdbpy_handle_gdb_exception (nullptr, except);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* A python function to flush a gdb stream. The optional keyword
gdb_flush (gdb_stdout);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Implement gdb.warning(). Takes a single text string argument and emit a
return gdbpy_handle_gdb_exception (nullptr, ex);
}
- Py_RETURN_NONE;
+ return py_none ().release ();
}
/* Return non-zero if print-stack is not "none". */
gdbpy_get_current_objfile (PyObject *unused1, PyObject *unused2)
{
if (! gdbpy_current_objfile)
- Py_RETURN_NONE;
+ return py_none ().release ();
return objfile_to_objfile_object (gdbpy_current_objfile).release ();
}