shell.py: Add only callables to locals, but also sysregs

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2021-05-12 21:21:27 +09:00
parent 4d75ff90ff
commit 4a918346a8

View file

@ -62,11 +62,16 @@ def run_shell(locals, msg=None, exitmsg=None):
if "utils" in locals and "u" not in locals:
locals["u"] = locals["utils"]
for obj in ("iface", "p", "u", "sysreg"):
for obj in ("iface", "p", "u"):
if obj in locals:
for attr in dir(locals[obj]):
if attr not in locals:
locals[attr] = getattr(locals[obj], attr)
v = getattr(locals[obj], attr)
if callable(v):
locals[attr] = v
for attr in dir(sysreg):
locals[attr] = getattr(sysreg, attr)
try:
con = HistoryConsole(locals)