Qiling gdbserver not handling stepi instruction

Aperta
#1,538 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Start in gdb.py at handle_s and reproduce the issue by using the si command against an example. Check the gdbserver response after single-stepping and verify that an active emulation returns SIGTRAP rather than SIGTERM. Also investigate whether the same condition affects breakpoint handling, as reported but not confirmed in the issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

gdbserver

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.

Lingua principale
Python
Stelle
6.2k
Fork
806
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di qilingframework/qiling

Tutte le issue di qilingframework/qiling

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.