mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
gdbserver: check for nullptr condition in regcache::get_register_status
A regcache can be initialized with a register value buffer, in which case, the register_status pointer is null. This condition is checked in set_register_status, but not in get_register_status. Do this check for consistence and safety. Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
@@ -526,7 +526,10 @@ regcache::get_register_status (int regnum) const
|
||||
{
|
||||
#ifndef IN_PROCESS_AGENT
|
||||
gdb_assert (regnum >= 0 && regnum < tdesc->reg_defs.size ());
|
||||
return (enum register_status) (register_status[regnum]);
|
||||
if (register_status != nullptr)
|
||||
return (enum register_status) (register_status[regnum]);
|
||||
else
|
||||
return REG_VALID;
|
||||
#else
|
||||
return REG_VALID;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user