lldb断点framework中方法

1. 查找要断点类中所有方法

po [RTCPeerConnection _shortMethodDescription]

(lldb) po [RTCPeerConnection _shortMethodDescription]
<RTCPeerConnection: 0x101b070f0>:
in RTCPeerConnection:
	Class Methods:
		+ (int) nativeStatsOutputLevelForLevel:(long)arg1; (0x1013daba0)
		+ (long) signalingStateForNativeState:(int)arg1; (0x1013daaac)
		+ (long) iceConnectionStateForNativeState:(int)arg1; (0x1013dab10)
		+ (long) connectionStateForNativeState:(int)arg1; (0x1013daad8)
		+ (long) iceGatheringStateForNativeState:(int)arg1; (0x1013dab5c)
		+ (int) nativeSignalingStateForState:(long)arg1; (0x1013daaa8)
		+ (id) stringForSignalingState:(long)arg1; (0x1013daab0)
		+ (int) nativeConnectionStateForState:(long)arg1; (0x1013daad4)
		+ (id) stringForConnectionState:(long)arg1; (0x1013daadc)
		+ (int) nativeIceConnectionStateForState:(long)arg1; (0x1013dab00)
		+ (id) stringForIceConnectionState:(long)arg1; (0x1013dab20)
		+ (int) nativeIceGatheringStateForState:(long)arg1; (0x1013dab44)
		+ (id) stringForIceGatheringState:(long)arg1; (0x1013dab74)
	Properties:
		@property (readonly, nonatomic) RTCPeerConnectionFactory* factory;  (@synthesize factory = _factory;)
		@property (readonly, nonatomic) struct scoped_refptr<webrtc::PeerConnectionInterface> nativePeerConnection;
		@property (weak, nonatomic) <RTCPeerConnectionDelegate>* delegate;  (@synthesize delegate = _delegate;)
		@property (readonly, nonatomic) NSArray* localStreams;
		@property (readonly, nonatomic) RTCSessionDescription* localDescription;
		@property (readonly, nonatomic) RTCSessionDescription* remoteDescription;
		@property (readonly, nonatomic) long signalingState;
		@property (readonly, nonatomic) long iceConnectionState;
		@property (readonly, nonatomic) long connectionState;
		@property (readonly, nonatomic) long iceGatheringState;
		@property (readonly, copy, nonatomic) RTCConfiguration* configuration;
		@property (readonly, nonatomic) NSArray* senders;
		@property (readonly, nonatomic) NSArray* receivers;
		@property (readonly, nonatomic) NSArray* transceivers;
	Instance Methods:
		- (void) statisticsWithCompletionHandler:(^block)arg1; (0x1013d6f44)
		- (void) statisticsForSender:(id)arg1 completionHandler:(^block)arg2; (0x1013d6cec)
		- (void) statisticsForReceiver:(id)arg1 completionHandler:(^block)arg2; (0x1013d6e18)
		- (void) statsForTrack:(id)arg1 statsOutputLevel:(long)arg2 completionHandler:(^block)arg3; (0x1013d7028)
		- (id) dataChannelForLabel:(id)arg1 configuration:(id)arg2; (0x1013d6ab0)
		- (void) setLocalDescription:(id)arg1 completionHandler:(^block)arg2; (0x1013d9f10)
		- (void) answerForConstraints:(id)arg1 completionHandler:(^block)arg2; (0x1013d9e34)
		- (void) offerForConstraints:(id)arg1 completionHandler:(^block)arg2; (0x1013d9d58)
		- (void) setRemoteDescription:(id)arg1 completionHandler:(^block)arg2; (0x1013da118)
		- (void) addIceCandidate:(id)arg1 completionHandler:(^block)arg2; (0x1013d8f08)
		- (void) removeIceCandidates:(id)arg1; (0x1013d9048)
		- (id) transceivers; (0x1013da990)
		- (id) addTrack:(id)arg1 streamIds:(id)arg2; (0x1013d9428)
		- (struct scoped_refptr<webrtc::PeerConnectionInterface>) nativePeerConnection; (0x1013dabac)
		- (id) initWithDependencies:(id)arg1 configuration:(id)arg2 constraints:(id)arg3 dependencies:(struct unique_ptr<webrtc::PeerConnectionDependencies, std::default_delete<webrtc::PeerConnectionDependencies>>)arg4 delegate:(id)arg5; (0x1013d8788)
		- (id) addTransceiverWithTrack:(id)arg1 init:(id)arg2; (0x1013d98d4)
		- (id) addTransceiverOfType:(long)arg1 init:(id)arg2; (0x1013d9b3c)
		- (id) localStreams; (0x1013d8aa8)
		- (id) remoteDescription; (0x1013d8bc8)
		- (long) signalingState; (0x1013d8c64)
		- (long) iceConnectionState; (0x1013d8ca4)
		- (long) iceGatheringState; (0x1013d8d24)
		- (void) addIceCandidate:(id)arg1; (0x1013d8e98)
		- (void) removeStream:(id)arg1; (0x1013d9388)
		- (id) addTransceiverWithTrack:(id)arg1; (0x1013d984c)
		- (id) addTransceiverOfType:(long)arg1; (0x1013d9ac8)
		- (void) restartIce; (0x1013d9d48)
		- (void) setLocalDescriptionWithCompletionHandler:(^block)arg1; (0x1013da04c)
		- (BOOL) setBweMinBitrateBps:(id)arg1 currentBitrateBps:(id)arg2 maxBitrateBps:(id)arg3; (0x1013da200)
		- (BOOL) startRtcEventLogWithFilePath:(id)arg1 maxSizeInBytes:(long)arg2; (0x1013da330)
		- (void) stopRtcEventLog; (0x1013da584)
		- (id) senderWithKind:(id)arg1 streamId:(id)arg2; (0x1013da5b4)
		- (id) initWithFactory:(id)arg1 configuration:(id)arg2 constraints:(id)arg3 delegate:(id)arg4; (0x1013d8650)
		- (id) factory; (0x1013dabec)
		- (void) close; (0x1013d8e88)
		- (id) receivers; (0x1013da878)
		- (id) senders; (0x1013da760)
		- (id) .cxx_construct; (0x1013dac48)
		- (void) setDelegate:(id)arg1; (0x1013dabe0)
		- (BOOL) setConfiguration:(id)arg1; (0x1013d8d64)
		- (long) connectionState; (0x1013d8ce4)
		- (BOOL) removeTrack:(id)arg1; (0x1013d9730)
		- (id) delegate; (0x1013dabc8)
		- (id) configuration; (0x1013d8e18)
		- (void) .cxx_destruct; (0x1013dabf4)
		- (id) localDescription; (0x1013d8ac8)
		- (void) addStream:(id)arg1; (0x1013d9254)
(NSObject ...)
2. 给要断点的方法添加断点

breakpoint set --address 0x1013d9e34

(lldb) breakpoint set --address 0x1013d9e34
Breakpoint 3: where = WebRTC`___lldb_unnamed_symbol3605$$WebRTC + 3060, address = 0x00000001013d9e34
3. 运行到断点处查看自己需要的信息
  1. 查看当前类相关属性
(lldb) po $arg1	# 查看当前对象
<RTCPeerConnection: 0x280fb3b00>

(lldb) pinternals 0x280fb3b00 # 根据对象地址查看对象属性
(RTCPeerConnection) $18 = {
  NSObject = {
    isa = RTCPeerConnection
  }
  _factory = 0x0000000281474420
  _localStreams = 0x0000000281445500 @"0 elements"
  _hasStartedRtcEventLog = false
  _delegate = 0x0000000282decbb0
}
  1. 查看方法相关参数
(lldb) po (SEL)$arg2 # 查看方法名
"answerForConstraints:completionHandler:"

(lldb) po $arg3 # 查看第一个参数 是RTCMediaConstraints
RTC_OBJC_TYPE(RTCMediaConstraints):
{
    OfferToReceiveAudio = true;
    OfferToReceiveVideo = true;
}
{
}

(lldb) po $arg4 # 查看第二个参数 是一个block
<__NSStackBlock__: 0x16ef8e6f8>
 signature: "v24@?0@"RTCSessionDescription"8@"NSError"16"
 invoke   : 0x100e89ed4 (/private/var/containers/Bundle/Application/52E19451-C76A-47A5-AA4B-94296EF4BE79/AppRTCMobile.app/AppRTCMobile`__65-[ARDAppClient peerConnection:didSetSessionDescriptionWithError:]_block_invoke_2)
 copy     : 0x100e84f14 (/private/var/containers/Bundle/Application/52E19451-C76A-47A5-AA4B-94296EF4BE79/AppRTCMobile.app/AppRTCMobile`__copy_helper_block_e8_32w)
 dispose  : 0x100e84f48 (/private/var/containers/Bundle/Application/52E19451-C76A-47A5-AA4B-94296EF4BE79/AppRTCMobile.app/AppRTCMobile`__destroy_helper_block_e8_32w)

(lldb) pinternals 0x16ef8e6f8 
(__NSStackBlock__) $24 = {
  NSBlock = {
    NSObject = {
      isa = __NSStackBlock__
    }
  }
}
  1. 查看其它乱七八糟信息
(lldb) frame select 1  # 断点跳到frame 1
frame #1: 0x0000000100e89e44 AppRTCMobile`__65-[ARDAppClient peerConnection:didSetSessionDescriptionWithError:]_block_invoke(.block_descriptor=0x000000028145d710) at ARDAppClient.m:497:7
   494 	      RTC_OBJC_TYPE(RTCMediaConstraints) *constraints = [self defaultAnswerConstraints];
   495 	      __weak ARDAppClient *weakSelf = self;
   496 	        // 创建answer
-> 497 	      [self.peerConnection
    	      ^
   498 	          answerForConstraints:constraints
   499 	             completionHandler:^(RTC_OBJC_TYPE(RTCSessionDescription) * sdp, NSError * error) {
   500 	               ARDAppClient *strongSelf = weakSelf;
(lldb) frame variable	# 查看当前帧中局部变量的属性
(NSError *) error = nil
(ARDAppClient *) self = 0x0000000282decbb0
(RTCMediaConstraints *) constraints = 0x0000000281a9df20
(ARDAppClient *) weakSelf = 0x0000000282decbb0
(lldb) pinternals 0x0000000282decbb0	# 查看自己想看的属性
(ARDAppClient) $28 = {
  NSObject = {
    isa = ARDAppClient
  }
  _fileLogger = 0x0000000280f6d940
  _statsTimer = nil
  _settings = 0x00000002818e2930
  _localVideoTrack = 0x00000002814462e0
  _shouldGetStats = NO
  _isTurnComplete = YES
  _hasReceivedSdp = YES
  _isInitiator = NO
  _isLoopback = NO
  _broadcast = NO
  _state = kARDAppClientStateConnected
  _delegate = 0x0000000101d572b0
  _roomServerClient = 0x00000002818e2940
  _channel = 0x0000000280f99800
  _loopbackChannel = nil
  _turnClient = 0x00000002818e2950
  _peerConnection = 0x0000000280fb3b00
  _factory = 0x0000000281474420
  _messageQueue = 0x000000028147b420 @"4 elements"
  _roomId = 0xbef0bd39965b99ba @"17600001"
  _clientId = 0xbef1ddd8f5f3e3ba @"14536218"
  _iceServers = 0x000000028147b3c0 @"1 element"
  _websocketURL = 0x00000002834ce980 @"wss://apprtc-ws.webrtc.org:443/ws"
  _websocketRestURL = 0x00000002834cd180 @"https://apprtc-ws.webrtc.org:443"
  _defaultPeerConnectionConstraints = nil
}
(lldb) register read	# 顺便瞅一眼各寄存器里都是什么
General Purpose Registers:
        x0 = 0x0000000280fb3b00
        x1 = 0x0000000100e9feb3  "answerForConstraints:completionHandler:"
        x2 = 0x0000000281a9df20
        x3 = 0x000000016ef8e6f8
        x4 = 0x00000002834c0d80
        x5 = 0x0000000000000000
        x6 = 0x0000000000000000
        x7 = 0x0000000000000000
        x8 = 0x0000000100eb5000  "webSocket:didReceivePong:"
        x9 = 0x0000000000000000
       x10 = 0x0000000000000006
       x11 = 0x00000002834c56e8
       x12 = 0x0000000000000006
       x13 = 0x0000000000000000
       x14 = 0x0000000000000018
       x15 = 0x0000000000000001
       x16 = 0x0000000101b070f2  (void *)0xb2880000000101b0
       x17 = 0x00000001013d9e34  WebRTC`___lldb_unnamed_symbol3605$$WebRTC + 3060
       x18 = 0x0000000000000000
       x19 = 0x000000028145d710
       x20 = 0x0000000000000000
       x21 = 0x0000000280f96200
       x22 = 0x0000000000000000
       x23 = 0x0000000000000000
       x24 = 0x000000028145d710
       x25 = 0x000000010110bad8  libdispatch.dylib`_dispatch_call_block_and_release
       x26 = 0x0000000100e89aec  AppRTCMobile`__65-[ARDAppClient peerConnection:didSetSessionDescriptionWithError:]_block_invoke at ARDAppClient.m:477
       x27 = 0x00000001012eb960  dyld`_main_thread + 224
       x28 = 0x000000010116cc80  _dispatch_main_q
        fp = 0x000000016ef8e7b0
        lr = 0x0000000100e89e44  AppRTCMobile`__65-[ARDAppClient peerConnection:didSetSessionDescriptionWithError:]_block_invoke + 856 at ARDAppClient.m
        sp = 0x000000016ef8e610
        pc = 0x00000001013d9e38  WebRTC`___lldb_unnamed_symbol3605$$WebRTC + 3064
      cpsr = 0x40000000

(lldb) 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值