Revert "Add support for function return breakpoints."
authorRobert Sesek <rsesek@bluestatic.org>
Wed, 11 Sep 2019 04:33:08 +0000 (00:33 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Wed, 11 Sep 2019 04:33:08 +0000 (00:33 -0400)
This reverts commit 167685c9d7d76bf463ede95fb83b3abefc38301a.

English.lproj/Breakpoints.xib
Source/Breakpoint.h
Source/Breakpoint.m
Source/BreakpointController.m
Source/DebuggerBackEnd.m

index 667ab4334ad0f0ecca22f35de363706c03112f82..1e1ae202ac68b2ff7cb295cf11fe4030ca50dd08 100644 (file)
@@ -89,7 +89,7 @@
                 <popUpButton verticalHuggingPriority="750" id="Rhe-Th-Bhr">
                     <rect key="frame" x="-1" y="-2" width="24" height="24"/>
                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                    <popUpButtonCell key="cell" type="smallSquare" bezelStyle="smallSquare" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" pullsDown="YES" arrowPosition="noArrow" preferredEdge="maxX" altersStateOfSelectedItem="NO" id="Dwf-ep-VTS">
+                    <popUpButtonCell key="cell" type="smallSquare" bezelStyle="smallSquare" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" pullsDown="YES" arrowPosition="noArrow" preferredEdge="maxX" altersStateOfSelectedItem="NO" selectedItem="CvR-xk-b9b" id="Dwf-ep-VTS">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="menu"/>
                         <menu key="menu" id="Rib-S1-dUw">
                                         <action selector="addBreakpoint:" target="-2" id="HVH-4f-zD3"/>
                                     </connections>
                                 </menuItem>
-                                <menuItem title="File Breakpoint" id="K7S-yj-EhU">
+                                <menuItem title="File breakpoint" id="K7S-yj-EhU">
                                     <modifierMask key="keyEquivalentModifierMask"/>
                                     <connections>
                                         <action selector="addBreakpoint:" target="-2" id="7gF-se-38S"/>
                                     </connections>
                                 </menuItem>
-                                <menuItem title="Function Entry" tag="101" id="bYU-4e-GiO">
+                                <menuItem title="Symbolic breakpoint" id="bYU-4e-GiO">
                                     <connections>
                                         <action selector="addFunctionBreakpoint:" target="-2" id="7Vn-6z-YfT"/>
                                     </connections>
                                 </menuItem>
-                                <menuItem title="Function Return" tag="114" id="HBr-Lu-4Xf">
-                                    <connections>
-                                        <action selector="addFunctionBreakpoint:" target="-2" id="0gN-sL-7Kg"/>
-                                    </connections>
-                                </menuItem>
                             </items>
                         </menu>
                     </popUpButtonCell>
index e79823cce498ac68adb92abdf15751a21e42364a..faa4df888f4a8c5130ddaf665a3b61db785d6b33 100644 (file)
@@ -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;
index b8eb658f4af492678415e196251517342d2d29e7..7a7b55e539200b4da310a2479a01f93780742565 100644 (file)
@@ -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
index dcce53594c0f365a9d5d2971cd5067088dbf6439..99f495dbf5c16d31ab57d963c59b6ca05e925c63 100644 (file)
 
 - (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];
 }
 
 /**
index 005fc49219e731e61edab1f0f364bf599032e93d..ba519776c62be89c8c6a01a3c2b06b67758b9fe9 100644 (file)
   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];
   }
 }