Skip to content

Qiling gdbserver not handling stepi instruction #1538

@antcpl

Description

@antcpl

Describe the bug
The gdbserver is sending a SIGTERM each time I perform the si command and this cause my gdbclient to consider the program exited although it's not.

Sample Code
Not related to any particular code, would happen with all examples.

Expected behavior
I think that the gdbserver should send the SIGTRAP signal instead.

Addtionnal context
I debugged a bit the gdbserver and I think that the cause is below : in gdb.py

def handle_s(subcmd: str) -> Reply:
  """Perform a single step.
  """
  
  self.gdb.resume_emu(steps=1)
  
  # if emulation has been stopped, signal program termination
# =====  The condition is always True  ===
 if self.ql.emu_state is QL_STATE.STOPPED: 
   return f'S{SIGTERM:02x}'
# ====================================================================
  # otherwise, this is just single stepping
  return f'S{SIGTRAP:02x}'

Wonder if this condition is useful in a particular case that is not related to mine. I've tested to comment these two lines and everything works perfectly fine after that. I think it also causes other bugs with breakpoint but not so sure and didn't have the time to verify this point.

Additional context
I worked with the dev branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions