From 4d79526c46f4b67bdc2ca39b83f3a8feb9db5068 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 1 Dec 2008 10:13:41 -0500 Subject: [PATCH] Remove the model-updating-controller register variable code * Source/GDBpConnection.m: (refreshStatus): Removed (run): Call -[updateStatus] and not -[refreshStatus] (stepIn): ditto (stepOut): ditto (stepOver): ditto (updateStackTraceAndRegisters): Removed (createStackFrame): Fetch the contexts and variables * Source/GDBpConnection.h: Header updates --- Source/GDBpConnection.h | 2 -- Source/GDBpConnection.m | 48 ++++++++++++++++++----------------------- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/Source/GDBpConnection.h b/Source/GDBpConnection.h index d939c41..c5ec8e8 100644 --- a/Source/GDBpConnection.h +++ b/Source/GDBpConnection.h @@ -59,8 +59,6 @@ extern NSString *kErrorOccurredNotif; - (StackFrame *)stepOver; - (void)addBreakpoint:(Breakpoint *)bp; - (void)removeBreakpoint:(Breakpoint *)bp; -- (void)refreshStatus; -- (void)updateStackTraceAndRegisters; // helpers - (NSArray *)getProperty:(NSString *)property; diff --git a/Source/GDBpConnection.m b/Source/GDBpConnection.m index fe23782..346285c 100644 --- a/Source/GDBpConnection.m +++ b/Source/GDBpConnection.m @@ -155,19 +155,7 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; { [socket send:[self createCommand:@"run"]]; [socket receive]; - [self refreshStatus]; -} - -/** - * Method that runs tells the debugger to give us its status and will update the status text on the window - */ -- (void)refreshStatus -{ [self updateStatus]; - if ([status isEqualToString:@"Break"]) - { - [self updateStackTraceAndRegisters]; - } } /** @@ -179,7 +167,7 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; [socket receive]; StackFrame *frame = [self createStackFrame]; - [self refreshStatus]; + [self updateStatus]; return frame; } @@ -193,7 +181,7 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; [socket receive]; StackFrame *frame = [self createStackFrame]; - [self refreshStatus]; + [self updateStatus]; return frame; } @@ -207,22 +195,11 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; [socket receive]; StackFrame *frame = [self createStackFrame]; - [self refreshStatus]; + [self updateStatus]; return frame; } -/** - * This function queries the debug server for the current stacktrace and all the registers on - * level one. If a user then tries to expand past level one... TOOD: HOLY CRAP WHAT DO WE DO PAST LEVEL 1? - */ -- (void)updateStackTraceAndRegisters -{ - // do the registers - [socket send:[self createCommand:@"context_get"]]; - [windowController setRegister:[self processData:[socket receive]]]; -} - /** * Tells the debugger engine to get a specifc property. This also takes in the NSXMLElement * that requested it so that the child can be attached. @@ -321,9 +298,26 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; */ - (StackFrame *)createStackFrame { + // get the stack frame [socket send:[self createCommand:@"stack_get -d 0"]]; NSXMLDocument *doc = [self processData:[socket receive]]; + // get the names of all the contexts + [socket send:[self createCommand:@"context_names -d 0"]]; + NSXMLElement *contextNames = [[self processData:[socket receive]] rootElement]; + NSMutableDictionary *contexts = [NSMutableDictionary dictionary]; + for (NSXMLElement *context in [contextNames children]) + { + NSString *name = [[context attributeForName:@"name"] stringValue]; + int cid = [[[context attributeForName:@"id"] stringValue] intValue]; + + // fetch the contexts + [socket send:[self createCommand:[NSString stringWithFormat:@"context_get -d 0 -c %d", cid]]]; + NSArray *variables = [[[self processData:[socket receive]] rootElement] children]; + if (variables != nil && name != nil) + [contexts setObject:variables forKey:name]; + } + NSXMLElement *xmlframe = [[[doc rootElement] children] objectAtIndex:0]; StackFrame *frame = [[StackFrame alloc] initWithIndex:0 @@ -331,7 +325,7 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; withSource:nil atLine:[[[xmlframe attributeForName:@"lineno"] stringValue] intValue] inFunction:[[xmlframe attributeForName:@"where"] stringValue] - withContexts:nil + withContexts:contexts ]; return [frame autorelease]; -- 2.43.5