From 9371ab6efb4d371e9db5f9e72b8f2cdf38a3a8de Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 4 Aug 2007 00:50:45 -0700 Subject: [PATCH] Instead of directly calling stack_get, get the depth first and then call the maximum depth * Source/DebuggerConnection.m: ([DebuggerConnection updateStackTraceAndRegisters]): Call stack_depth which in turn calls stack_get ([DebuggerConnection _stackDepthReceived:]): Receives the depth of the stack and then asks for the stack at that depth --- Source/DebuggerConnection.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index b1d825b..86b8601 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -192,7 +192,19 @@ */ - (void)updateStackTraceAndRegisters { - [_socket send: [self _createCommand: @"stack_get"]]; + [_socket send: [self _createCommand: @"stack_depth"]]; + [_socket receive: @selector(_stackDepthReceived:)]; +} + +/** + * Packet delivery method for when we have the stack depth. This just goes back and asks the + * debug server for the stack at that depth + */ +- (void)_stackDepthReceived: (NSString *)packet +{ + NSXMLDocument *doc = [[NSXMLDocument alloc] initWithXMLString: packet options: NSXMLDocumentTidyXML error: nil]; + int depth = [[[[doc rootElement] attributeForName: @"depth"] stringValue] intValue]; + [_socket send: [self _createCommand: [NSString stringWithFormat: @"stack_get -d %d", (depth - 1)]]]; [_socket receive: @selector(_stackReceived:)]; } -- 2.22.5