MCPcopy Create free account
hub / github.com/apache/brpc / bthread_begin

Function bthread_begin

tools/lldb_bthread_stack.py:168–203  ·  view source on GitHub ↗
(debugger, command, result, internal_dict)

Source from the content-addressed store, hash-verified

166
167# lldb bthread commands
168def bthread_begin(debugger, command, result, internal_dict):
169 if global_state.started:
170 print("Already in bthread debug mode, do not switch thread before exec 'bthread_end' !!!")
171 return
172 target = debugger.GetSelectedTarget()
173 active_bthreads = get_bthreads_num(target)
174
175 if len(command) == 0:
176 request_bthreds = active_bthreads
177 else:
178 try:
179 request_bthreds = int(command)
180 except ValueError:
181 print("please input a valid interger.")
182 return
183
184 scanned_bthreds = active_bthreads
185 if request_bthreds > active_bthreads:
186 print("requested bthreads {} more than actived, will display {} bthreads".format(
187 request_bthreds, active_bthreads))
188 else:
189 scanned_bthreds = request_bthreds
190 print("Active bthreads: {}, will display {} bthreads".format(
191 active_bthreads, scanned_bthreds))
192 global_state.bthreads = get_all_bthreads(target, scanned_bthreds)
193
194 # backup registers
195 current_frame = target.GetProcess().GetSelectedThread().GetSelectedFrame()
196 saved_regs = dict()
197 saved_regs["rip"] = current_frame.FindRegister("rip").GetValueAsUnsigned()
198 saved_regs["rsp"] = current_frame.FindRegister("rsp").GetValueAsUnsigned()
199 saved_regs["rbp"] = current_frame.FindRegister("rbp").GetValueAsUnsigned()
200 global_state.saved_regs = saved_regs
201
202 global_state.started = True
203 print("Enter bthread debug mode, do not switch thread before exec 'bthread_end' !!!")
204
205
206def bthread_list(debugger, command, result, internal_dict):

Callers

nothing calls this directly

Calls 3

get_bthreads_numFunction · 0.85
formatMethod · 0.80
get_all_bthreadsFunction · 0.70

Tested by

no test coverage detected