trunk/src/osd/modules/debugger/debugosx.m
| r243535 | r243536 | |
| 42 | 42 | class debugger_osx : public osd_module, public debug_module |
| 43 | 43 | { |
| 44 | 44 | public: |
| 45 | | debugger_osx() |
| 46 | | : osd_module(OSD_DEBUG_PROVIDER, "osx"), debug_module(), |
| 47 | | m_machine(NULL), |
| 48 | | m_console(nil) |
| 49 | | { |
| 50 | | } |
| 45 | debugger_osx() |
| 46 | : osd_module(OSD_DEBUG_PROVIDER, "osx"), debug_module(), |
| 47 | m_machine(NULL), |
| 48 | m_console(nil) |
| 49 | { |
| 50 | } |
| 51 | 51 | |
| 52 | | virtual ~debugger_osx() |
| 53 | | { |
| 54 | | } |
| 52 | virtual ~debugger_osx() |
| 53 | { |
| 54 | if (m_console != nil) |
| 55 | [m_console release]; |
| 56 | } |
| 55 | 57 | |
| 56 | | virtual int init() |
| 57 | | { |
| 58 | | return 0; |
| 59 | | } |
| 58 | virtual int init() |
| 59 | { |
| 60 | return 0; |
| 61 | } |
| 60 | 62 | |
| 61 | | virtual void exit() |
| 62 | | { |
| 63 | | } |
| 63 | virtual void exit() |
| 64 | { |
| 65 | } |
| 64 | 66 | |
| 65 | | virtual void init_debugger(running_machine &machine); |
| 66 | | virtual void wait_for_debugger(device_t &device, bool firststop); |
| 67 | | virtual void debugger_update(); |
| 67 | virtual void init_debugger(running_machine &machine); |
| 68 | virtual void wait_for_debugger(device_t &device, bool firststop); |
| 69 | virtual void debugger_update(); |
| 68 | 70 | |
| 69 | 71 | private: |
| 70 | | running_machine *m_machine; |
| 72 | running_machine *m_machine; |
| 71 | 73 | MAMEDebugConsole *m_console; |
| 72 | 74 | }; |
| 73 | 75 | |
trunk/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.m
| r243535 | r243536 | |
| 50 | 50 | |
| 51 | 51 | - (void)setLength:(NSInteger)l { |
| 52 | 52 | length = l; |
| 53 | | while ([history count] > length) |
| 54 | | [history removeLastObject]; |
| 53 | if ([history count] > length) |
| 54 | [history removeObjectsInRange:NSMakeRange(length, [history count] - length)]; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| r243535 | r243536 | |
| 61 | 61 | while ([history count] > length) |
| 62 | 62 | [history removeLastObject]; |
| 63 | 63 | } |
| 64 | | position = -1; |
| 64 | position = 0; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| r243535 | r243536 | |
| 81 | 81 | - (NSString *)next:(NSString *)cur { |
| 82 | 82 | if (position > 0) { |
| 83 | 83 | return [history objectAtIndex:--position]; |
| 84 | | } else if (position == 0) { |
| 84 | } else if ((position == 0) && (current != nil) && ![current isEqualToString:[history objectAtIndex:0]]) { |
| 85 | 85 | position--; |
| 86 | 86 | return [[current retain] autorelease]; |
| 87 | 87 | } else { |
| r243535 | r243536 | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | - (void)edit { |
| 94 | if (position == 0) |
| 95 | position--; |
| 96 | } |
| 97 | |
| 93 | 98 | - (void)reset { |
| 94 | 99 | position = -1; |
| 95 | 100 | if (current != nil) { |
trunk/src/osd/modules/debugger/osx/debugosxdebugconsole.m
| r243535 | r243536 | |
| 218 | 218 | NSString *command = [sender stringValue]; |
| 219 | 219 | if ([command length] == 0) { |
| 220 | 220 | debug_cpu_get_visible_cpu(*machine)->debug()->single_step(); |
| 221 | [history reset]; |
| 221 | 222 | } else { |
| 222 | 223 | debug_console_execute_command(*machine, [command UTF8String], 1); |
| 223 | 224 | [history add:command]; |
| 225 | [history edit]; |
| 224 | 226 | } |
| 225 | 227 | [sender setStringValue:@""]; |
| 226 | 228 | } |
| r243535 | r243536 | |
| 264 | 266 | } |
| 265 | 267 | |
| 266 | 268 | |
| 269 | - (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor { |
| 270 | if (control == commandField) |
| 271 | [history edit]; |
| 272 | |
| 273 | return YES; |
| 274 | } |
| 275 | |
| 276 | |
| 267 | 277 | - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command { |
| 268 | 278 | if (control == commandField) { |
| 269 | 279 | if (command == @selector(cancelOperation:)) { |
trunk/src/osd/modules/debugger/osx/debugosxdebugview.h
| r243535 | r243536 | |
| 17 | 17 | #import <Cocoa/Cocoa.h> |
| 18 | 18 | |
| 19 | 19 | |
| 20 | | @protocol MAMEDebugViewSubviewSupport <NSObject> |
| 21 | | |
| 22 | | - (NSString *)selectedSubviewName; |
| 23 | | - (int)selectedSubviewIndex; |
| 24 | | - (void)selectSubviewAtIndex:(int)index; |
| 25 | | - (void)selectSubviewForCPU:(device_t *)device; |
| 26 | | |
| 27 | | @end |
| 28 | | |
| 29 | | |
| 30 | | @protocol MAMEDebugViewExpressionSupport <NSObject> |
| 31 | | |
| 32 | | - (NSString *)expression; |
| 33 | | - (void)setExpression:(NSString *)exp; |
| 34 | | |
| 35 | | @end |
| 36 | | |
| 37 | | |
| 38 | 20 | @interface MAMEDebugView : NSView |
| 39 | 21 | { |
| 40 | 22 | int type; |
| r243535 | r243536 | |
| 66 | 48 | - (void)windowDidResignKey:(NSNotification *)notification; |
| 67 | 49 | |
| 68 | 50 | @end |
| 51 | |
| 52 | |
| 53 | @protocol MAMEDebugViewSubviewSupport <NSObject> |
| 54 | |
| 55 | - (NSString *)selectedSubviewName; |
| 56 | - (int)selectedSubviewIndex; |
| 57 | - (void)selectSubviewAtIndex:(int)index; |
| 58 | - (void)selectSubviewForCPU:(device_t *)device; |
| 59 | |
| 60 | @end |
| 61 | |
| 62 | |
| 63 | @protocol MAMEDebugViewExpressionSupport <NSObject> |
| 64 | |
| 65 | - (NSString *)expression; |
| 66 | - (void)setExpression:(NSString *)exp; |
| 67 | |
| 68 | @end |