From fac14c8c03592f101d34116cb8ecde908e92c18b Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Fri, 6 Oct 2023 06:09:32 -0600 Subject: sim/gdbstub: check if kernel files exist --- sim/gdbstub.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'sim/gdbstub.py') diff --git a/sim/gdbstub.py b/sim/gdbstub.py index 88477be..bf902f2 100644 --- a/sim/gdbstub.py +++ b/sim/gdbstub.py @@ -1,8 +1,12 @@ -import sys, socket, traceback +import os.path, sys, socket, traceback -loads = {0x0100000: 'build/uImage', - 0x1000000: 'build/initrd.img', - } +loads = {} + +if os.path.exists('build/uImage'): + loads[0x0100000] = 'build/uImage' + +if os.path.exists('build/initrd.img'): + loads[0x1000000] = 'build/initrd.img' cycles = None enable_tty = True @@ -24,14 +28,14 @@ def fatal(): stop_reason = 'fatal' yield_to_gdb() -def do_output(text): - if text is None: - return not is_halted() - elif not client: - return False +#def do_output(text): +# if text is None: +# return not is_halted() +# elif not client: +# return False - reply(b'O' + hexout(text.encode('ascii'))) - return True +# reply(b'O' + hexout(text.encode('ascii'))) +# return True buffer = b'' stop_reason = None -- cgit v1.2.3