diff --git a/tools/gdb/nuttxgdb/stack.py b/tools/gdb/nuttxgdb/stack.py index f1bc60d4eb7..8315f600d4c 100644 --- a/tools/gdb/nuttxgdb/stack.py +++ b/tools/gdb/nuttxgdb/stack.py @@ -137,10 +137,9 @@ def fetch_stacks(): stacks = dict() for tcb in utils.get_tcbs(): - if ( - tcb["task_state"] == gdb.parse_and_eval("TSTATE_TASK_RUNNING") - and not utils.in_interrupt_context() - ): + # We have no way to detect if we are in an interrupt context for now. + # Originally we use `and not utils.in_interrupt_context()` + if tcb["task_state"] == gdb.parse_and_eval("TSTATE_TASK_RUNNING"): sp = utils.get_sp() else: sp = utils.get_sp(tcb=tcb) diff --git a/tools/gdb/nuttxgdb/utils.py b/tools/gdb/nuttxgdb/utils.py index f85b8036568..45954951620 100644 --- a/tools/gdb/nuttxgdb/utils.py +++ b/tools/gdb/nuttxgdb/utils.py @@ -519,32 +519,6 @@ def in_interrupt_context(cpuid=0): return not g_current_regs or not g_current_regs[cpuid] -def get_arch_sp_name(): - if is_target_arch("arm") or is_target_arch("aarch64"): - # arm and arm variants - return "sp" - elif is_target_arch("i386", exact=True): - return "esp" - elif is_target_arch("i386:x86-64", exact=True): - return "rsp" - else: - # Default to use sp, add more archs if needed - return "sp" - - -def get_arch_pc_name(): - if is_target_arch("arm") or is_target_arch("aarch64"): - # arm and arm variants - return "pc" - elif is_target_arch("i386", exact=True): - return "eip" - elif is_target_arch("i386:x86-64", exact=True): - return "rip" - else: - # Default to use pc, add more archs if needed - return "pc" - - def get_register_byname(regname, tcb=None): frame = gdb.selected_frame() @@ -572,11 +546,11 @@ def get_register_byname(regname, tcb=None): def get_sp(tcb=None): - return get_register_byname(get_arch_sp_name(), tcb) + return get_register_byname("sp", tcb) def get_pc(tcb=None): - return get_register_byname(get_arch_pc_name(), tcb) + return get_register_byname("pc", tcb) def get_tcbs():