summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/debugger
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2015-02-14 10:06:55 +1100
committer Vas Crabb <vas@vastheman.com>2015-02-14 18:00:56 +1100
commit6ec9472c846047715a216a442a54664be7c948e5 (patch)
treeafa6e4b98b4d9f8743cd2a93be7493cf754160a9 /src/osd/modules/debugger
parent146653f9d701fe7c5acc8a2b66df06c08fd98c23 (diff)
More intuitive command/expression history
Diffstat (limited to 'src/osd/modules/debugger')
-rw-r--r--src/osd/modules/debugger/debugosx.m50
-rw-r--r--src/osd/modules/debugger/osx/debugosxdebugcommandhistory.h1
-rw-r--r--src/osd/modules/debugger/osx/debugosxdebugcommandhistory.m13
-rw-r--r--src/osd/modules/debugger/osx/debugosxdebugconsole.h2
-rw-r--r--src/osd/modules/debugger/osx/debugosxdebugconsole.m10
-rw-r--r--src/osd/modules/debugger/osx/debugosxdebugview.h36
-rw-r--r--src/osd/modules/debugger/osx/debugosxdebugwindowhandler.h1
-rw-r--r--src/osd/modules/debugger/osx/debugosxdebugwindowhandler.m7
8 files changed, 73 insertions, 47 deletions
diff --git a/src/osd/modules/debugger/debugosx.m b/src/osd/modules/debugger/debugosx.m
index f8ea683a826..a662ef0a194 100644
--- a/src/osd/modules/debugger/debugosx.m
+++ b/src/osd/modules/debugger/debugosx.m
@@ -42,32 +42,34 @@
class debugger_osx : public osd_module, public debug_module
{
public:
- debugger_osx()
- : osd_module(OSD_DEBUG_PROVIDER, "osx"), debug_module(),
- m_machine(NULL),
- m_console(nil)
- {
- }
-
- virtual ~debugger_osx()
- {
- }
-
- virtual int init()
- {
- return 0;
- }
-
- virtual void exit()
- {
- }
-
- virtual void init_debugger(running_machine &machine);
- virtual void wait_for_debugger(device_t &device, bool firststop);
- virtual void debugger_update();
+ debugger_osx()
+ : osd_module(OSD_DEBUG_PROVIDER, "osx"), debug_module(),
+ m_machine(NULL),
+ m_console(nil)
+ {
+ }
+
+ virtual ~debugger_osx()
+ {
+ if (m_console != nil)
+ [m_console release];
+ }
+
+ virtual int init()
+ {
+ return 0;
+ }
+
+ virtual void exit()
+ {
+ }
+
+ virtual void init_debugger(running_machine &machine);
+ virtual void wait_for_debugger(device_t &device, bool firststop);
+ virtual void debugger_update();
private:
- running_machine *m_machine;
+ running_machine *m_machine;
MAMEDebugConsole *m_console;
};
diff --git a/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.h b/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.h
index 78f8fbe42c7..3cb0f23d06c 100644
--- a/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.h
+++ b/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.h
@@ -31,6 +31,7 @@
- (void)add:(NSString *)entry;
- (NSString *)previous:(NSString *)cur;
- (NSString *)next:(NSString *)cur;
+- (void)edit;
- (void)reset;
- (void)clear;
diff --git a/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.m b/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.m
index 9c1cd5093a0..0d9967370a5 100644
--- a/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.m
+++ b/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.m
@@ -50,8 +50,8 @@
- (void)setLength:(NSInteger)l {
length = l;
- while ([history count] > length)
- [history removeLastObject];
+ if ([history count] > length)
+ [history removeObjectsInRange:NSMakeRange(length, [history count] - length)];
}
@@ -61,7 +61,7 @@
while ([history count] > length)
[history removeLastObject];
}
- position = -1;
+ position = 0;
}
@@ -81,7 +81,7 @@
- (NSString *)next:(NSString *)cur {
if (position > 0) {
return [history objectAtIndex:--position];
- } else if (position == 0) {
+ } else if ((position == 0) && (current != nil) && ![current isEqualToString:[history objectAtIndex:0]]) {
position--;
return [[current retain] autorelease];
} else {
@@ -90,6 +90,11 @@
}
+- (void)edit {
+ if (position == 0)
+ position--;
+}
+
- (void)reset {
position = -1;
if (current != nil) {
diff --git a/src/osd/modules/debugger/osx/debugosxdebugconsole.h b/src/osd/modules/debugger/osx/debugosxdebugconsole.h
index 85639929c04..5de1d333b26 100644
--- a/src/osd/modules/debugger/osx/debugosxdebugconsole.h
+++ b/src/osd/modules/debugger/osx/debugosxdebugconsole.h
@@ -12,7 +12,6 @@
#import "debugosx.h"
#import "debugosxdebugwindowhandler.h"
-#include "device.h"
#include "emu.h"
#import <Cocoa/Cocoa.h>
@@ -44,6 +43,7 @@
- (void)showDebugger:(NSNotification *)notification;
- (void)auxiliaryWindowWillClose:(NSNotification *)notification;
+- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command;
- (void)windowWillClose:(NSNotification *)notification;
diff --git a/src/osd/modules/debugger/osx/debugosxdebugconsole.m b/src/osd/modules/debugger/osx/debugosxdebugconsole.m
index 4952e2ccdf6..56994dfc212 100644
--- a/src/osd/modules/debugger/osx/debugosxdebugconsole.m
+++ b/src/osd/modules/debugger/osx/debugosxdebugconsole.m
@@ -218,9 +218,11 @@
NSString *command = [sender stringValue];
if ([command length] == 0) {
debug_cpu_get_visible_cpu(*machine)->debug()->single_step();
+ [history reset];
} else {
debug_console_execute_command(*machine, [command UTF8String], 1);
[history add:command];
+ [history edit];
}
[sender setStringValue:@""];
}
@@ -264,6 +266,14 @@
}
+- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor {
+ if (control == commandField)
+ [history edit];
+
+ return YES;
+}
+
+
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command {
if (control == commandField) {
if (command == @selector(cancelOperation:)) {
diff --git a/src/osd/modules/debugger/osx/debugosxdebugview.h b/src/osd/modules/debugger/osx/debugosxdebugview.h
index 9688fa48b8e..06c25ea7c21 100644
--- a/src/osd/modules/debugger/osx/debugosxdebugview.h
+++ b/src/osd/modules/debugger/osx/debugosxdebugview.h
@@ -17,24 +17,6 @@
#import <Cocoa/Cocoa.h>
-@protocol MAMEDebugViewSubviewSupport <NSObject>
-
-- (NSString *)selectedSubviewName;
-- (int)selectedSubviewIndex;
-- (void)selectSubviewAtIndex:(int)index;
-- (void)selectSubviewForCPU:(device_t *)device;
-
-@end
-
-
-@protocol MAMEDebugViewExpressionSupport <NSObject>
-
-- (NSString *)expression;
-- (void)setExpression:(NSString *)exp;
-
-@end
-
-
@interface MAMEDebugView : NSView
{
int type;
@@ -66,3 +48,21 @@
- (void)windowDidResignKey:(NSNotification *)notification;
@end
+
+
+@protocol MAMEDebugViewSubviewSupport <NSObject>
+
+- (NSString *)selectedSubviewName;
+- (int)selectedSubviewIndex;
+- (void)selectSubviewAtIndex:(int)index;
+- (void)selectSubviewForCPU:(device_t *)device;
+
+@end
+
+
+@protocol MAMEDebugViewExpressionSupport <NSObject>
+
+- (NSString *)expression;
+- (void)setExpression:(NSString *)exp;
+
+@end
diff --git a/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.h b/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.h
index 35f8be2b67b..a45a65cac63 100644
--- a/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.h
+++ b/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.h
@@ -91,6 +91,7 @@ extern NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification;
- (IBAction)doExpression:(id)sender;
+- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command;
@end
diff --git a/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.m b/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.m
index d5382c19454..e8585179b96 100644
--- a/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.m
+++ b/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.m
@@ -357,6 +357,13 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
}
+- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor
+{
+ [history edit];
+ return YES;
+}
+
+
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command {
if (control == expressionField) {
if (command == @selector(cancelOperation:)) {