def get_thread_stack(self, thread): """Fetch serialized callstack for input thread.""" result = [] for frame in thread.frames: # SBFrame.GetVariables(arguments, locals, statics, in_scope_only) variables = frame.GetVariables(True, True, False, True) local_variables = self._debugger_store.remote_object_manager.add_object( ValueListRemoteObject( variables, self._debugger_store.remote_object_manager. get_add_object_func(CALL_STACK_OBJECT_GROUP)), CALL_STACK_OBJECT_GROUP) scopeChainObject = local_variables.serialized_value scopeChainObject.update({'description': 'Locals'}) result.append({ 'callFrameId': "%d.%d" % (frame.thread.idx, frame.idx), 'functionName': self._get_frame_name(frame), 'location': self._debugger_store.location_serializer.get_frame_location( frame), 'hasSource': self._debugger_store.location_serializer.has_source(frame), 'scopeChain': [{ 'object': scopeChainObject, 'type': 'local', }], }) return result
def get_thread_stack(self, thread): """Fetch serialized callstack for input thread.""" result = [] for frame in thread.frames: # SBFrame.GetVariables(arguments, locals, statics, in_scope_only) variables = frame.GetVariables(True, True, True, False) local_variables = self._remote_object_manager.add_object( ValueListRemoteObject( variables, self._remote_object_manager.get_add_object_func( CALL_STACK_OBJECT_GROUP)), CALL_STACK_OBJECT_GROUP) target = frame.GetThread().GetProcess().GetTarget() offset = frame.GetPCAddress().GetLoadAddress(target) \ - frame.GetSymbol().GetStartAddress().GetLoadAddress(target) result.append({ 'callFrameId': "%d.%d" % (frame.thread.idx, frame.idx), 'functionName': "%s +%x" % (frame.name, offset), 'location': self._location_serializer.get_frame_location(frame), 'scopeChain': [{ 'object': local_variables.serialized_value, 'type': 'local', }], }) return result
def _get_callstack(self, frames): """Return serialized callstack.""" result = [] for frame in frames: # SBFrame.GetVariables(arguments, locals, statics, in_scope_only) variables = frame.GetVariables(True, True, True, False) local_variables = self.remote_object_manager.add_object( ValueListRemoteObject( variables, self.remote_object_manager.get_add_object_func( CALL_STACK_OBJECT_GROUP)), CALL_STACK_OBJECT_GROUP) result.append({ 'callFrameId': "%d.%d" % (frame.thread.idx, frame.idx), 'functionName': "%s +%x" % (frame.name, int(frame.GetPCAddress()) - int(frame.symbol.addr)), 'location': self.location_serializer.get_frame_location(frame), 'scopeChain': [{ 'object': local_variables.serialized_value, 'type': 'local', }], }) return result