mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-20 18:32:17 +00:00
increase parsing of stream and async records, also log LogStreamOutput as aid
This commit is contained in:
parent
f68e83ad6f
commit
b7cfa30f20
2 changed files with 60 additions and 23 deletions
|
@ -32,9 +32,10 @@ typedef enum PCDebuggerOutputType_enum {
|
||||||
PCDBResultRecord,
|
PCDBResultRecord,
|
||||||
PCDBConsoleStreamRecord,
|
PCDBConsoleStreamRecord,
|
||||||
PCDBTargetStreamRecord,
|
PCDBTargetStreamRecord,
|
||||||
PCDBDebugStreamRecord,
|
PCDBLogStreamRecord,
|
||||||
PCDBAsyncStatusRecord,
|
PCDBAsyncStatusRecord,
|
||||||
PCDBAsyncInfoRecord,
|
PCDBAsyncExecRecord,
|
||||||
|
PCDBAsyncNotifyRecord,
|
||||||
PCDBBreakpointRecord,
|
PCDBBreakpointRecord,
|
||||||
PCDBFrameRecord,
|
PCDBFrameRecord,
|
||||||
PCDBThreadRecord,
|
PCDBThreadRecord,
|
||||||
|
@ -62,6 +63,8 @@ typedef enum PCDebuggerOutputType_enum {
|
||||||
|
|
||||||
BOOL debuggerStarted;
|
BOOL debuggerStarted;
|
||||||
float debuggerVersion;
|
float debuggerVersion;
|
||||||
|
NSDictionary *lastMIDictionary;
|
||||||
|
NSString *lastMIString;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (float) debuggerVersion;
|
- (float) debuggerVersion;
|
||||||
|
|
|
@ -331,12 +331,13 @@
|
||||||
return PCDBPromptRecord;
|
return PCDBPromptRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// notify-async-output
|
||||||
[stringScanner scanString: @"=" intoString: &prefix];
|
[stringScanner scanString: @"=" intoString: &prefix];
|
||||||
if(prefix != nil)
|
if(prefix != nil)
|
||||||
{
|
{
|
||||||
NSString *dictionaryName = NULL;
|
NSString *dictionaryName = NULL;
|
||||||
|
|
||||||
NSLog(@"scanning AsyncInfo |%@|", stringInput);
|
NSLog(@"scanning NotifyAsyncInfo |%@|", stringInput);
|
||||||
|
|
||||||
[stringScanner scanUpToString: @"," intoString: &dictionaryName];
|
[stringScanner scanUpToString: @"," intoString: &dictionaryName];
|
||||||
|
|
||||||
|
@ -349,6 +350,7 @@
|
||||||
[stringScanner scanString: @"," intoString: NULL];
|
[stringScanner scanString: @"," intoString: NULL];
|
||||||
dict = [self parseKeyValue: stringScanner];
|
dict = [self parseKeyValue: stringScanner];
|
||||||
NSLog(@"type %@ value %@", dictionaryName, dict);
|
NSLog(@"type %@ value %@", dictionaryName, dict);
|
||||||
|
lastMIDictionary = dict;
|
||||||
|
|
||||||
if([dict objectForKey:@"pid"] != nil &&
|
if([dict objectForKey:@"pid"] != nil &&
|
||||||
[dictionaryName isEqualToString: @"thread-group-started"])
|
[dictionaryName isEqualToString: @"thread-group-started"])
|
||||||
|
@ -382,16 +384,17 @@
|
||||||
{
|
{
|
||||||
NSLog(@"error parsing type of: %@", stringInput);
|
NSLog(@"error parsing type of: %@", stringInput);
|
||||||
}
|
}
|
||||||
return PCDBAsyncInfoRecord;
|
return PCDBAsyncNotifyRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// exec-async-output
|
||||||
[stringScanner scanString: @"*" intoString: &prefix];
|
[stringScanner scanString: @"*" intoString: &prefix];
|
||||||
if(prefix != nil)
|
if(prefix != nil)
|
||||||
{
|
{
|
||||||
NSString *dictionaryName = NULL;
|
NSString *dictionaryName = NULL;
|
||||||
NSDictionary *dict = nil;
|
NSDictionary *dict = nil;
|
||||||
|
|
||||||
NSLog(@"scanning AsyncStatus |%@|", stringInput);
|
NSLog(@"scanning ExecAsyncStatus |%@|", stringInput);
|
||||||
|
|
||||||
[stringScanner scanUpToString: @"," intoString: &dictionaryName];
|
[stringScanner scanUpToString: @"," intoString: &dictionaryName];
|
||||||
|
|
||||||
|
@ -400,6 +403,7 @@
|
||||||
[stringScanner scanString: @"," intoString: NULL];
|
[stringScanner scanString: @"," intoString: NULL];
|
||||||
dict = [self parseKeyValue: stringScanner];
|
dict = [self parseKeyValue: stringScanner];
|
||||||
NSLog(@"type %@ value %@", dictionaryName, dict);
|
NSLog(@"type %@ value %@", dictionaryName, dict);
|
||||||
|
lastMIDictionary = dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([dictionaryName isEqualToString:@"stopped"])
|
if ([dictionaryName isEqualToString:@"stopped"])
|
||||||
|
@ -427,21 +431,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return PCDBAsyncExecRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
// status-async-output
|
||||||
|
[stringScanner scanString: @"+" intoString: &prefix];
|
||||||
|
if(prefix != nil)
|
||||||
|
{
|
||||||
|
NSString *dictionaryName = NULL;
|
||||||
|
NSDictionary *dict = nil;
|
||||||
|
|
||||||
|
NSLog(@"scanning AsyncStatus |%@|", stringInput);
|
||||||
|
|
||||||
return PCDBAsyncStatusRecord;
|
return PCDBAsyncStatusRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
[stringScanner scanString: @"<-" intoString: &prefix];
|
// console-stream-output
|
||||||
if(prefix != nil)
|
|
||||||
{
|
|
||||||
return PCDBBreakpointRecord;
|
|
||||||
}
|
|
||||||
|
|
||||||
[stringScanner scanString: @"->" intoString: &prefix];
|
|
||||||
if(prefix != nil)
|
|
||||||
{
|
|
||||||
return PCDBBreakpointRecord;
|
|
||||||
}
|
|
||||||
|
|
||||||
[stringScanner scanString: @"~" intoString: &prefix];
|
[stringScanner scanString: @"~" intoString: &prefix];
|
||||||
if(prefix != nil)
|
if(prefix != nil)
|
||||||
{
|
{
|
||||||
|
@ -485,23 +490,28 @@
|
||||||
return PCDBConsoleStreamRecord;
|
return PCDBConsoleStreamRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// target-stream-output
|
||||||
[stringScanner scanString: @"@" intoString: &prefix];
|
[stringScanner scanString: @"@" intoString: &prefix];
|
||||||
if(prefix != nil)
|
if(prefix != nil)
|
||||||
{
|
{
|
||||||
|
lastMIString = [[stringScanner string] substringFromIndex: [stringScanner scanLocation]];
|
||||||
return PCDBTargetStreamRecord;
|
return PCDBTargetStreamRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// log-stream-output
|
||||||
[stringScanner scanString: @"&" intoString: &prefix];
|
[stringScanner scanString: @"&" intoString: &prefix];
|
||||||
if(prefix != nil)
|
if(prefix != nil)
|
||||||
{
|
{
|
||||||
return PCDBDebugStreamRecord;
|
lastMIString = [[stringScanner string] substringFromIndex: [stringScanner scanLocation]];
|
||||||
|
return PCDBLogStreamRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// result-record
|
||||||
[stringScanner scanString: @"^" intoString: &prefix];
|
[stringScanner scanString: @"^" intoString: &prefix];
|
||||||
if(prefix != nil)
|
if(prefix != nil)
|
||||||
{
|
{
|
||||||
NSString *result = nil;
|
NSString *result = nil;
|
||||||
|
|
||||||
[stringScanner scanString: @"done" intoString: &result];
|
[stringScanner scanString: @"done" intoString: &result];
|
||||||
if(result != nil)
|
if(result != nil)
|
||||||
{
|
{
|
||||||
|
@ -534,6 +544,22 @@
|
||||||
}
|
}
|
||||||
return PCDBResultRecord;
|
return PCDBResultRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[stringScanner scanString: @"<-" intoString: &prefix];
|
||||||
|
if(prefix != nil)
|
||||||
|
{
|
||||||
|
lastMIString = [[stringScanner string] substringFromIndex: [stringScanner scanLocation]];
|
||||||
|
return PCDBBreakpointRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
[stringScanner scanString: @"->" intoString: &prefix];
|
||||||
|
if(prefix != nil)
|
||||||
|
{
|
||||||
|
lastMIString = [[stringScanner string] substringFromIndex: [stringScanner scanLocation]];
|
||||||
|
return PCDBBreakpointRecord;
|
||||||
|
}
|
||||||
|
|
||||||
NSLog(@"No match found parsing: |%@|", stringInput);
|
NSLog(@"No match found parsing: |%@|", stringInput);
|
||||||
return PCDBNotFoundRecord;
|
return PCDBNotFoundRecord;
|
||||||
}
|
}
|
||||||
|
@ -544,7 +570,7 @@
|
||||||
|
|
||||||
if ([unescapedString hasPrefix:@"~\""])
|
if ([unescapedString hasPrefix:@"~\""])
|
||||||
unescapedString = [unescapedString substringFromIndex:2];
|
unescapedString = [unescapedString substringFromIndex:2];
|
||||||
if ([unescapedString hasSuffix:@"\""])\
|
if ([unescapedString hasSuffix:@"\""])
|
||||||
unescapedString = [unescapedString substringToIndex: [unescapedString length] - 1];
|
unescapedString = [unescapedString substringToIndex: [unescapedString length] - 1];
|
||||||
unescapedString = [unescapedString stringByReplacingOccurrencesOfString: @"\\\"" withString: @"\""];
|
unescapedString = [unescapedString stringByReplacingOccurrencesOfString: @"\\\"" withString: @"\""];
|
||||||
unescapedString = [unescapedString stringByReplacingOccurrencesOfString: @"\\n" withString: @"\n"];
|
unescapedString = [unescapedString stringByReplacingOccurrencesOfString: @"\\n" withString: @"\n"];
|
||||||
|
@ -580,12 +606,20 @@
|
||||||
{
|
{
|
||||||
[self logString: item newLine: NO withColor:promptColor];
|
[self logString: item newLine: NO withColor:promptColor];
|
||||||
}
|
}
|
||||||
/*
|
else if(outtype == PCDBAsyncStatusRecord || outtype == PCDBAsyncExecRecord || outtype == PCDBAsyncNotifyRecord)
|
||||||
else if(outtype == PCDBNotFoundRecord)
|
|
||||||
{
|
{
|
||||||
[self logString: item newLine: NO withColor:promptColor];
|
[self logString: item newLine: NO withColor:promptColor];
|
||||||
}
|
}
|
||||||
*/
|
else if(outtype == PCDBLogStreamRecord)
|
||||||
|
{
|
||||||
|
NSString *unescapedString = [self unescapeOutputRecord: lastMIString];
|
||||||
|
// this should usually stay silent, log for debugging purposes
|
||||||
|
[self logString: unescapedString newLine: NO withColor:debuggerColor];
|
||||||
|
}
|
||||||
|
else if(outtype == PCDBNotFoundRecord)
|
||||||
|
{
|
||||||
|
[self logString: item newLine: NO withColor:errorColor];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue