From 2bb2827a0e99f66cd59cd9e332d4e8d3e1881758 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 11 Sep 2019 00:33:08 -0400 Subject: [PATCH] Revert "Add support for function return breakpoints." This reverts commit 167685c9d7d76bf463ede95fb83b3abefc38301a. --- English.lproj/Breakpoints.xib | 11 +++-------- Source/Breakpoint.h | 3 +-- Source/Breakpoint.m | 18 +++++------------- Source/BreakpointController.m | 21 ++++----------------- Source/DebuggerBackEnd.m | 7 ++----- 5 files changed, 15 insertions(+), 45 deletions(-) diff --git a/English.lproj/Breakpoints.xib b/English.lproj/Breakpoints.xib index 667ab43..1e1ae20 100644 --- a/English.lproj/Breakpoints.xib +++ b/English.lproj/Breakpoints.xib @@ -89,7 +89,7 @@ - + @@ -100,22 +100,17 @@ - + - + - - - - - diff --git a/Source/Breakpoint.h b/Source/Breakpoint.h index e79823c..faa4df8 100644 --- a/Source/Breakpoint.h +++ b/Source/Breakpoint.h @@ -18,7 +18,6 @@ extern NSString* const kBreakpointTypeFile; extern NSString* const kBreakpointTypeFunctionEntry; -extern NSString* const kBreakpointTypeFunctionReturn; // This represents a breakpoint at a certain file and line number. It also // maintains the identifier that the backend assigns to the breakpoint. @@ -41,7 +40,7 @@ extern NSString* const kBreakpointTypeFunctionReturn; @property (readonly) NSString* functionName; + (instancetype)breakpointAtLine:(unsigned long)line inFile:(NSString*)file; -+ (instancetype)breakpointOnFunctionNamed:(NSString*)name type:(NSString*)type; ++ (instancetype)breakpointOnFunctionNamed:(NSString*)name; // Initializer from NSUserDefaults. - (instancetype)initWithDictionary:(NSDictionary*)dict; diff --git a/Source/Breakpoint.m b/Source/Breakpoint.m index b8eb658..7a7b55e 100644 --- a/Source/Breakpoint.m +++ b/Source/Breakpoint.m @@ -20,7 +20,6 @@ NSString* const kBreakpointTypeFile = @"line"; NSString* const kBreakpointTypeFunctionEntry = @"call"; -NSString* const kBreakpointTypeFunctionReturn = @"return"; @implementation Breakpoint { NSString* _type; // weak @@ -40,11 +39,10 @@ NSString* const kBreakpointTypeFunctionReturn = @"return"; return breakpoint; } -+ (instancetype)breakpointOnFunctionNamed:(NSString*)name type:(NSString*)type ++ (instancetype)breakpointOnFunctionNamed:(NSString*)name { Breakpoint* breakpoint = [[[Breakpoint alloc] init] autorelease]; - NSAssert1(type == kBreakpointTypeFunctionEntry || type == kBreakpointTypeFunctionReturn, @"Unexpected breakpoint type: %@", type); - breakpoint->_type = type; + breakpoint->_type = kBreakpointTypeFunctionEntry; breakpoint->_functionName = [name copy]; return breakpoint; } @@ -60,9 +58,6 @@ NSString* const kBreakpointTypeFunctionReturn = @"return"; } else if ([type isEqualToString:kBreakpointTypeFunctionEntry]) { _type = kBreakpointTypeFunctionEntry; _functionName = [[dict valueForKey:@"function"] copy]; - } else if ([type isEqualToString:kBreakpointTypeFunctionReturn]) { - _type = kBreakpointTypeFunctionReturn; - _functionName = [[dict valueForKey:@"function"] copy]; } else { [NSException raise:NSInvalidArgumentException format:@"Unknown Breakpoint type: %@", type]; @@ -85,8 +80,7 @@ NSString* const kBreakpointTypeFunctionReturn = @"return"; { if (self.type == kBreakpointTypeFile) { return [NSString stringWithFormat:@"%@:%ld", self.file, self.line]; - } else if (self.type == kBreakpointTypeFunctionEntry || - self.type == kBreakpointTypeFunctionReturn) { + } else if (self.type == kBreakpointTypeFunctionEntry) { return [NSString stringWithFormat:@"%@()", self.functionName]; } return nil; @@ -127,8 +121,7 @@ NSString* const kBreakpointTypeFunctionReturn = @"return"; if (self.type == kBreakpointTypeFile) { return [self.file isEqualToString:other.file] && self.line == other.line; - } else if (self.type == kBreakpointTypeFunctionEntry || - self.type == kBreakpointTypeFunctionReturn) { + } else if (self.type == kBreakpointTypeFunctionEntry) { return [self.functionName isEqualToString:other.functionName]; } @@ -143,8 +136,7 @@ NSString* const kBreakpointTypeFunctionReturn = @"return"; @"file" : self.file, @"line" : @(self.line) }; - } else if (self.type == kBreakpointTypeFunctionEntry || - self.type == kBreakpointTypeFunctionReturn) { + } else if (self.type == kBreakpointTypeFunctionEntry) { return @{ @"type" : self.type, @"function" : self.functionName diff --git a/Source/BreakpointController.m b/Source/BreakpointController.m index dcce535..99f495d 100644 --- a/Source/BreakpointController.m +++ b/Source/BreakpointController.m @@ -64,31 +64,18 @@ - (IBAction)addFunctionBreakpoint:(id)sender { - NSUInteger tag = [sender tag]; - NSString* type; - if (tag == 'e') { - type = kBreakpointTypeFunctionEntry; - } else if (tag == 'r') { - type = kBreakpointTypeFunctionReturn; - } else { - [NSException raise:NSInvalidArgumentException - format:@"Unexpected breakpoint type from tag %ld sender %@", tag, sender]; - } - [self.view.window beginSheet:self.addFunctionBreakpointWindow completionHandler:^(NSModalResponse returnCode) { - if (returnCode == NSModalResponseOK) { - [_manager addBreakpoint:[Breakpoint breakpointOnFunctionNamed:self.functionNameField.stringValue type:type]]; - } - }]; + [self.view.window beginSheet:self.addFunctionBreakpointWindow completionHandler:nil]; } - (IBAction)cancelFunctionBreakpoint:(id)sender { - [self.view.window endSheet:self.addFunctionBreakpointWindow returnCode:NSModalResponseCancel]; + [self.view.window endSheet:self.addFunctionBreakpointWindow]; } - (IBAction)saveFunctionBreakpoint:(id)sender { - [self.view.window endSheet:self.addFunctionBreakpointWindow returnCode:NSModalResponseOK]; + [_manager addBreakpoint:[Breakpoint breakpointOnFunctionNamed:self.functionNameField.stringValue]]; + [self.view.window endSheet:self.addFunctionBreakpointWindow]; } /** diff --git a/Source/DebuggerBackEnd.m b/Source/DebuggerBackEnd.m index 005fc49..ba51977 100644 --- a/Source/DebuggerBackEnd.m +++ b/Source/DebuggerBackEnd.m @@ -207,11 +207,8 @@ if (bp.type == kBreakpointTypeFile) { NSString* file = [ProtocolClient escapedFilePathURI:[bp transformedPath]]; [_client sendCommandWithFormat:@"breakpoint_set -t line -f %@ -n %i" handler:handler, file, [bp line]]; - } else if (bp.type == kBreakpointTypeFunctionEntry || - bp.type == kBreakpointTypeFunctionReturn) { - [_client sendCommandWithFormat:@"breakpoint_set -t %@ -m %@" handler:handler, bp.type, bp.functionName]; - } else { - [NSException raise:NSInvalidArgumentException format:@"Unknown breakpoint type %@", bp.type]; + } else if (bp.type == kBreakpointTypeFunctionEntry) { + [_client sendCommandWithFormat:@"breakpoint_set -t call -m %@" handler:handler, bp.functionName]; } } -- 2.43.5