mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-20 18:32:17 +00:00
Merge branch 'master' of github.com:gnustep/apps-projectcenter into indentation_controller
This commit is contained in:
commit
50b835d2b3
4 changed files with 141 additions and 18 deletions
|
@ -1,3 +1,9 @@
|
|||
2021-06-22 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Modules/Debuggers/ProjectCenter/PCDebugger.h
|
||||
* Modules/Debuggers/ProjectCenter/PCDebugger.m
|
||||
Accessor methods for specific debugger information as wellas filename and line.
|
||||
|
||||
2021-02-19 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Modules/Editors/ProjectCenter/PCEditor.h
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
** PCDebugger
|
||||
**
|
||||
** Copyright (c) 2008-2016
|
||||
** Copyright (c) 2008-2021
|
||||
**
|
||||
** Author: Gregory Casamento <greg_casamento@yahoo.com>
|
||||
** Riccardo Mottola <rm@gnu.org>
|
||||
**
|
||||
** 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
|
||||
|
@ -44,7 +45,10 @@ extern NSString *PCDBDebuggerStartedNotification;
|
|||
NSString *executablePath;
|
||||
NSString *debuggerPath;
|
||||
int subProcessId;
|
||||
float gdbVersion;
|
||||
float debuggerVersion;
|
||||
NSDictionary *lastInfoParsed;
|
||||
NSString *lastFileNameParsed;
|
||||
NSUInteger lastLineNumberParsed;
|
||||
NSMutableArray *breakpoints;
|
||||
}
|
||||
|
||||
|
@ -55,7 +59,13 @@ extern NSString *PCDBDebuggerStartedNotification;
|
|||
- (void) interrupt;
|
||||
- (int) subProcessId;
|
||||
- (void) setSubProcessId:(int)pid;
|
||||
- (float) gdbVersion;
|
||||
- (void) setGdbVersion:(float)ver;
|
||||
- (float) debuggerVersion;
|
||||
- (void) setDebuggerVersion:(float)ver;
|
||||
- (NSDictionary *)lastInfoParsed;
|
||||
- (void)setSetInfoParsed: (NSDictionary *)dict;
|
||||
- (NSString *)lastFileNameParsed;
|
||||
- (void) setLastFileNameParsed: (NSString *)fname;
|
||||
- (NSUInteger)lastLineNumberParsed;
|
||||
- (void)setLastLineNumberParsed: (NSUInteger)num;
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
** PCDebugger.m
|
||||
**
|
||||
** Copyright (c) 2008-2020
|
||||
** Copyright (c) 2008-2021
|
||||
**
|
||||
** Author: Gregory Casamento <greg.casamento@gmail.com>
|
||||
** Riccardo Mottola <rm@gnu.org>>
|
||||
|
@ -156,7 +156,11 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
|
|||
[debuggerView setFont: [self consoleFont]];
|
||||
|
||||
subProcessId = 0;
|
||||
gdbVersion = 0.0;
|
||||
debuggerVersion = 0.0;
|
||||
|
||||
lastInfoParsed = nil;
|
||||
lastFileNameParsed = nil;
|
||||
lastLineNumberParsed = NSNotFound;
|
||||
|
||||
breakpoints = nil;
|
||||
|
||||
|
@ -187,7 +191,7 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
|
|||
{
|
||||
[debuggerView runProgram: debuggerPath
|
||||
inCurrentDirectory: [executablePath stringByDeletingLastPathComponent]
|
||||
withArguments: [[NSArray alloc] initWithObjects: @"--interpreter=mi", @"-f", executablePath, nil]
|
||||
withArguments: [[NSArray alloc] initWithObjects: @"--interpreter=mi", @"-f", executablePath, nil] // gdb dependent - should be generalized
|
||||
logStandardError: YES];
|
||||
|
||||
}
|
||||
|
@ -277,14 +281,44 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
|
|||
subProcessId = pid;
|
||||
}
|
||||
|
||||
- (float) gdbVersion
|
||||
- (float) debuggerVersion
|
||||
{
|
||||
return gdbVersion;
|
||||
return debuggerVersion;
|
||||
}
|
||||
|
||||
- (void) setGdbVersion:(float)ver
|
||||
- (void) setDebuggerVersion:(float)ver
|
||||
{
|
||||
gdbVersion = ver;
|
||||
debuggerVersion = ver;
|
||||
}
|
||||
|
||||
- (NSDictionary *)lastInfoParsed
|
||||
{
|
||||
return lastInfoParsed;
|
||||
}
|
||||
|
||||
- (void)setSetInfoParsed: (NSDictionary *)dict
|
||||
{
|
||||
lastInfoParsed = dict;
|
||||
}
|
||||
|
||||
- (NSString *)lastFileNameParsed
|
||||
{
|
||||
return lastFileNameParsed;
|
||||
}
|
||||
|
||||
- (void) setLastFileNameParsed: (NSString *)fname
|
||||
{
|
||||
lastFileNameParsed = fname;
|
||||
}
|
||||
|
||||
- (NSUInteger)lastLineNumberParsed
|
||||
{
|
||||
return lastLineNumberParsed;
|
||||
}
|
||||
|
||||
- (void)setLastLineNumberParsed: (NSUInteger)num
|
||||
{
|
||||
lastLineNumberParsed = num;
|
||||
}
|
||||
|
||||
// kill process
|
||||
|
|
|
@ -156,6 +156,46 @@
|
|||
[tView setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
/*
|
||||
parse subpart of the MI reply which may look like this:
|
||||
bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0804872c",func="main",file="main.m",fullname="/home/multix/code/gnustep-svc/DirectoryTest/main.m",line="23",thread-groups=["i1"],times="1",original-location="main.m:23"}
|
||||
*/
|
||||
- (NSDictionary *) parseKeyValueString: (NSString *)stringInput
|
||||
{
|
||||
if (nil != stringInput)
|
||||
{
|
||||
NSMutableDictionary *mdict;
|
||||
NSScanner *stringScanner;
|
||||
NSString *key = NULL;
|
||||
NSString *value = NULL;
|
||||
|
||||
mdict = [[NSMutableDictionary alloc] init];
|
||||
stringScanner = [NSScanner scannerWithString: stringInput];
|
||||
|
||||
while([stringScanner isAtEnd] == NO)
|
||||
{
|
||||
[stringScanner scanUpToString: @"=" intoString: &key];
|
||||
[stringScanner scanString: @"=" intoString: NULL];
|
||||
|
||||
[stringScanner scanString: @"\"" intoString: NULL];
|
||||
[stringScanner scanUpToString: @"\"" intoString: &value];
|
||||
[stringScanner scanString: @"\"" intoString: NULL];
|
||||
[stringScanner scanString: @"," intoString: NULL];
|
||||
|
||||
// we fail to parse if the value is in []
|
||||
// NSLog(@"parse KVS: key %@ value %@", key, value);
|
||||
if (key != nil && value != nil)
|
||||
[mdict setObject:value forKey:key];
|
||||
}
|
||||
return [mdict autorelease];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
/*
|
||||
Parses a line coming from the debugger. It could be eiher a stanard outpu or it may come from the machine
|
||||
interface of gdb.
|
||||
*/
|
||||
- (PCDebuggerOutputTypes) parseStringLine: (NSString *)stringInput
|
||||
{
|
||||
NSScanner *stringScanner;
|
||||
|
@ -183,6 +223,8 @@
|
|||
if(prefix != nil)
|
||||
{
|
||||
NSString *dictionaryName = NULL;
|
||||
|
||||
NSLog(@"scanning MI |%@|", stringInput);
|
||||
|
||||
[stringScanner scanUpToString: @"," intoString: &dictionaryName];
|
||||
|
||||
|
@ -194,22 +236,53 @@
|
|||
if(dictionaryName != nil)
|
||||
{
|
||||
NSString *key = NULL;
|
||||
NSString *value = NULL;
|
||||
id value = nil;
|
||||
|
||||
while([stringScanner isAtEnd] == NO)
|
||||
{
|
||||
[stringScanner scanString: @"," intoString: NULL];
|
||||
[stringScanner scanUpToString: @"=" intoString: &key];
|
||||
[stringScanner scanString: @"=" intoString: NULL];
|
||||
[stringScanner scanString: @"\"" intoString: NULL];
|
||||
[stringScanner scanUpToString: @"\"" intoString: &value];
|
||||
[stringScanner scanString: @"\"" intoString: NULL];
|
||||
if ([stringInput characterAtIndex:[stringScanner scanLocation]] == '{')
|
||||
{
|
||||
[stringScanner scanString: @"{" intoString: NULL];
|
||||
[stringScanner scanUpToString: @"}" intoString: &value];
|
||||
[stringScanner scanString: @"}" intoString: NULL];
|
||||
value = [self parseKeyValueString: value];
|
||||
}
|
||||
else
|
||||
{
|
||||
[stringScanner scanString: @"\"" intoString: NULL];
|
||||
[stringScanner scanUpToString: @"\"" intoString: &value];
|
||||
[stringScanner scanString: @"\"" intoString: NULL];
|
||||
}
|
||||
NSLog(@"key %@ value %@", key, value);
|
||||
|
||||
if([key isEqualToString:@"pid"] &&
|
||||
[dictionaryName isEqualToString: @"thread-group-started"])
|
||||
{
|
||||
[debugger setSubProcessId: [value intValue]];
|
||||
}
|
||||
else if ([key isEqualToString:@"bkpt"])
|
||||
{
|
||||
// gdb specific
|
||||
NSString *fileName;
|
||||
NSString *lineNum;
|
||||
|
||||
fileName = [value objectForKey:@"file"];
|
||||
lineNum = [value objectForKey:@"line"];
|
||||
NSLog(@"parsed from GDB bkpt: %@:%@", fileName, lineNum);
|
||||
if (fileName != nil && lineNum != nil)
|
||||
{
|
||||
[debugger setLastFileNameParsed: fileName];
|
||||
[debugger setLastLineNumberParsed: [lineNum intValue]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[debugger setLastFileNameParsed: nil];
|
||||
[debugger setLastLineNumberParsed: NSNotFound];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return PCDBAsyncInfoRecord;
|
||||
|
@ -236,7 +309,7 @@
|
|||
[stringScanner scanString: @"~" intoString: &prefix];
|
||||
if(prefix != nil)
|
||||
{
|
||||
if ([debugger gdbVersion] == 0.0)
|
||||
if ([debugger debuggerVersion] == 0.0)
|
||||
{
|
||||
NSString *str1 = nil;
|
||||
NSString *str2 = nil;
|
||||
|
@ -254,11 +327,11 @@
|
|||
if ([stringScanner scanFloat:&v])
|
||||
{
|
||||
NSLog(@"GDB version string: %f", v);
|
||||
[debugger setGdbVersion:v];
|
||||
[debugger setDebuggerVersion:v];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (([debugger gdbVersion] < 7) && [debugger subProcessId] == 0)
|
||||
if (([debugger debuggerVersion] < 7) && [debugger subProcessId] == 0)
|
||||
{
|
||||
NSString *str1;
|
||||
// we attempt to parse: [New thread 6800.0x18ec]
|
||||
|
|
Loading…
Reference in a new issue