qiling icon indicating copy to clipboard operation
qiling copied to clipboard

Qiling gdbserver not handling stepi instruction

Open antcpl opened this issue 11 months ago • 2 comments

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.

antcpl avatar Mar 06 '25 14:03 antcpl

You could have a try of udbserver.

bet4it avatar Apr 27 '25 13:04 bet4it

Point out exactly the same problem as https://github.com/qilingframework/qiling/issues/1377#issuecomment-2129839355

antcpl avatar May 27 '25 15:05 antcpl