<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>
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.
@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;
NSString* const kBreakpointTypeFile = @"line";
NSString* const kBreakpointTypeFunctionEntry = @"call";
-NSString* const kBreakpointTypeFunctionReturn = @"return";
@implementation Breakpoint {
NSString* _type; // weak
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;
}
} 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];
{
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;
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];
}
@"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
- (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];
}
/**
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];
}
}