Skip to content

Commit 3977929

Browse files
committed
Fix no thread issue
1 parent 54c27b6 commit 3977929

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

tools/cbextension.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ def cb_exited_handler(event):
181181

182182
def cb_new_thread_handler(event):
183183
thread = event.inferior_thread
184+
if thread is None:
185+
return
186+
184187
if isinstance(thread, gdb.Inferior):
185188
cb_notify_event({
186189
'inferior': thread.num,
@@ -197,7 +200,9 @@ def cb_new_thread_handler(event):
197200

198201
def cb_stop_handler(event):
199202
thread = event.inferior_thread
200-
gdb.write('stop_handler: %s' % type(thread))
203+
if thread is None:
204+
return
205+
201206
if hasattr(event, 'breakpoints'):
202207
reason = [(bp.thread, bp.number, bp.type, bp.location)
203208
for bp in event.breakpoints]
@@ -224,11 +229,20 @@ def cb_stop_handler(event):
224229

225230
def cb_cont_handler(event):
226231
thread = event.inferior_thread
227-
cb_notify_event({
228-
'inferior': thread.inferior.num,
229-
'thread': thread.num,
230-
'state': 'running',
231-
})
232+
if thread is None:
233+
return
234+
235+
if isinstance(thread, gdb.Inferior):
236+
cb_notify_event({
237+
'inferior': thread.num,
238+
'state': 'running'
239+
})
240+
else:
241+
cb_notify_event({
242+
'inferior': thread.inferior.num,
243+
'thread': thread.num,
244+
'state': 'running',
245+
})
232246

233247

234248
def cb_notify_event(args):

0 commit comments

Comments
 (0)