scripts: coredump: fix crashing on non-existent memory region

get_mem_region() may return None for a non-existent memory region
so we need to check first before looking at its properties.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2020-10-28 11:50:56 -07:00 committed by Anas Nashif
parent e932a1537c
commit 1387e7c7c2
1 changed files with 4 additions and 3 deletions

View File

@ -139,13 +139,14 @@ class GdbStub(abc.ABC):
barray = b''
r = get_mem_region(addr)
while remaining > 0:
if addr > r['end']:
r = get_mem_region(addr)
if r is None:
barray = None
break
if addr > r['end']:
r = get_mem_region(addr)
continue
offset = addr - r['start']
barray += r['data'][offset:offset+1]