From bc1ccb5c37e2db7070eced715a7a7c59fbc3c3f0 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 30 Nov 2008 18:52:14 -0500 Subject: [PATCH] Adding the StackFrame class * Source/StackFrame.m+h: New files * MacGDBp.xcodeproj: Project updates --- MacGDBp.xcodeproj/project.pbxproj | 6 +++ Source/StackFrame.h | 67 +++++++++++++++++++++++++++++++ Source/StackFrame.m | 55 +++++++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 Source/StackFrame.h create mode 100644 Source/StackFrame.m diff --git a/MacGDBp.xcodeproj/project.pbxproj b/MacGDBp.xcodeproj/project.pbxproj index 15d606c..20b5c4d 100644 --- a/MacGDBp.xcodeproj/project.pbxproj +++ b/MacGDBp.xcodeproj/project.pbxproj @@ -26,6 +26,7 @@ 1E9582670E2524AD001A3D89 /* PreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E9582660E2524AD001A3D89 /* PreferencesController.m */; }; 1E9583200E2531BD001A3D89 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E95831F0E2531BD001A3D89 /* Sparkle.framework */; }; 1E95834C0E2531D5001A3D89 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1E95831F0E2531BD001A3D89 /* Sparkle.framework */; }; + 1EB7BED50ECF3CA90033283A /* StackFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EB7BED40ECF3CA90033283A /* StackFrame.m */; }; 1EEBFBE50D34C793008F835B /* Debugger.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1EEBFBE30D34C793008F835B /* Debugger.xib */; }; 1EEBFC2B0D358EBD008F835B /* StepIn.png in Resources */ = {isa = PBXBuildFile; fileRef = 1EEBFC2A0D358EBD008F835B /* StepIn.png */; }; 1EEBFC370D358F1B008F835B /* StepOut.png in Resources */ = {isa = PBXBuildFile; fileRef = 1EEBFC360D358F1B008F835B /* StepOut.png */; }; @@ -85,6 +86,8 @@ 1E9582650E2524AD001A3D89 /* PreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PreferencesController.h; path = Source/PreferencesController.h; sourceTree = ""; }; 1E9582660E2524AD001A3D89 /* PreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PreferencesController.m; path = Source/PreferencesController.m; sourceTree = ""; }; 1E95831F0E2531BD001A3D89 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = ""; }; + 1EB7BED30ECF3CA90033283A /* StackFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StackFrame.h; path = Source/StackFrame.h; sourceTree = ""; }; + 1EB7BED40ECF3CA90033283A /* StackFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StackFrame.m; path = Source/StackFrame.m; sourceTree = ""; }; 1EEBFBE40D34C793008F835B /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Debugger.xib; sourceTree = ""; }; 1EEBFC2A0D358EBD008F835B /* StepIn.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = StepIn.png; path = Icons/StepIn.png; sourceTree = ""; }; 1EEBFC360D358F1B008F835B /* StepOut.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = StepOut.png; path = Icons/StepOut.png; sourceTree = ""; }; @@ -236,6 +239,8 @@ children = ( 1E02C5F40C610724006F1752 /* DebuggerController.h */, 1E02C5F50C610724006F1752 /* DebuggerController.m */, + 1EB7BED30ECF3CA90033283A /* StackFrame.h */, + 1EB7BED40ECF3CA90033283A /* StackFrame.m */, ); name = Debugger; sourceTree = ""; @@ -383,6 +388,7 @@ 1E4C7AF90DA401C7000A9DC7 /* BreakpointManager.m in Sources */, 1EFF70C30DFDC018006B9D33 /* BreakpointController.m in Sources */, 1E9582670E2524AD001A3D89 /* PreferencesController.m in Sources */, + 1EB7BED50ECF3CA90033283A /* StackFrame.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/StackFrame.h b/Source/StackFrame.h new file mode 100644 index 0000000..d327e6c --- /dev/null +++ b/Source/StackFrame.h @@ -0,0 +1,67 @@ +/* + * MacGDBp + * Copyright (c) 2007 - 2008, Blue Static + * + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if not, + * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#import + + +@interface StackFrame : NSObject +{ + /** + * The position in the stack + */ + int index; + + /** + * File the current frame is in + */ + NSString *filename; + + /** + * Cached, highlighted version of the source + */ + NSString *source; + + /** + * Line number of the source the frame points to + */ + int lineNumber; + + /** + * Current-executing function + */ + NSString *function; + + /** + * Variable contexts (e.g. locals, class, etc.) + */ + NSDictionary *contexts; +} + +@property(readwrite) int index; +@property(readonly, copy) NSString *filename; +@property(readonly, copy) NSString *source; +@property(readwrite) int lineNumber; +@property(readwrite, copy) NSString *function; +@property(readonly, copy) NSDictionary *contexts; + +- (id)initWithIndex:(int)anIndex + withFilename:(NSString *)aFilename + withSource:(NSString *)aSource + atLine:(int)aLineNumber + inFunction:(NSString *)function + withContexts:(NSDictionary *)contexts; + +@end diff --git a/Source/StackFrame.m b/Source/StackFrame.m new file mode 100644 index 0000000..f5cd05a --- /dev/null +++ b/Source/StackFrame.m @@ -0,0 +1,55 @@ +/* + * MacGDBp + * Copyright (c) 2007 - 2008, Blue Static + * + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; if not, + * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#import "StackFrame.h" + +/** + * Private class continuation + */ +@interface StackFrame() +@property(readwrite, copy) NSString *filename; +@property(readwrite, copy) NSString *source; +@property(readwrite, copy) NSDictionary *contexts; +@end +/***/ + +@implementation StackFrame + +@synthesize index, filename, source, lineNumber, function, contexts; + +/** + * Constructor + */ +- (id)initWithIndex:(int)anIndex + withFilename:(NSString *)aFilename + withSource:(NSString *)aSource + atLine:(int)aLineNumber + inFunction:(NSString *)aFunction + withContexts:(NSDictionary *)aContexts +{ + if (self = [super init]) + { + self.index = anIndex; + self.filename = aFilename; + self.source = aSource; + self.lineNumber = aLineNumber; + self.function = aFunction; + self.contexts = aContexts; + } + return self; +} + +@end -- 2.43.5